Skip to content

Free Motion Capture for Everyone πŸ’€βœ¨

TypeScript

make sure cams can return an image before counting them as viable

jon matthis56852b28fa17
diff --git a/freemocap/webcam/checkcams.py b/freemocap/webcam/checkcams.py
index 7a29d8f0..86653a3a 100644
--- a/freemocap/webcam/checkcams.py
+++ b/freemocap/webcam/checkcams.py
@@ -16,13 +16,17 @@ def TestDevice(source):
# print('Warning: unable to open video source: ', source)
if cap.isOpened():
- # print('Opened: ',source)
- # print('Exposure: '+ str(cap.get(cv2.CAP_PROP_EXPOSURE)))
- # time.sleep(3)
- cap.release()
- cv2.destroyAllWindows()
- open_cam = source
- return open_cam
+ success, image = cap.read()
+ if success:
+ # print('Opened: ',source)
+ # print('Exposure: '+ str(cap.get(cv2.CAP_PROP_EXPOSURE)))
+ # time.sleep(3)
+ cap.release()
+ cv2.destroyAllWindows()
+ open_cam = source
+ return open_cam
+ else:
+ return None
else:
return None
diff --git a/freemocap/webcam/startcamrecording.py b/freemocap/webcam/startcamrecording.py
index 5d55866d..aeb6eb92 100644
--- a/freemocap/webcam/startcamrecording.py
+++ b/freemocap/webcam/startcamrecording.py
@@ -98,8 +98,8 @@ def CamRecording(
success, frame = cam.read()
cv2.imshow(camWindowName, frame)
- # frame_sized = cv2.resize(frame, (resWidth, resHeight))
- # frame_sized = frame
+ frame_sized = cv2.resize(frame, (resWidth, resHeight))
+ frame_sized = frame
out.write(frame)
timeStamps.append(time.time() - beginTime) # add each timestamp to the list