File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -150,7 +150,10 @@ def get_camera_index_by_name(name):
150
150
# On Linux, we use device paths like '/dev/video0' and match directly
151
151
# OpenCV expects the actual /dev/video#, not the offset into the device list
152
152
if os_type == "Linux" :
153
- return int (str .replace (name ,"/dev/video" ,"" ));
153
+ if (name .startswith ("/dev/ttyACM" )):
154
+ return int (str .replace (name ,"/dev/ttyACM" ,"" ));
155
+ else :
156
+ return int (str .replace (name ,"/dev/video" ,"" ));
154
157
155
158
# On Windows, match by camera name
156
159
elif os_type == 'Windows' :
Original file line number Diff line number Diff line change @@ -271,7 +271,7 @@ def _find_frame_size(self: 'FTCamera') -> None:
271
271
for x in self ._device .info .frame_sizes :
272
272
FTCamera ._logger .info ("- {}" .format (x ))
273
273
self ._frame_size = next (x for x in self ._device .info .frame_sizes
274
- if x .pixel_format == v4l2 .PixelFormat .YUYV
274
+ if x .pixel_format == v4l .PixelFormat .YUYV
275
275
and x .min_fps >= 30 )
276
276
elif os_type == 'Windows' :
277
277
fsize = next (x for x in self ._filter_video .get_formats ()
@@ -362,7 +362,7 @@ def device_index(self: 'FTCamera') -> int:
362
362
363
363
if os_type == 'Linux' :
364
364
@property
365
- def device (self : 'FTCamera' ) -> v4l2 . VideoDevice :
365
+ def device (self : 'FTCamera' ) -> v4l . Device :
366
366
"""Video4Linux device if open or None if closed."""
367
367
return self ._device
368
368
elif os_type == 'Windows' :
@@ -470,7 +470,7 @@ def _process_frame(self: 'FTCamera', frame) -> None:
470
470
471
471
try :
472
472
match frame .pixel_format :
473
- case v4l2 .PixelFormat .YUYV :
473
+ case v4l .PixelFormat .YUYV :
474
474
self ._decode_yuv422 (frame .data )
475
475
case _:
476
476
FTCamera ._logger .error (
You can’t perform that action at this time.
0 commit comments