LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving Converted Bayer Image

Matt,

 

It looks like this may have come up before, and the issue is that the session ID is defined for the Bayer image, so since the SaveBufferEx function is basing it off of that session ID, then we're only getting the 8 bith depth. Here's the recommended workaround

 

Use IMAQ Vision functions (imaqWriteFile function as well as imaqCreateImage and imaqArrayToImage) like this:

0) Add the following code in the beginning.
//////////////////////
#include "nivision.h" 
//////////////////////

1) Add the following code before the While state statement that includes imgBayerColorDecode

//////////////////////
Image* RGBImage;
RGBImage = imaqCreateImage(IMAQ_IMAGE_RGB, 0);
//////////////////////

2) Add the following code  after imgBayerColorDecode 

//////////////////////
imaqArrayToImage (RGBImage, RGBBuffer, AcqWinWidth, AcqWinHeight);
imaqWriteFile(RGBImage, "C:\\RGBImage.jpg", NULL);
//////////////////////

3) Add the following code after the While statement that includes imgBayerColorDecode (before return 0;)

//////////////////////
imaqDispose (RGBImage);
//////////////////////
Ty Prather
Technical Marketing Specialist
National Instruments
0 Kudos
Message 11 of 14
(730 Views)

Ty P,

I don't have nivision.h on my computer.  Is it part of the IMAQ Vision Library that I don't have either?

 

R,

Matt

0 Kudos
Message 12 of 14
(720 Views)

Matt,

 

If you have the vision acquisition software installed on your computer, then the nivision.h should be located at:

C:\Program Files (x86)\National Instruments\Vision\Include

 

If you don't, go ahead and download + install it from:

http://www.ni.com/download/ni-vision-acquisition-software-february-2016/5801/en/

 

Ty Prather
Technical Marketing Specialist
National Instruments
0 Kudos
Message 13 of 14
(701 Views)

Ty P,

Ok I found the file and the work around you supplied works great!  Thanks for all your help!

 

R,

Matt

0 Kudos
Message 14 of 14
(693 Views)