I'm setting up NXP's Surround View System demo with i.MX8QM MEK.
Software is Linux L4.14.98_2.0.0, but replace OpenCV version to OpenCV 3.4.
I'm facing an issue of input / output data format.
I checked OV10635 datasheet, the default Camera output format is 8-bit YUYV.
However, App Demo code use 32bits RGBA as V4L2 input.
It makes me confuse, the camera output format should be the same with V4L2 input format?
I also done some check:
1. I used "v4l2-ctl -d /dev/video0 --list-formats-ext | grep Format" command to get the available pixel format form camera and got the following list, I also used these formats to be the V4L2 input pixel format and got the result:
1) RGBP: See attachment "RGBP.jpg"
2) RGB3: See attachment "RGB3.jpg"
3) BGR3: Segmentation fault
4) YUYV: Segmentation fault
5) YUV4: See attachment "YUV4.jpg"
6) NV12: Segmentation fault
7) YM24: Segmentation fault
8) XR24: See attachment "XR24.jpg"
9) AR24: See attachment "AR24.jpg"
Seems only using 32-bits format as V4L2 input format can get the whole frame, but the color format is not correct.
2. I used the "takeFrame" function in demo code to get the single frame and use OpenCV "imwrite" to save picture. I found the demo code use OpenCV "cvtColor" to do a RGBA-to-RGB transform. But as I told, I think the camera output is 8-bits YUYV format. If there is a YUYV format save in a 8UC4 OpenCV Mat, RGBA-to-RGB transform should cut the V channel, so the saved image's color is not correct.
3. Base on the input format is YUVY theory, I tried to use OpenCV to do a YUYV-to-RGB transform. However, OpenCV YUYV-to-RGB transform only accept 8UC2 format as input (It means only 16-bits format accepted). But for the 1. test, the input should be 32-bits format.
My question is:
1. What is the correct V4L2 input format for the Surround View System demo?
2. If the input format is 8-bits YUYV, how can I done the YUYV-to-RGB transform by OpenCV?
3. If I want to use ISI to do the YUYV-to-RGB transform, is there any simple way to do this?
4. Anything wrong for my understanding?