LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a 16-bit grayscale image from matrix of values

Solved!
Go to solution

Hello all,

 

I'm having a problem converting a series of measurements into a specific image. I have a matrix of nxm dimensions (n and m variable), which contains measurement data. My intention is to transform this matrix into an image to be analyzed later on by an external software. The trick, however, is that the image has to be in 16-bit grayscale format: in grayscale for doing the image processing, and 16 bits to make sure that resolution is not hindered.

 

I've been looking around the web and still haven't found a way of somehow mapping the measurement values I have in that matrix into pixels (16-bit grayscale ones, that is). I have access to the Full Development System version of LabView, but not other toolboxes.

 

Does anyone have any suggestions?

0 Kudos
Message 1 of 6
(5,616 Views)

Hi HugoKrajnc,

 

What file type are you trying to save this 16-bit grayscale image?  You can use the Write JPEG File VI (or other image type VIs) to save the array with image type information.  If you would like to create an image in LabVIEW with the specific information that you stated in your post, you can do it using the Vison Development Module or Vision Acquisition Software.  Within these LabVIEW modules there are built in VIs to create and image and give it the specific information you are looking for.  Please post back and let us know if you have any other questions or questions about the Write JPEG File VIs.  Thanks!

 

Regards,

Kira T

0 Kudos
Message 2 of 6
(5,583 Views)

Hi Kira T,

 

I'm currently using the Flatten Pixmap.vi together with the Write JPEG File.vi to convert a matrix of values into an 8-bit grayscale image. For the moment I'm not having any problems with that. However, I would like to extend the resolution and (using a similar scheme) convert the matrix into a 16-bit grayscale image. The Flatten Pixmap.vi simply does not have the option for 16 bit input so I'm looking for some way of replacing that on my own.

 

Regarding the modules you mentioned, I'm pretty much stuck with the Full Developer version, with no access to additional modules/packages/toolboxes. So I would need to work with the basic VIs.

 

Thanks!

 

Hugo

0 Kudos
Message 3 of 6
(5,578 Views)

Hi HugoKranjnc,

 

Unfortunately LabVIEW does not currently have any built in functions to support any monochrom image types that are larger than 8 bits.  One thing that you can try is to Open the Flatten Pixmap.vi and try to mimic what is done in there for the 8 bit image for 16 bits.  But, with that said, you will have trouble using the Write JPEG File.vi and the 16bit monochrome image.  Does your image need to be 16 bit monochrome or could you convert it to 24 bit color to save it with higher resolution?

 

Regards, 

Kira T

0 Kudos
Message 4 of 6
(5,566 Views)

Hi Kira T,

 

I'm sorry to hear that. Are there any built-in functions in some other toolboxes perhaps?

 

The main issue with converting to RGB is that it is not useful for the image processing I need to carry out afterwards. The image file must be in grayscale unfortunately.

0 Kudos
Message 5 of 6
(5,559 Views)
Solution
Accepted by topic author HugoKrajnc

Hi everyone,

 

I've managed to get it to work thanks to some help from people on other forums. The key is to use the IMAQ driver, which gives the VIs necessary to create images on 16-bit grayscale (only supported nicely by PNG format apparently).

 

The discussion on the other forum can be found here: http://stackoverflow.com/questions/11101420/structure-of-16-bit-grayscale-image-to-be-generated-in-c...

The IMAQ driver can be found here: http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/sn/catnav%3adu,n13%3ahardwareDr...

0 Kudos
Message 6 of 6
(5,543 Views)