Hello, I am currently using the i.mx6 quard.
I'm using V4l2 to get image from camera, but I have one problem.
The input image format is YUV 422 format with a size of 1280x720.
I want to convert this image to BGR format, so I converted it to BGR24 using IPU, but the colors are output differently as shown below.
struct v4l2_format fmt;
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_BGR24;
fmt.fmt.pix.width = 1280;
fmt.fmt.pix.height = 720;
However, if the image is received by YUV 422 format and the BGR is converted directly in the application, it is converted well.
struct v4l2_format fmt;
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
fmt.fmt.pix.width = 1280;
fmt.fmt.pix.height = 720;
What should i do?
Please help me!!!
Isn't the IPU CSC code for display?
I don't use the display processor (driver /dev/fb0).
I use only v4l2 capture to get the image buffer and check the RGB values in the image.
Do I need to modify the ipu_ic.c code below?
/* R = (1.164 * (Y - 16)) + (1.596 * (Cr - 128));
G = (1.164 * (Y - 16)) - (0.392 * (Cb - 128)) - (0.813 * (Cr - 128));
B = (1.164 * (Y - 16)) + (2.017 * (Cb - 128); */
static const uint32_t ycbcr2rgb_coeff[4][3] = {
{149, 0, 204},
{149, 462, 408},
{149, 255, 0},
{8192 - 446, 266, 8192 - 554}, /* A0, A1, A2 */
};
yes you need to use csc to do the image conversion