How to deal with RGB to YUV conversion

后端 未结 3 1067
萌比男神i
萌比男神i 2020-12-08 16:01

The formula says:

Y = 0.299 * R + 0.587 * G + 0.114 * B;

U = -0.14713 * R - 0.28886 * G + 0.436 * B;

V = 0.615 * R - 0.51499 * G - 0.10001 * B;
         


        
3条回答
  •  暖寄归人
    2020-12-08 16:47

    You can convert RGB<->YUV in OpenCV with cvtColor using the code CV_YCrCb2RGB for YUV->RGB and CV_RGBYCrCb for RGB->YUV.

    void cvCvtColor(const CvArr* src, CvArr* dst, int code)
    

    Converts an image from one color space to another.

提交回复
热议问题