LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Want to extract information from the image

Solved!
Go to solution

Dear Admin,

 

I am looking for a labview code for extracting information from an image. Please see the attached image in which temperature is changing from 25 degrees to 150 degrees (see the bar at the top of the image). I want to know the exact temperature at every point of the image. If someone already have labview code, please share it or guide me towards the similar example.

 

Thanks and Regards

Hassan

0 Kudos
Message 1 of 9
(1,771 Views)

Hi Hassan,

 

just get the grayscale value of each pixel: calculate min/max of all values, then scale by (150-25)/(max-min)+25…

 

LabVIEW has (picture file) functions to read PNG images and gives you the color value of each pixel!

 

What have you tried so far? Where are you stuck?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(1,747 Views)

GerdW, 

 

I haven't tried yet. Actually I am not good at it but let's try. 

 

how to get the grayscale value of each pixel ?

 

I ll try the LABVIEW picture file function. It would be great if there is already written code available.

 

Regards

Hassan 

0 Kudos
Message 3 of 9
(1,735 Views)

Dear GerdW, 

 

I haven't tried yet. Actually I am not good at it but let's try. 

 

how to get the grayscale value of each pixel ?

 

I ll try the LABVIEW picture file function. It would be great if there is already written code available.

 

Regards

Hassan 

0 Kudos
Message 4 of 9
(1,734 Views)

Hi Hassan,

 


@HassanIqbal wrote:

I haven't tried yet. Actually I am not good at it but let's try. 


When you want to use LabVIEW, then you should learn how to use it!

 


@HassanIqbal wrote:

how to get the grayscale value of each pixel ?

I ll try the LABVIEW picture file function. It would be great if there is already written code available.


A very simple approach:

Your PNG is saved as 24bit color file instead of 8bit grayscale image, so I included the FOR loops for RGB to gray conversion. I used a very simplistic color-to-gray conversion, read up on WIkipedia about other formulas for that conversion!

The intensity graph shows data scaled to your desired temperature axis…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 9
(1,723 Views)

Dear GerdW,

 

Thank you so much for the code. Indeed I should learn. 

 

Instead of the intensity graph, Can we generate the data points only for the whole image ? 

 

Regards

Hassan 

0 Kudos
Message 6 of 9
(1,714 Views)

Hi Hassan,

 


@HassanIqbal wrote:

Instead of the intensity graph, Can we generate the data points only for the whole image ?


The intensity graph is just one kind of indicator, which display a 2D array of elements representing "the whole image".

You can do anything you want with this 2D array!

 

Again: this is very basic LabVIEW knowledge so you should take the Training resources offered in the header of this LabVIEW board!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 9
(1,711 Views)

Hi GerdW, 

I tried the same code you provided about but unfortunately its not working for me. Could you please have a look and advise why it wasn't working. 

 

Regards

Hassan 

0 Kudos
Message 8 of 9
(1,655 Views)
Solution
Accepted by topic author HassanIqbal

Hi Hassan,

 


@HassanIqbal wrote:

I tried the same code you provided about but unfortunately its not working for me. Could you please have a look and advise why it wasn't working.


Because you wired your VI differently then I did…

 

I mentioned before:

Your PNG is saved as 24bit color file instead of 8bit grayscale image

Because of this fact you need to use a different output of the UnflattenPixmap function - as can be seen in my snippet image!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 9
(1,648 Views)