opencv: 4.6.0 can't access PureThermal USB camera
System Information
OpenCV python version: 4.2.0 && 4.6.0 Operating System: Ubuntu Server 20.04 Platform: Raspberry Pi 4b Firmware: Nov 18 2021 16:17:39 version: d9b293558b4cef6aabedcc53c178e7604de90788 (clean) (release) (start_x) Python version: 3.8.10
Detailed description
Hello, I am working on my capstone project and have hit a wall. I am trying to access frames from a usb camera, more specifically an FLIR lepton 3.5 infrared using a PureThermal carrier board but always get stuck in an infinite loop (code doesn’t exit) or get the following error:
[ WARN:0] global ../modules/videoio/src/cap_v4l.cpp (998) tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
The camera is the only USB device connected, here is the lsusb output:
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 1e4e:0100 Cubeternet WebCam
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
I verified the product and vendor id through dmseg
(dmesg log available here: dmesg.txt) command and tried to give the device permissions by running the command sudo chmod 666 /dev/bus/usb/001/003
however, that also did not seem to help. I also chmod the python file but that also did not work. I will add that I have a generic raspberry pi camera module that does run through the csi port. Note that the lepton is recognized on a model 4b running raspbian os buster no issues.
Here is the v4l2-ctl --list-devices
output:
bcm2835-codec-decode (platform:bcm2835-codec):
/dev/video10
/dev/video11
/dev/video12
/dev/media2
bcm2835-isp (platform:bcm2835-isp):
/dev/video13
/dev/video14
/dev/video15
/dev/video16
/dev/media1
PureThermal (fw:v1.3.0): PureTh (usb-0000:01:00.0-1.1):
/dev/video0
/dev/video1
/dev/media0
I verified the /dev/video*
are all under the video group here:
crw-rw----+ 1 root video 81, 1 Aug 31 15:27 /dev/video0
crw-rw----+ 1 root video 81, 2 Aug 31 15:27 /dev/video1
crw-rw----+ 1 root video 81, 6 Aug 31 15:27 /dev/video10
crw-rw----+ 1 root video 81, 7 Aug 31 15:27 /dev/video11
crw-rw----+ 1 root video 81, 8 Aug 31 15:27 /dev/video12
crw-rw----+ 1 root video 81, 0 Aug 31 15:27 /dev/video13
crw-rw----+ 1 root video 81, 3 Aug 31 15:27 /dev/video14
crw-rw----+ 1 root video 81, 4 Aug 31 15:27 /dev/video15
crw-rw----+ 1 root video 81, 5 Aug 31 15:27 /dev/video16
Steps to reproduce
Here is the code I am running, pretty simple. Inside the index, I have tried every available index plus different cv2.CAP...
backends, V4L2, GSTREAMER, DSHOW and I’ve also left it blank.
#every 5s until keyboard interrup, pi will take a picture
def cam_ind_test(cam_path , count: int, fname: str):
cap = cv2.VideoCapture(cam_path)
i = 0
while(cap.isOpened()):
ret, frame = cap.read()
# This condition prevents from infinite looping
# incase video ends.
if (ret == False) or (i > count):
print('ret is False')
break
# Save Frame by Frame into disk using imwrite method
cv2.imwrite(fname+str(i)+'.jpg', frame)
i += 1
cv2.waitKey(1)
cap.release()
cv2.waitKey(1)
cam_ind_test(0,5, 'vl')
I’ve tracked the following but to no avail, #https://github.com/opencv/opencv/issues/19527
Issue submission checklist
- I report the issue, it’s not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 35 (19 by maintainers)
I have to read into the V4L2 api to interprete what is going on. I’ll get back to you
@alalek: I still think this is a bug but cannot reproduce without the hardware.