LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Image to Intensity Graph

Solved!
Go to solution

Is it possible to make an intensity graph out of a jpg image?  If so, how do you do it?

 

I am using LabVIEW 2012 V12.0f3 32-bit.

 

Thanks.

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 1 of 8
(4,338 Views)

You can just unflatten the Pixmap from the loaded image:

Intense Image.png

 

Edit: I used the BMP VI above because that's what I have handy, but there's one for JPEGs

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 2 of 8
(4,324 Views)

Thanks for your help, James.

 

Turns out my source image is a PNG file, but it is easy enough to find corresponding functions using your code.

Image to Intensity File VI.png

When I run this VI, "Image" shows the correct image, but "Intensity Graph" is all black.  I have tried this with a variety of image files, and I get the same result each time.  Any idea what I might be doing wrong?

 

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 3 of 8
(4,312 Views)
Solution
Accepted by topic author diarmaede

Auto-scale your intensity graph z-axis.

If this fails, add indicators to all the outputs of the unflatten VI to make sure you're getting the right array of data out. Make sure there is data in the arrays. As a PNG, you might be getting 24bit image data, not 8.

Intense Image Outputs.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 4 of 8
(4,300 Views)

I made a self-referencing intensity graph of the snippet of the code:

Intense Image Outputs SelfReferencing.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 5 of 8
(4,289 Views)

When I hook it up to the 24-bit output, it works.  Thanks again for your help.

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 6 of 8
(4,283 Views)

Attached find my suggestion.

This gives 8bit color (3:3:2) for most png, bmp and jpg image files.

However, very strangely, it doesn't work with Z-Scale interpolation on  (i.e. keep it off !).

(e.g. try an image with pure yellow or red.... the Z-Scale interpolates incorrectly and colors are incorrect, I assume there is a bug in the LabVIEW interpolation implementation).

Further work: There must be a way to use the available 256 colors in the Z-Scale with interpolation such that you are not limited to a 3:3:2 color palette, and can get all colors in between each of the 256 markers. Any suggestion out there in taking this to the next level? This of course depends on the internal workings of the intensity graph.

0 Kudos
Message 7 of 8
(3,095 Views)

Hi Philippe,

 

what's the reason to hide that single VI inside a LLB file?

 

However, very strangely, it doesn't work with Z-Scale interpolation on  (i.e. keep it off !). (e.g. try an image with pure yellow or red.... the Z-Scale interpolates incorrectly and colors are incorrect, I assume there is a bug in the LabVIEW interpolation implementation).

Haven't noticed this bug.

Can you attach an image showing this problem?

 

Further work: There must be a way to use the available 256 colors in the Z-Scale with interpolation such that you are not limited to a 3:3:2 color palette, and can get all colors in between each of the 256 markers.

Right now you use a fixed 3:3:2 color table. You can instead use 256 (or less) colors from your image!

The intensity chart/graph just supports 256 different colors, and uses color entry 0 for "underrange"/entry 255 for "overrange" indication…

 

On your VI:

There is duplicated code in the case structure.

No need for a local variable of "Intensity Graph".

Please show the radix for your numeric constants to allow easier detection of those binary values…

You always use a "255" constant, but the IntensityGraph supports 256 colors. All that color calculations should also be done with a factor of 256…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 8
(3,073 Views)