JaredBailey commited on
Commit
d77ffda
·
verified ·
1 Parent(s): d53bf28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -19,6 +19,8 @@
19
  import streamlit as st
20
  import streamlit.components.v1 as components
21
  from PIL import ImageOps, Image
 
 
22
  import torch
23
  from ultralytics import YOLO
24
  from src.tiles import *
@@ -197,6 +199,14 @@ if st.session_state.screen == 2:
197
  with row5_col2:
198
  # st.image(st.session_state.image, use_column_width=True)
199
  st.session_state.boxed_image = cv2.imread(st.session_state.image)
 
 
 
 
 
 
 
 
200
  st.image(st.session_state.boxed_image, use_column_width=True)
201
 
202
  with row5_col3:
 
19
  import streamlit as st
20
  import streamlit.components.v1 as components
21
  from PIL import ImageOps, Image
22
+ import cv2
23
+ import numpy as np
24
  import torch
25
  from ultralytics import YOLO
26
  from src.tiles import *
 
199
  with row5_col2:
200
  # st.image(st.session_state.image, use_column_width=True)
201
  st.session_state.boxed_image = cv2.imread(st.session_state.image)
202
+ # st.session_state.boxed_image = cv2.cvtColor(st.session_state.boxed_image, cv2.COLOR_BGR2RGB)
203
+ height, width, channels = st.session_state.boxed_image.shape
204
+ st.session_state.blank_img = np.zeros((height + 640, width + 640, 3), np.uint8)
205
+ st.session_state.blank_img[0:height, 0:width] = st.session_state.boxed_image
206
+ for i in range(0, height, 600):
207
+ for j in range(0, width, 600):
208
+ cv2.rectangle(st.session_state.blank_img, (j, i), (j + 640, i + 640), (0, 255, 0), 5)
209
+ cv2.putText(st.session_state.blank_img, str(int(i / 600) * 10 + int(j / 600)), (j + 200, i + 320), cv2.FONT_HERSHEY_SIMPLEX, 10, (0, 255, 0), 10)
210
  st.image(st.session_state.boxed_image, use_column_width=True)
211
 
212
  with row5_col3: