07-07-2015 11:34 AM
Good day to all,
I obtained an array of 512*512 U32 data from the photomultiplier using the analog input of DAQ board. My question is how to convert this 32-bit matrix to 8 bit monochrome image for display.
I tried the method in this post to convert array to grayscale image https://decibel.ni.com/content/docs/DOC-4155 but the result looks like a contour rather than real image. I guess it is because their input to Flatten Pixmap is 8 bit, but mine is 32 bit. Do I need to do gamma correction to scale my data? But how?
I attached the original image, which is a particle.I also attached my labview code and the processed image. Thanks!
Solved! Go to Solution.
07-07-2015 11:43 AM - edited 07-07-2015 12:05 PM
Try the Draw Unflattened Pixmap VI.
Nevermind, I misunderstood your question. I think there must be something wrong with you color table that you made. The conversion isn't exactly what you were expecting. Maybe play around with that table generation?
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
07-07-2015 12:16 PM
Thanks James. Yes, the Draw Unflattened Pixmap gives a color image, but still looks like contour.
I input the data in Matlab, I found that the function mat2gray can realize my function (see the pic), but I don't know how to get the same result in Labview.
Could you explain a little more about the color table?
07-07-2015 12:56 PM
Is this not just the result of integer overflow when labview coerces the 32-bit matrix to 8bits? Have you tried dividing all the elements by 2^(32-8) to scale all your values down to 8 bits? (or any other method of scaling your data down to the 0-255 range)
07-07-2015 01:13 PM
Where is your original image data?
07-07-2015 01:47 PM
Hi, here is my original data, in .txt format.
07-07-2015 02:34 PM
Thanks! The problem is indeed caused by overflow of data through convertion. However, in this typical example my data ranges from
4294963840 to
4293967276
If I divide all the data by 2^(32-8), the whole matrix becomes 255, showing a total white image.
07-07-2015 02:39 PM
Then you'll probably need to do you own custom conversion then that increases the difference between the brightest and the darkest.You could just make 4294963840 the zero and 4293967276 the max and scale down to 0-255
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
07-07-2015 04:06 PM
Simple scaling for maximum contrast.
07-07-2015 04:27 PM