Skip to content

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

TypeScript

add switch to use CAP_DSHOW on windwos and CAP_ANY otherwise

jon matthis9b6a00de6cea
diff --git a/freemocap/user_preferences.yaml b/freemocap/user_preferences.yaml
index 2b865cde..f38cfbf9 100644
--- a/freemocap/user_preferences.yaml
+++ b/freemocap/user_preferences.yaml
@@ -9,10 +9,10 @@ default:
framerate: 30
codec: DIVX
saved:
- path_to_save: C:/
+ path_to_save: C:/Users/jonma/Dropbox/FreeMoCapProject
rotations:
0: 0
- 1: 0
+ 2: 0
parameters:
exposure: -7
resWidth: 640
diff --git a/freemocap/webcam/startcamrecording.py b/freemocap/webcam/startcamrecording.py
index a60a6fd5..6d4060db 100644
--- a/freemocap/webcam/startcamrecording.py
+++ b/freemocap/webcam/startcamrecording.py
@@ -2,7 +2,7 @@ import threading
import cv2
import time
import pickle
-
+import os
class CamRecordingThread(threading.Thread):
def __init__(
@@ -50,7 +50,13 @@ def CamRecording(
flag = False
cv2.namedWindow(camID) # name the preview window for the camera its showing
- cam = cv2.VideoCapture(camInput, cv2.CAP_DSHOW) # create the video capture object
+
+ if os.name == 'nt': #use CAP_DSHOW for windows, CAP_ANY otherwise (*might* make things ubuntu/mac compatible, but not sure. See https://github.com/jonmatthis/freemocap/issues/52)
+ cap = cv2.VideoCapture(self.camID, cv2.CAP_DSHOW)
+ else:
+ cap = cv2.VideoCapture(self.camID, cv2.CAP_ANY)
+
+
# if not cam.isOpened():
# raise RuntimeError('No camera found at input '+ str(camID))
# pulling out all the dictionary paramters