LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving Converted Bayer Image

Can the NI-IMAQ function imgSessionSaveBufferEx be used to save a decoded Bayer image?  When I try inserting this function call in the BayerDecoding.c sample all it saves is the pre-decoded image.

0 Kudos
Message 1 of 14
(3,495 Views)

Hi Matt,

 

Can you post your edited version of the code so we can see the changes that you made?

Ty Prather
Technical Marketing Specialist
National Instruments
0 Kudos
Message 2 of 14
(3,471 Views)

Hi Ty P,

 

The only changes I made were to add "BayerDecode.h" on line 10 and the imgSessionSaveBufferEx function on line 354

0 Kudos
Message 3 of 14
(3,469 Views)

I take that back. The only line I added was 354

0 Kudos
Message 4 of 14
(3,469 Views)

Matt,

 

It definitely seems like the code you added should save the RGB image... Can you tell if the imgPlot2 function on line 358 displays the RGB image or the Bayer image?

Ty Prather
Technical Marketing Specialist
National Instruments
0 Kudos
Message 5 of 14
(3,436 Views)

Ty P,

The imgPlot2 function correctly displays the RGB image.  The last field in the imgPlot2 function call is IMGPLOT_COLOR_RGB32 which tells the imgPlot2 function that the pixel depth is 32 bits.  If the field is set to IMGPLOT_MONO_8 then the imgPlot2 function displays the same image as that saved by the imgSessionSaveBufferEx function.  This says to me that the imgSessionSaveBufferEx function is only saving the first 8 bits of a 32 bit per pixel image and I don't know how to tell the imgSessionSaveBufferEx function that the pixel depth is 32 bits and not 8. 

0 Kudos
Message 6 of 14
(3,428 Views)

Matt,

 

Got it. So it does seem that the image is being decoded, we're just saving it as a monocrome image. Would you say that's correct?

 

Let me look into that and see what I can find (if we're on the same page).

Ty Prather
Technical Marketing Specialist
National Instruments
0 Kudos
Message 7 of 14
(3,424 Views)

Ty P,

Yes that appears to be the case

0 Kudos
Message 8 of 14
(3,396 Views)

Matt,

 

The ..SaveBufferEx function uses the information from the current session to tell which settings to save with. So I believe we need to be looking at the settings associated with that.

http://zone.ni.com/reference/en-XX/help/370161G-01/imaqfr/imgsessionsavebufferex/

 

The first one that caught my eye was on line 47. When we're defining our RGBBuffer, we're defining it as an Int8. Can you try changing this to an Int32 and running it?

Ty Prather
Technical Marketing Specialist
National Instruments
0 Kudos
Message 9 of 14
(3,390 Views)

Ty P,

Yes that was one of the first things that caught my eye too and I changed it to Int32, but the result was the same.  Line 292 creates the buffer size of 4 bytes per pixel and line 294 creates the RGBBuffer with this size.  My thinking is the buffer size for RGBBuffer must be correct or imgPlot2 would not work.

0 Kudos
Message 10 of 14
(3,372 Views)