only keep sync pipeline
This commit is contained in:
+14
-1
@@ -514,7 +514,20 @@ class Sensor:
|
||||
|
||||
def _open_video_source(self, override, box):
|
||||
"""Initialize video capture and calibration."""
|
||||
self.cap = cv2.VideoCapture(self.vid_src)
|
||||
# Use DirectShow backend on Windows for cameras (more stable than MSMF)
|
||||
if isinstance(self.vid_src, int):
|
||||
# For camera indices, try DirectShow first (avoids MSMF errors)
|
||||
try:
|
||||
self.cap = cv2.VideoCapture(self.vid_src, cv2.CAP_DSHOW)
|
||||
except:
|
||||
# Fallback to default backend
|
||||
self.cap = cv2.VideoCapture(self.vid_src)
|
||||
else:
|
||||
# For file paths, use default backend
|
||||
self.cap = cv2.VideoCapture(self.vid_src)
|
||||
|
||||
# Set buffer size to 1 to reduce latency and avoid frame accumulation
|
||||
self.cap.set(cv2.CAP_PROP_BUFFERSIZE, 1)
|
||||
self.cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter.fourcc('M', 'J', 'P', 'G'))
|
||||
self.cap.set(cv2.CAP_PROP_FPS, self._config_fps)
|
||||
self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, self._config_resolution_raw[0])
|
||||
|
||||
Reference in New Issue
Block a user