03-31-2022 08:01 AM
Hi,
I'm trying to save a grey scale image from an intensity graph, but I'm having issues. The pixels in the saved image are just the brightest ones and I don't understand where the mistake is.
Any tip would be very appreciated!
03-31-2022 08:48 AM
Hi,
you can use the invoke node "get image" and "get image subset.vi" to capture a screenshot.
but this approach is limited to the resolution of the intensity plot as displayed on the frontpanel.
My Write BMP to file looks like this
Which version of LabView are you using?
Could you attach a .vi with some typical intensity plot data saved as default?
03-31-2022 08:50 AM - edited 03-31-2022 08:53 AM
Your scaling is incorrect. Add Min then Divide by Max-Min to normalize the array. Multiply by 255 for an 8 bit depth.
03-31-2022 08:59 AM - edited 03-31-2022 09:58 AM
Hi, this is the VI example. I had to use wetransfer as it's too big for the forum.
I don't want a screenshot, I need to save the full-res image.
I'm using LabView 2021.
https://wetransfer.com/
03-31-2022 10:41 AM
Hi,
I tried the scaling as suggested, but the image is still dark 😕
03-31-2022 12:45 PM - edited 03-31-2022 12:49 PM
OK, I see, the gradient is actually RBG not Grey scale and you are using the color bmp.
That means you need to take your scaled U8 array and use 3 join numbers to build a U32 array of 0, R G, B since all grey values have the same RGB elements. (Black is 0,0,0. or 0x00000000 as a U32 and White is 255, 255, 255 or 0x00FFFFFF as U32)
The mnemonic is;
Roses are 00FF0000
Violets are 0000FF00
Grass is 000000FF
And that's your hue.
03-31-2022 12:55 PM - edited 03-31-2022 12:56 PM
jay is right, you need to change your scaling ... the following appears to work..
03-31-2022 01:26 PM - edited 03-31-2022 01:28 PM
Thank you very much guys! Now it saves them!
There is still a little issue: the tonality of the saved image is not the same of the image in the graph. It's much brighter. Is there a way to fit the pixel values in the graph min-max (z) scale values?
Now I put the block inside my main program, where the intensity graph is generated after a scansion started in another event case.
Saved image:
I also need to understand why the bit depth of the image is so low. I wish there were more grey values in it, but it seems the grey levels are a few and very compressed in the histogram.
04-01-2022 06:04 AM
@Nidhogg wrote:
There is still a little issue: the tonality of the saved image is not the same of the image in the graph. It's much brighter.
For your example attached, i can't confirm your claim. both the 2d array and the colortables are identical.
the Minimum and Maximum might change from image to image.
Therefore you should set a global maximum and minimum, estimated from various images
04-01-2022 08:55 AM
Hi!
Thanks everyone for the help.
I finally fixed it, by introducing a compensation for min and max values 🙂
Now it works good!