ā10-28-2015 11:19 AM
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.
Solved! Go to Solution.
ā10-28-2015 11:32 AM - edited ā10-28-2015 11:32 AM
You can just unflatten the Pixmap from the loaded image:
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> ---'
ā10-28-2015 12:03 PM
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.
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?
ā10-28-2015 12:28 PM - edited ā10-28-2015 12:52 PM
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.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
ā10-28-2015 12:43 PM
I made a self-referencing intensity graph of the snippet of the code:
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
ā10-28-2015 12:52 PM
When I hook it up to the 24-bit output, it works. Thanks again for your help.
ā07-27-2019 02:30 AM
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.
ā07-29-2019 02:45 AM - edited ā07-29-2019 03:03 AM
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ā¦