Merge pull request #1902 from 1ceseismic/fix/linux-camera-device-path-rebase

fix: no cam detected on Arch Linux, use string path for camera capture instead
This commit is contained in:
Dopan
2026-08-13 22:50:16 +08:00
committed by GitHub
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -417,7 +417,7 @@ def get_available_cameras() -> Tuple[List[int], List[str]]:
indices: List[int] = []
names: List[str] = []
for i in range(10):
cap = cv2.VideoCapture(i)
cap = cv2.VideoCapture(f"/dev/video{i}")
if cap.isOpened():
indices.append(i)
names.append(f"Camera {i}")
+2 -1
View File
@@ -71,8 +71,9 @@ class VideoCapturer:
self.cap.release()
except Exception:
continue
elif platform.system() == "Linux":
self.cap = cv2.VideoCapture(f"/dev/video{self.device_index}")
else:
# Unix-like systems (Linux/Mac) capture method
self.cap = cv2.VideoCapture(self.device_index)
if not self.cap or not self.cap.isOpened():