05-14-2016 03:58 AM - edited 05-14-2016 03:58 AM
Hi
How can i save a grayscale sgl as rainbow?
i analyze the image in grayscale but for presentation i need to show it in rainbow.
my code doesnt work, however
Solved! Go to Solution.
05-14-2016 04:41 AM
update, i change the image type to U16
I manage to save the image, however still in grayscale format
05-17-2016 02:56 AM - edited 05-17-2016 03:06 AM
this is first method to save and show rainbow image
05-17-2016 03:12 AM
also test this
but if you just want show image in rainbow just right click on image go to palette and select rainbow
05-17-2016 09:47 PM
Hello Hatef,
what if my image is a grayscale sgl image?
05-18-2016 02:00 AM
05-18-2016 09:30 AM
This turns out to be a fairly "deep" question that gets into numerous topics not particularly well covered in the IMAQ documentation (or not always as accessible as one would like). There are several related sub-topics:
At various times, I've dabbled with elements of this problem, but never quite "got it". However, some comments and posts by Hatef Fouladi and some digging around the LabVIEW Vision Documentation led me to a better understanding of this question, and a potential "partial" solution (I call it that because it might not directly answer the question posed by the Original Poster).
I'm going to beg your indulgence -- both for myself, my students, and this Forum, I want to try to supply some of the "missing Documentation", which will require about a day or two of work. I can tell you that I have a tentative working routine that can take a "Gray Gradient" and, after applying the "Rainbow" LUT, turn it into a PNG that ... looks like a Rainbow.
But while writing this Response and about to "apologize" for making you wait, I realized that while I had, indeed, "colorized" my Image (as verified by displaying it on the Screen), I'd forgotten that the goal was to save the PNG as a colorized Image. So I added the PNG Write function, saw the "Color Palette" input, and said, "Hmm, I wonder ...", which leads me to this:
I chose to work with U8 Grayscale Images. A difficult-to-find note here, from the LabVIEW 2010 Vision Manual, explains that PC displays can only show 256 levels of Gray, so U16 Images need to be "remapped" to a U8 range before visualizing as Grayscale.
The nested For loops generate a 128-by-128 pixel "Gray Gradient, with 0 (black) in the upper left corner and 254 (white, almost) in the lower right. That's the Image I will use, writing it out as Gray.png. The IMAQ Write File 2 (IMAQ functions changed a few years ago, many taking a "2" suffix) has a Color Palette input, and IMAQ provides a few standard LUTs (which it calls "Palettes"), including "Rainbow", using the IMAQ GetPalette function. I wired this up into a second Write File 2 function, and the results are shown below.
I still intend to write this up further, but this "solution" is so simple, and what I'm hoping to explain is sufficiently complex, that I may take a little more time to "do it right". I will (eventually) post it here (or, at least, those are my Good Intentions).
Bob Schor
05-18-2016 12:57 PM
As a non-LabVIEW solution, you can use a free program called ImageJ which I believe is used in many fields of science. It has some nice lookup tables that you can apply to an image.
05-18-2016 08:11 PM - edited 05-18-2016 08:14 PM
@Gregory wrote:As a non-LabVIEW solution, you can use a free program called ImageJ which I believe is used in many fields of science. It has some nice lookup tables that you can apply to an image.
with Imagej you have to work and save file with tif format if you want 32bit GS image. if you use other format to save image' image will be convert to U8 automatically before save
also there is no rainbow tools LUT tool of imagej
instead we can use one of method that you can see it in image 2
but for labview you have to save image in binary mode or inside the text as matrix
many years ago I develop an image processing software with labview and with ability and style of image j but with more feature's and with persian language. I call it Image M one of my problem that Imagej could handle it but in labview it was so hard to do it was to save 32bit GS image and I have to save it in binary file with my written software Image M
05-23-2016 03:04 AM
Hi All,
Thank you for your reply,
After I study your posts, finally I managed to convert grayscale sgl to rainbow
the trick is to rescale the image
here i attached my code and result