Convert BGR to YCbCr (JPEG)
FwStatus | fwiBGRToYCbCr_JPEG_8u_C3P3R | ( | const Fw8u * pSrcBGR, int srcStep, Fw8u * const pDstYCbCr[3], int dstStep, FwiSize roiSize ); |
dstStep | Destination buffer step size (width of the buffer in bytes). | |
pDstYCbCr[3] | Pointer to destination image ROI for YCbCr image format (three-channel planar). | |
pSrcBGR | Pointer to source image ROI for BGR image format. | |
roiSize | Specifies the height and width of an ROI. | |
srcStep | Source buffer step size (width of the buffer in bytes). |
This function steps through an ROI in a source buffer, converts the source data from the BGR color model to the YCbCr color space, and writes the converted data to a destination buffer.
The following formulas are used to convert blue, green, and red values to luminance and chrominance values.
Y = 0.114*B + 0.587*G + 0.299*R Cb = 0.5*B + 128 - 0.33126*G - 0.16874*R Cr = - 0.08131*B + 128 - 0.41869*G + 0.5*R