0

I have a AMG88xx infrared camera attached to a raspberry PI 4 i am using the linux video-i2c driver the driver appears to work correctly

v4l2-ctl -d /dev/video0 --all
    Driver Info:
        Driver name      : video-i2c
        Card type        : I2C 1-104 Transport Video
        Bus info         : I2C:1-104
        Driver version   : 4.19.102
        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      : 8/8
        Pixel Format      : 'Y12 ' (12-bit Greyscale)
        Field             : None
        Bytes per Line    : 16
        Size Image        : 128
        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: 10.000 (10/1)
        Read buffers     : 1

However the output pixel format (Y12) appears to be unsupported by openCV

>>> import cv2
>>> capture = cv2.VideoCapture(0)
VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
VIDEOIO ERROR: V4L: can't open camera by index 0

Do I need to build OpenCV with additional support? or somehow convert the pixelformat?

fireblade
  • 39
  • 7
  • Could you run your camera using any app like *cheese*? If yes what do u see on the screen? – Yunus Temurlenk Feb 13 '20 at 18:39
  • im not running with a desktop however i can get output from the camera to the hdmi output framebuffer via ffmpeg `ffmpeg -f rawvideo -pixel_format gray12 -video_size "8x8" -i /dev/video0 -vf histeq,scale=200:200 -f fbdev -pix_fmt bgra /dev/fb0` – fireblade Feb 15 '20 at 21:24

2 Answers2

1

You don't need OpenCV and cv2.VideoCapture() to read that camera. It is just a relatively slow I2C device that you can read directly or using the Adafruit library as in this example.

By all means, you could read it as above and then convert from 12-bit to an 8-bit or 16-bit Numpy array and then process with OpenCV afterwards, but it is not necessary.

Alternatively, you could embed a subprocess call to ffmpeg like I did in the second part of this answer.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
0

Issue was related to missing pixel format in OpenCV (see Issue #16620) fixed by #16626

found by compareing video4linux pixelformats with those supported by openCV in modules/videoio/src/cap_v4l.cpp

fireblade
  • 39
  • 7