Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

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

i can get output to hdmi frame buffer using 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

however when i try to use openCV in python i get

>>> 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

output from 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

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

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

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

i can get output to hdmi frame buffer using 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

however when i try to use openCV in python i get

>>> 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

output from 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

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

i think there might be an issue with maping of video4linux y12 pixelformat definition and ffmpeg pixel definitions

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

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

i can get output to hdmi frame buffer using 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

however when i try to use openCV in python i get

>>> 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

output from 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

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

i think there might be an issue with maping of video4linux y12 pixelformat definition and ffmpeg pixel definitions

as far as i can tell video4linux support is compiled in

Video I/O:
DC1394:                      NO
FFMPEG:                      YES
  avcodec:                   YES (58.35.100)
  avformat:                  YES (58.20.100)
  avutil:                    YES (56.22.100)
  swscale:                   YES (5.3.100)
  avresample:                NO
GStreamer:                   NO
v4l/v4l2:                    YES (linux/videodev2.h)

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

edit: i believe i may have identified the source of the problem

looking in link text

both V4L2_PIX_FMT_Y10 and V4L2_PIX_FMT_Y16 are present but V4L2_PIX_FMT_Y12 is missing along with several other places

from the descriptions of the pixel formats

it appears that y12 could be handled similar to y10 both are stored in 16bit words padded with zeroes

i could try adding it but i don't know where else modification would be required


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

i can get output to hdmi frame buffer using 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

however when i try to use openCV in python i get

>>> 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

output from 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

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

i think there might be an issue with maping of video4linux y12 pixelformat definition and ffmpeg pixel definitions

as far as i can tell video4linux support is compiled in

Video I/O:
DC1394:                      NO
FFMPEG:                      YES
  avcodec:                   YES (58.35.100)
  avformat:                  YES (58.20.100)
  avutil:                    YES (56.22.100)
  swscale:                   YES (5.3.100)
  avresample:                NO
GStreamer:                   NO
v4l/v4l2:                    YES (linux/videodev2.h)

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

edit: i believe i may have identified the source of the problem

looking in link text

both V4L2_PIX_FMT_Y10 and V4L2_PIX_FMT_Y16 are present but V4L2_PIX_FMT_Y12 is missing along with several other places

from the descriptions of the pixel formats

it appears that y12 could be handled similar to y10 both are stored in 16bit words padded with zeroes

i could try adding it but i don't know where else modification would be required


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

i can get output to hdmi frame buffer using 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

however when i try to use openCV in python i get

>>> 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

output from 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

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

i think there might be an issue with maping of video4linux y12 pixelformat definition and ffmpeg pixel definitions

as far as i can tell video4linux support is compiled in

Video I/O:
DC1394:                      NO
FFMPEG:                      YES
  avcodec:                   YES (58.35.100)
  avformat:                  YES (58.20.100)
  avutil:                    YES (56.22.100)
  swscale:                   YES (5.3.100)
  avresample:                NO
GStreamer:                   NO
v4l/v4l2:                    YES (linux/videodev2.h)

edit:

i believe i may have identified the source of the problem

looking in link text

both V4L2_PIX_FMT_Y10 and V4L2_PIX_FMT_Y16 are present but V4L2_PIX_FMT_Y12 is missing along with several other places

from the descriptions of the pixel formats

it appears that y12 could be handled similar to y10 both are stored in 16bit words padded with zeroes

i could try adding it but i don't know where else modification would be required

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

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

i can get output to hdmi frame buffer using 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

however when i try to use openCV in python i get

>>> 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

output from 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

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

i think there might be an issue with maping of video4linux y12 pixelformat definition and ffmpeg pixel definitions

as far as i can tell video4linux support is compiled in

Video I/O:
DC1394:                      NO
FFMPEG:                      YES
  avcodec:                   YES (58.35.100)
  avformat:                  YES (58.20.100)
  avutil:                    YES (56.22.100)
  swscale:                   YES (5.3.100)
  avresample:                NO
GStreamer:                   NO
v4l/v4l2:                    YES (linux/videodev2.h)

edit:

i believe i may have identified the source of the problem

looking in link text

both V4L2_PIX_FMT_Y10 and V4L2_PIX_FMT_Y16 are present but V4L2_PIX_FMT_Y12 is missing along with several other places

from the descriptions of the pixel formats

it appears that y12 could be handled similar to y10 both are stored in 16bit words padded with zeroes

i could try adding it but i don't know where else modification would be required

have created an issue on github