Skip to content

Commit 3b99dec

Browse files
committed
Fix OpenCV stream to be rgb instead of bgr.
1 parent 6ea3940 commit 3b99dec

File tree

3 files changed

+6
-142
lines changed

3 files changed

+6
-142
lines changed

object_detection_app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def worker(input_q, output_q):
7676
while True:
7777
fps.update()
7878
frame = input_q.get()
79-
output_q.put(detect_objects(frame, sess, detection_graph))
79+
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
80+
output_q.put(detect_objects(frame_rgb, sess, detection_graph))
8081

8182
fps.stop()
8283
sess.close()
@@ -114,7 +115,8 @@ def worker(input_q, output_q):
114115

115116
t = time.time()
116117

117-
cv2.imshow('Video', output_q.get())
118+
output_rgb = cv2.cvtColor(output_q.get(), cv2.COLOR_RGB2BGR)
119+
cv2.imshow('Video', output_rgb)
118120
fps.update()
119121

120122
print('[INFO] elapsed time: {:.2f}'.format(time.time() - t))

object_detection_multilayer.py

Lines changed: 0 additions & 139 deletions
This file was deleted.

object_detection_multithreading.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ def worker(input_q, output_q):
7474
while True:
7575
fps.update()
7676
frame = input_q.get()
77-
output_q.put(detect_objects(frame, sess, detection_graph))
77+
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
78+
output_q.put(detect_objects(frame_rgb, sess, detection_graph))
7879

7980
fps.stop()
8081
sess.close()

0 commit comments

Comments
 (0)