Skip to content

Commit d60da00

Browse files
Convert frame to RGB before processing
1 parent af20035 commit d60da00

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Object_detection_video.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
# Acquire frame and expand frame dimensions to have shape: [1, None, None, 3]
9696
# i.e. a single-column array, where each item in the column has the pixel RGB value
9797
ret, frame = video.read()
98-
frame_expanded = np.expand_dims(frame, axis=0)
98+
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
99+
frame_expanded = np.expand_dims(frame_rgb, axis=0)
99100

100101
# Perform the actual detection by running the model with the image as input
101102
(boxes, scores, classes, num) = sess.run(

0 commit comments

Comments
 (0)