Skip to main content

Can not save BayerRG8 images in colors.

Answered

Comments

5 comments

  • Official comment
    Claude Sylvain

    Hello Ifeanyi,

    Thank you for your information concerning saving color image from SpinView preview window.
    We can save color images using Spinview, now :-)


    Thank you for your advice concerning saving color image using the Spinnaker SDK API.
    Looking at "Acquisition" example, we found that our problem was due to using wrong image pointer when saving the image.

    Before correction (wrong code):
                          +++
       processor.Convert(ImagePtrTmp, Spinnaker::PixelFormat_RGB8);
       ImagePtrTmp->Save(filename.str().c_str(), option);
                          +++

    After correction (good code):
                          +++
       Spinnaker::ImagePtr convertedImage = processor.Convert(ImagePtrTmp, Spinnaker::PixelFormat_BGR8);
       convertedImage->Save(filename.str().c_str(), option);
                          +++


    Regards,

    Claude

  • TDY_Ifeanyi
    Community team
    Great answers
    Expert (Gold)

    Hello Claude,

    It is not clear the content of image data, "img_data1" and how it was loaded. There are some questions to help understand and resolve this issue:

    • To separate "img_data1" from rest of the code, does it work fine if you capture image directly from camera (with BayerRG8 pixel format) using the same code? 
    • How did you determine output is not 3-channel colour image?
    • Is result the same using different image format such as jpg or png?

    Thanks,

    Regards,

    Ifeanyi.

    0
  • Claude Sylvain

    Hello Ifeanyi,


    >
    > It is not clear the content of image data, "img_data1" and how it was loaded. There are some questions to help understand and resolve this issue:
    >

    "img_data1" is a circular buffer containing many images acquired by the BFS-PGE-04S2C camera module.

    It is defined as:

                          +++
        /* Images Data secondary circular buffer pointer.
         * */
        uint8_t    **img_data1    = NULL;
                          +++

    This buffer is filled using:
        Spinnaker::ImagePtr pImage->GetData();


    >
    > - To separate "img_data1" from rest of the code, does it work fine if you capture image directly from camera (with BayerRG8 pixel format) using the same code? 
    >

    I think there is no need to make the test you mentioned, since this code come from a program that we use (with success) since many years on another device based on BFS-U3-16S2M-CS camera module. 


    >
    > - How did you determine output is not 3-channel colour image?
    >

    We display saved image using:
        - Windows 10 Explorer preview (Extra large icons)
        - "IrfanView"
        - GIMP

    Remarks: When looking at saved (monochrome) images, we can see the pattern of Bayer encoding.  It looks like a checkerboard.

    See attached images:
        - First image (printscreen_spinview_2024-02-28_1141.jpg)
          Print Screen  showing what is seen in "Spinnaker" Preview.

        - Second image (spinview_saved_img_2024-02-28_1138.jpg)
          Image saved using "SpinView" "Save current image to disk" button.

     

    >
    > - Is result the same using different image format such as jpg or png?
    >

    Yes.  We have done the test the following way:

        1) Configure the BFS-PGE-04S2C camera module using our program.

        2) Then, use "SpinView" (without modifying configuration done at
          step 1) to save/view images, using all format available in
          "SpinView".


    Regards,

    Claude

     

     

    0
  • TDY_Ifeanyi
    Community team
    Great answers
    Expert (Gold)

    Hello Claude,

    To save image as rendered would require to ensure that "Save Displayed Image" is selected from SpinView drawing window (i.e right-click in drawing window --> Save Image Options --> Save Displayed Image): 

    For code implementation, do you observe the same issue if you run our Acquisition.cpp example code? I would edit the code at line 368 to use color pixel format, PixelFormat_RGB8. 

    If this example code works fine, I would compare it with custom code implementation. Otherwise, please open support ticket by using our contact form at https://flir.custhelp.com/app/ask, and we could have a remote session to work through this together.

    Regards,

    Ifeanyi

    0
  • TDY_Ifeanyi
    Community team
    Great answers
    Expert (Gold)

    Hi Claude,

    Thanks for the update, and glad to know that this is resolved.

    Regards,

    Ifeanyi

    0

Please sign in to leave a comment.

Powered by Zendesk