How to Convert YCbCr image data to an image and display the same



  • I am getting a buffer containing Ycbcr format image data from a thermal camera and i have to capture the data and display the same as the image captured by the camera in qt GUI ; how do i convert the data to image and display the same ???


  • Qt Champions 2017

    Convert the pixel color data to RGB and set it to the image's pixel. The required color transformation is on wikipedia (you can google it yourself), and for setting a pixel's color you can use QImage::setPixel or QImage::setPixelColor.



  • Actualy i need to discard all Y values and convert the CB and CR values to RGB data ; do you know any algorithm to convert only cb and cr values to RGB data ;

    only one i was able to find is

    float r = std::max(0.0f, std::min(1.0f, (float)(ycbcr.Y + 0.0000 * ycbcr.Cb + 1.4022 * ycbcr.Cr)));
    float g = std::max(0.0f, std::min(1.0f, (float)(ycbcr.Y - 0.3456 * ycbcr.Cb - 0.7145 * ycbcr.Cr)));
    float b = std::max(0.0f, std::min(1.0f, (float)(ycbcr.Y + 1.7710 * ycbcr.Cb + 0.0000 * ycbcr.Cr)));


  • Lifetime Qt Champion

    Hi,

    Fix the Y value to the default and use the equation as usual.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.