Skip to content

Commit

Permalink
Add disable cv2 window
Browse files Browse the repository at this point in the history
  • Loading branch information
bessszilard committed Jul 29, 2020
1 parent 9ab55b3 commit 8f7f810
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions detectvideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
flags.DEFINE_float('score', 0.25, 'score threshold')
flags.DEFINE_string('output', None, 'path to output video')
flags.DEFINE_string('output_format', 'XVID', 'codec used in VideoWriter when saving video to file')
flags.DEFINE_boolean('dis_cv2_window', False, 'disable cv2 window during the process') # this is good for the .ipynb

def main(_argv):
config = ConfigProto()
Expand Down Expand Up @@ -102,10 +103,12 @@ def main(_argv):
result = np.asarray(image)
info = "time: %.2f ms" %(1000*exec_time)
print(info)
# cv2.namedWindow("result", cv2.WINDOW_AUTOSIZE)
# result = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
# cv2.imshow("result", result)
# if cv2.waitKey(1) & 0xFF == ord('q'): break

if not FLAGS.dis_cv2_window:
cv2.namedWindow("result", cv2.WINDOW_AUTOSIZE)
result = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
cv2.imshow("result", result)
if cv2.waitKey(1) & 0xFF == ord('q'): break

if FLAGS.output:
result = cv2.cvtColor(result, cv2.COLOR_RGB2BGR)
Expand Down

0 comments on commit 8f7f810

Please sign in to comment.