convert Flycapture2 Image to float*

364 Views Asked by At

I am trying to save Flycapture2 image as a floating point EXR image. The pixel format that I get from the camera is YUV420 and I need to convert it to RGB in order to save it. What is the best way to do this? Precision is very important for this.

1

There are 1 best solutions below

0
On

You can set your image format by using Flycapture SDK:

FlyCapture2::Format7ImageSettings fmt7ImageSettings;
FlyCapture2::Error error;

    fmt7ImageSettings.pixelFormat = FlyCapture2::PixelFormat::PIXEL_FORMAT_BGR;

    // Validate Format 7 settings  
    bool valid;
    error = cam.ValidateFormat7Settings(&fmt7ImageSettings, &valid, &fmt7PacketInfo);
    unsigned int num_bytes = fmt7PacketInfo.recommendedBytesPerPacket;


    // Set Format 7 (partial image mode) settings  
    error = cam.SetFormat7Configuration(&fmt7ImageSettings, num_bytes);
    if (error != FlyCapture2::ErrorType::PGRERROR_OK)
    {
        error.PrintErrorTrace();
    }