08-28-2020 01:47 AM
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
Solved! Go to Solution.
08-28-2020 02:34 AM
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?
08-28-2020 03:32 AM
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
08-28-2020 03:33 AM
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
08-28-2020 03:54 AM - edited 08-28-2020 04:00 AM
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…
08-28-2020 04:10 AM
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
08-28-2020 04:14 AM
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!
08-30-2020 11:41 PM
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
08-31-2020 01:08 AM - edited 08-31-2020 01:08 AM
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!