2

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.

user3178756
  • 555
  • 1
  • 5
  • 17
  • Have you read the [Wikipedia page](http://en.wikipedia.org/wiki/YUV#Y.27UV420p_.28and_Y.27V12_or_YV12.29_to_RGB888_conversion)? – Khouri Giordano Mar 27 '15 at 19:57
  • Precision is how specific a value is: seconds is more precise than minutes. Accuracy is how correct the value is at the given precision. If you are starting out with 8-bit YUV420, you only have so much precision to start with. On the other hand, how much heat noise is the camera picking up? A single pixel may change a lot more than 1/256 precision from one frame to the next even if the camera's subject and lighting are completely static. – Khouri Giordano Mar 27 '15 at 20:01
  • I've read on that, but the problem is I don't understand the bits orders of image that is captured with FlyCapture2 to convert it. it even has a way to set the pixel format to RGB but the code that I wrote for reading it and converting it to float* seems that I have not understood it well. I cannot find a very good documentation on the SDK either. – user3178756 Mar 29 '15 at 02:36
  • If you upload the data somewhere, I could have a look at it. – Khouri Giordano Apr 01 '15 at 18:22
  • ok I found that I can convert it to RGB and then save it with SDK as tiff. I just want to make sure the image is saved linearly. – user3178756 Apr 02 '15 at 18:26

1 Answers1

0

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();
    }
michael scolfield
  • 411
  • 1
  • 5
  • 20