Mlx90640 no video stream
I am having issues getting a video stream from a Mlx90640 i2c thermal camera on a raspberry pi running ubuntu 20 and i have a recently compiled version of opencv from github
i have the camera connected and can stream the image to the display using ffmpeg
ffmpeg -f rawvideo -pixel_format y16be -video_size "32x26" -i /dev/video0 -vf scale=800:640 -f fbdev -pix_fmt bgra /dev/fb0
if try to use a device no i get
>>> import cv2
>>> vs = cv2.VideoCapture(0)
[ WARN:0] global /home/ubuntu/opencv/opencv/modules/videoio/src/cap_v4l.cpp (893) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
and if i try to access by device path after a wait it gives no error but is not open
>>> vs = cv2.VideoCapture("/dev/video0")
>>> vs.isOpened()
False
its v4l details are
v4l2-ctl -d /dev/video0 --all
Driver Info:
Driver name : video-i2c
Card type : I2C 1-51 Transport Video
Bus info : I2C:1-51
Driver version : 5.4.55
Capabilities : 0x85200001
Video Capture
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x05200001
Video Capture
Read/Write
Streaming
Extended Pix Format
Priority: 2
Video input : 0 (Camera: ok)
Format Video Capture:
Width/Height : 32/26
Pixel Format : 'Y16 -BE' (16-bit Greyscale BE)
Field : None
Bytes per Line : 64
Size Image : 1664
Colorspace : Raw
Transfer Function : Default (maps to None)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)
Flags :
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 64.000 (64/1)
Read buffers : 1
having had issues with i2c cameras before i did some checking and the V4L2_PIX_FMT_Y16_BE pixel format is not present in cap_v4l.cpp
is this likely to be the cause of this error? if not what can i do to diagnose the problem?
edit:
further testing using v4l2-loopback and ffmpeg to convert from V4L2_PIX_FMT_Y16_BE to V4L2_PIX_FMT_Y16
ffmpeg -f rawvideo -pixel_format y16be -video_size "32x26" -i /dev/video0 -f v4l2 -vcodec rawvideo -pix_fmt y16 /dev/video1
it then works correctly which suggests to be that is not handling something correctly and should be producing "VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV" but isnt
iirc only the gstreamer or ffmpeg backend accepts like "/dev/video0" you could try:
no luck there