Closed ivanstepanovftw closed 2 months ago
No, no, no, everything is fine when I use /dev/video0
. My bad.
from io import BytesIO
from linuxpy.video.device import Device
import matplotlib.pyplot as plt
from PIL import Image
if __name__ == '__main__':
with Device.from_id(0) as cam:
print(f"{cam=}")
for i, frame in enumerate(cam):
print(f"frame #{i}: {len(frame)} bytes")
image = Image.open(BytesIO(bytes(frame)))
plt.imshow(image)
plt.show()
if i > 9:
break
Strange since I am using /dev/video1 in my C++ code...
BTW I have 5 /dev/video* devices, not sure why.
I will let you to close this issue if everything is OK. Thank you for this beautiful library. Love it.
BTW I have 5 /dev/video* devices, not sure why.
try using iter_video_capture_devices function present in llinuxpy.video.device and check the results. this saves you from using 'from_id'
Can I close the issue?
Many thanks for this beautiful library, will recommend to everyone
Strange, when my camera is occupied, it still shows that camera is closed.
from linuxpy.video.device import Device, iter_video_capture_devices
devices = list(iter_video_capture_devices())
print(f"{devices=}")
devices=[<Device name=/dev/video2, closed=True>, <Device name=/dev/video0, closed=True>]
/p/i/gaze/capture.py
Outputs
Note I have
/dev/video0
for infrared and/dev/video1
for RGB. Maybe I am doing something wrong?