From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Reading from PNG

Solved!
Go to solution

Hello,

 

I am working with the RAW data from a FLIR thermal image, using it to generate my own temperature images. The problem is that the data is written as a .PNG file, and I must have access to the data WITHOUT using VISION, because while I have a license in the laboratory I work, the client itself does not.

 

I tried to access the data using the Read PNG File.vi and using the IMAQ ImageToArray.vi. The results are different, but the image is the same. In Read PNG File.vi, the data is stored as a U8, while in the IMAQ ImageToArray.vi, the data is stored as I16. The results obtained with the IMAQ ImageToArray are correct, because I processed the data and obtained the results that were expected.

 

Does anyone know how to access the correct data in the PNG file, that is, the data obtained with IMAQ ImageToArray, without using vision?

 

Kind regards,

 

André

 

 

 

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

There are different outputs from Flatten To Pixmap, you have wired to 8-bit output. Wire the 16-bit output instead.

How the functions work is described in the context help, have you read the help?

0 Kudos
Message 2 of 9
(4,533 Views)

-First you need to know with what image bit depth raw data has been written to .png file.

-Instead you can do the reverse by using IMAQ GetImageInfo VI which gives the Image Type.

-Based on the Image Type you have to select proper output from IMAQ ImageToArray VI

-Grayscale (U16 or I16 or U8) or any other type which it returns, take corresponding output.

Thanks
uday
0 Kudos
Message 3 of 9
(4,458 Views)

udka>> As stated in the first message, the OP must access the data without using the Vision Module. But we already know that the data is stored as I16.

0 Kudos
Message 4 of 9
(4,445 Views)

Thanks perhult, I got confused by OP's statement: "In Read PNG File.vi, the data is stored as a U8, while in the IMAQ ImageToArray.vi, the data is stored as I16"

 

-In Unflatten Pixmap VI, only one of the various pixmap outputs (24-bit, 8-bit, 4-bit, or 1-bit) is valid at a time. In other words, this VI will not produce an output of two different pixmap values. Ref: http://zone.ni.com/reference/en-XX/help/371361N-01/lvpict/unflatten_pixmap/

- You mentioned in this post, in flatten pixmap use 16bit output, OP didn't use flatten pixmap first of all and for unflatten pixmap there is no 16 bit output.

-hence i wanted to understand first the image bit depth by using the get image info and proceed.

-You can also create indicator to image data and check the image depth, but Valid values include 1, 4, 8, 24, and 32 bits per pixel Ref: http://zone.ni.com/reference/en-XX/help/371361N-01/lvpict/read_png_file/

Thanks
uday
0 Kudos
Message 5 of 9
(4,432 Views)

Please disregard my earlier replies, I was wrong. Sorry.

OP, how is the two images different?

0 Kudos
Message 6 of 9
(4,409 Views)

Hi everyone,

Thanks for answering quickly. Actually, the images I use in both VIs is the same. I used the IMAQ ImageToArray just to see the data, but in the final project I won't be able to use it.

 

I tried to connect the other outputs of Flatten To Pixmap, but they show no data at all. The image depth is 8.

 

Thanks for all the help.

0 Kudos
Message 7 of 9
(4,392 Views)

Hi,

But how does the images differ visually? Can you post a screenshot of both images?

 

As udka wrote, flatten to pixmap only outputs one of the outputs, so you are using the correct output.

 

0 Kudos
Message 8 of 9
(4,386 Views)
Solution
Accepted by topic author andkrugeralves

The method which you followed, Read png and unflatten pixmap is correct and the output array is correct according to the image type without using IMAQ Vision.

-In the image to array you should get the Image pixel(U8) output and it will match with the 8bit pixmap data.

Thanks
uday
Message 9 of 9
(4,380 Views)