generalize webcam detection with opt.source.isnumeric() (yolov3 #1462)
This commit is contained in:
1 parent
09402a2174
commit
82ed33a052
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -235,7 +235,7 @@ class LoadStreams: # multiple IP or RTSP cameras
|
||||
for i, s in enumerate(sources):
|
||||
# Start the thread to read frames from the video stream
|
||||
print('%g/%g: %s... ' % (i + 1, n, s), end='')
|
||||
cap = cv2.VideoCapture(0 if s == '0' else s)
|
||||
cap = cv2.VideoCapture(eval(s) if s.isnumeric() else s)
|
||||
assert cap.isOpened(), 'Failed to open %s' % s
|
||||
w = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
|
||||
h = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
||||
|
||||
Reference in new issue
Block a user