opencv - 用于OpenCV问题的Video4Linux Y12像素格式

标签 opencv pixelformat video4linux

我在树莓派4上附加了AMG88xx infrared camera
我正在使用linux video-i2c驱动程序
驱动程序似乎正常工作

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

但是,openCV不支持输出像素格式(Y12)
>>> 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

我需要使用其他支持来构建OpenCV吗?或以某种方式转换pixelformat?

最佳答案

您不需要 OpenCV cv2.VideoCapture()即可读取该摄像机。它只是一个相对较慢的I2C设备,您可以直接读取它,也可以像this example.一样使用Adafruit库读取

绝对可以按照上面的方法阅读,然后将其从12位转换为8位或16位的Numpy数组,然后再使用 OpenCV 进行处理,但这不是必需的。

另外,您可以像在this answer的第二部分中一样嵌入对ffmpeg的子过程调用。

关于opencv - 用于OpenCV问题的Video4Linux Y12像素格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60214197/

相关文章:

opencv - OpenCV背景扣除中这两个参数有什么区别

python - 使用 Opencv SIFT 时 matches1to2 出错

ffmpeg - 如何配置 vlc/ffplay/cheese(或其他)以在我的 3 个网络摄像头之间自动循环/旋转?

c++ - OpenCV 神经网络一次训练一次迭代

c# - 检查图像是否着色

c++ - 如何使用模式从内存中复制字节(YUYV 打包到 YUV420 平面)

wpf - 使用硬件在 DeckLink 上将 YUV 转换为 RGB

timestamp - 对于捕获的帧,GStreamer 时间戳 (PTS) 不会单调增加

java - C++ 到 Java - OpenCV