Skip to content

Missing V4L2_PIX_FMT_Y16be support and pixel format mis identification #18495

@firebladed

Description

@firebladed
System information (version)
  • OpenCV => '4.5.0-pre'
  • Operating System / Platform => Ubuntu 20.04
  • locally compiled
  • RaspberryPi 4b
Detailed description

I am trying to get an mlx80640 infra red camera working see question which only outputs V4L2_PIX_FMT_Y16_BE

i can workaround using ffmpeg to convert from V4L2_PIX_FMT_Y16_BE to V4L2_PIX_FMT_Y16 (big endian to little endian)

to me there seems to be two problems here

  • The missing V4L2_PIX_FMT_Y16_BE format i can probably patch cap_v4l.cpp to add the format just need to determine the most efficient way to convert from big to little endian and then handle the same as V4L2_PIX_FMT_Y16

  • Something appears to be incorrectly handling the format and so not producing an "VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV" error, but im not sure what the implications of this are as i am unsure which format it is selecting

Steps to reproduce

attach mlx90640 to i2c bus
compile and install video-i2c kernel module
add device-tree overlay
reboot

using python

>>> 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
>>> vs.isOpened()
False

using device path

>>> import  cv2
>>> vs = cv2.VideoCapture("/dev/video0")
>>> vs.isOpened()
False

if i then setup a v4l2-loopback to convert from V4L2_PIX_FMT_Y16_BE to V4L2_PIX_FMT_Y16 (big endian to little endian)

 ffmpeg -f rawvideo -pixel_format y16be -video_size "32x26" -i /dev/video0 -f v4l2 -vcodec rawvideo -pix_fmt y16 /dev/video1

It works

>>> import  cv2
>>> vs = cv2.VideoCapture(1)
>>> vs.isOpened()
True

using device path

>>> import  cv2
>>> vs = cv2.VideoCapture("/dev/video1")
>>> vs.isOpened()
True
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    answers.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions