Converting YUV into BGR or RGB in OpenCV

后端 未结 6 572
时光说笑
时光说笑 2020-11-30 04:35

I have a TV capture card that has a feed coming in as a YUV format. I\'ve seen other posts here similar to this question and attempted to try every possible method stated, b

6条回答
  •  有刺的猬
    2020-11-30 04:50

    The BlackMagic Intensity software return YUVY' format in bmdFormat8BitYUV, so 2 sources pixels are compressed into 4bytes - I don't think openCV's cvtColor can handle this.

    You can either do it yourself, or just call the Intensity software ConvertFrame() function

    edit: Y U V is normally stored as
    enter image description here

    There is a Y (brightness) for each pixel but only a U and V (colour) for every alternate pixel in the row.

    So if data is an unsigned char pointing to the start of the memory as shown above.

    pixel 1, Y = data[0] U = data[+1] V = data[+3]
    pixel 2, Y = data[+2] U = data[+1] V = data[+3]

    Then use the YUV->RGB coefficients you used in your sample code.

提交回复
热议问题