我在树莓派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/