11-07-2016 01:04 PM - last edited on 11-11-2016 11:22 AM by LiliMcDonald
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.
11-08-2016 11:13 AM
Hi Matt,
Can you post your edited version of the code so we can see the changes that you made?
11-08-2016 01:13 PM
Hi Ty P,
The only changes I made were to add "BayerDecode.h" on line 10 and the imgSessionSaveBufferEx function on line 354
11-08-2016 01:14 PM
I take that back. The only line I added was 354
11-10-2016 04:24 PM
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?
11-10-2016 04:54 PM
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.
11-10-2016 05:14 PM
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).
11-11-2016 07:03 AM
Ty P,
Yes that appears to be the case
11-11-2016 09:20 AM
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?
11-11-2016 04:43 PM
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.