From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

saving grayscale(sgl) floating point 32bit image

 

 

hello all

We have a camera that we are using to acquire 32 bit grayscale (sgl) images. (attached image of MAX)

We need to save these images.

We are having trouble converting the image to anything that can be saved.

 

I found a previous solution were someone mentioned using imaq file write (an older version of image file write 2) of type 'apd' but i do not have this library available.  Its not ideal.

 

We do not need the floating point precision and can ideally save it as a any image type. 

In one attempt which is attached, Im trying to convert it to 8 bit space.

First, I divide by 2^32 /  2^8 or 16million.

I then round all the values to get rid of floating point and then covert it to 8 bit.

I then use the convert array to image function again (which uses the image handle)

Since the handle is still is 32bit which is the wrong data type (floating point 32 bit) so it wont save and gives the same error

Ive attached a copy of this vi code.

 

Any help is appreciated, we have way to much time on this, weeks.

thanks

Jim

 

 

Download All
0 Kudos
Message 1 of 4
(4,337 Views)

Hi Biosolutions,

 

I'm having a lot of trouble understanding your code - could you possibly repost it with comments, so I can understand it better?  

 

I notice you try changing it to a .bmp file.  What happens when you do this?  Also, you say you get an error - could you post a picture of the error?  Or the error code?  That would be helpful as well.

Julian R.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(4,287 Views)

 

we really need an answer on this as we have been stuck for weeks.

 

Ill reduce the image to only the relevant part you need.

you can look up others needed detail from the orignal post

 

the image type we are are using to import from the camera is grayscale(sgl) which is 32bit floating point.

we can display this in labivew, but cannot write this to disk, obviously as there are floating precision numbers.

there are no options that allow me to do this.

 

I have tried to create a formula (which works in matlab) to convert a 32bit floating point image to 8bit image

this is done by scaling the image to 8 bit range and then rounding the numbers.

however... when i implement it in labview, it gives an error.

this error is because when i need to reconvert the array back to an image, it needs the image handle and when i specify the orignal image, it wont accept it (i drew this connection in red as its normally a broken line).

 

i could really use an option for this such as maybe importing the image as RGB 32 bit and trying to work with it as such and then convert it to 8 bit  (but might then keep out the floating points)

0 Kudos
Message 3 of 4
(4,262 Views)

Hi, Biosolutions,

 

I wonder if your problem can be solved by IMAQ Cast Image.vi.

http://zone.ni.com/reference/en-XX/help/370281P-01/imaqvision/imaq_cast_image/

You can choose GrayScale(U8) in the Image Type terminal, and then output the U8 image to the Image Write File 2.vi.

0 Kudos
Message 4 of 4
(4,249 Views)