Skip to content

Commit 8015b9e

Browse files
fix JPG and move waitKey
1 parent 2792abf commit 8015b9e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

TFLite_detection_image.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
# Define path to images and grab all image filenames
9696
if IM_DIR:
9797
PATH_TO_IMAGES = os.path.join(CWD_PATH,IM_DIR)
98-
images = glob.glob(PATH_TO_IMAGES + '/*.jpg') + glob.glob(PATH_TO_IMAGES + '/*.JPG') + glob.glob(PATH_TO_IMAGES + '/*.png') + glob.glob(PATH_TO_IMAGES + '/*.bmp')
98+
images = glob.glob(PATH_TO_IMAGES + '/*.jpg') + glob.glob(PATH_TO_IMAGES + '/*.png') + glob.glob(PATH_TO_IMAGES + '/*.bmp')
9999
if save_results:
100100
RESULTS_DIR = IM_DIR + '_results'
101101

@@ -209,6 +209,10 @@
209209
# All the results have been drawn on the image, now display the image
210210
if show_results:
211211
cv2.imshow('Object detector', image)
212+
213+
# Press any key to continue to next image, or press 'q' to quit
214+
if cv2.waitKey(0) == ord('q'):
215+
break
212216

213217
# Save the labeled image to results folder if desired
214218
if save_results:
@@ -230,9 +234,5 @@
230234
for detection in detections:
231235
f.write('%s %.4f %d %d %d %d\n' % (detection[0], detection[1], detection[2], detection[3], detection[4], detection[5]))
232236

233-
# Press any key to continue to next image, or press 'q' to quit
234-
if cv2.waitKey(0) == ord('q'):
235-
break
236-
237237
# Clean up
238238
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)