LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Flatten Pixmap distorts the image

Solved!
Go to solution

Hi,

I am trying to save 2D data (U32 bit) into a PNG file. I am using the Flatten Pixmap function to convert the data into an image data cluster then using write PNG file function to save it as an image. However, this method produces the image file which is completely distorted and has circular rings, which is not the part of the original data. Does someone know what I am doing wrong here? Any help would be very useful. See the snapshots of vi and image attached.

thanks

anshuman

Download All
0 Kudos
Message 1 of 5
(2,507 Views)

If you could save the VI with the intensity graph having standard data set as the "default" that would be very helpful. Then you can upload the VI (preferably in the lowest reasonable version) so we can poke around.

 

Based on the limited information here, it might have to do with you sending in I8 data to the "unflatten pixmap" function. The input is U8, so any values <0 are going to be effected. If your values are in the range of [-128,127] I would convert to I16 and add 128 to the entire array so you are in U8 territory.

0 Kudos
Message 2 of 5
(2,495 Views)

I was trying different things based on the suggestions I could find on the forum that's why using I8 . One correction, the intensity data is I32 type not U32. I tried your suggestion of using I16 then add 128, but still doesn't change anything.

 

Here I am attaching my vi with image data, please have a look and let me know if there is any errors there.

 

thanks

anshuman

0 Kudos
Message 3 of 5
(2,482 Views)
Solution
Accepted by topic author asp_jena

Yes, your data is going out of range for U8. The max value for a U8 is 255, and you can see from the intensity chart Z-axis that yours is close to 5000. This causes the values to wrap around back to 0. You can try multiplying by 255 / max value to get your data in the range of [0, 255].

 

Capture.PNG

Message 4 of 5
(2,473 Views)

thanks gregory. It works now. Thanks for pointing out the error.

0 Kudos
Message 5 of 5
(2,468 Views)