LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

in labview vision 2013 how can i extract red plane color image fromRGB color image?

Solved!
Go to solution

A Post-Script to my Color Plane method -- a colleague who introduced me to Vision processing tried to convince me to use LookUp Tables as another way to change Grey Scale images of, say, the Red Channel into a "shades of Red" (or Color Plane) using an appropriate LUT.  Well, as poorly-documented as some of the IMAQ and Vision functions are, those involved with LUTs make the others read like Wonderful Prose!  What a confusing mess!

 

It is clear that it (in principle) should be possible to convert a U8 Grey Scale image into a Red Color Plane using a LUT that has "shades of Red from 0 to 255, shades of Green from 0 to 0, shades of Blue from 0 to 0", but how to incorporate this into the Display is unclear.  While it may ultimately be somewhat faster than generating R, G, B, and Null Color Planes and recombining them (as I've done) to get Red + Null + Null = Red images, I've decided that if I can't figure out how to use LUTs, I will similarly have a more difficult time of writing "transparent" (no pun intended!), understandable, and maintainable code using LUTs, so never mind!

 

If someone reading this does understand LUTs and can demonstrate how to use them to convert an 8-bit Red Color Plane Greyscale image to a (color) Red Color Plane, I'd be interested ...

 

Bob Schor

 

 

0 Kudos
Message 11 of 24
(2,966 Views)

If you don't have the vision toolkit and the RGB picture is just an array of U32, you can just mask it by ANDing it with certain scaalr U32 values ( xFF0000, x00FF00, x0000FF) to get the color planes.

 

If it is a paletted image, you apply the mask to the palette instead. The palette IS the LUT. 😄

 

Here's for a 24bit RGB image:

 

 

Message 12 of 24
(2,960 Views)

Christian,

 

     I do have the Vision Toolkit, and solved this problem by using its utilities to pull apart the three color planes into three grey scale images.  The trick was to display them a shades of Red, Green, and Blue (rather than grey), which I did at one twentieth the speed of displaying the Grey images (of course some of that is I was displaying U32 instead of U8 images ...).  Since you can right-click a U8 "grey" image and choose a "colorized" version instead of shades-of-grey, my colleague suggested it should be possible to use a User LUT to do the same thing.  Couldn't find documentation that explained this process clearly enough for me to foist it on anyone else ...

 

     If you know of a good reference, or how to build a User-Define LUT and then incorporate it into a U8 image (similar to right-clicking the Image on the Front Panel and choosing Palette, User defined), I'd definitely be interested 

 

BS

0 Kudos
Message 13 of 24
(2,949 Views)

You would just use a red, green, or blue color ramp for the color palette and draw it as paletted RGB image.

The 256 entries (indices ZZ: 00..FF) would have values of xZZ0000 (for red), etc.

0 Kudos
Message 14 of 24
(2,940 Views)

Bravo, Christian!  I took your idea and incorporated it into my earlier code.  My input is an array of Color Images, the first being the input image and the remainder being place holders for the Color Planes (U32).  I transform to an array, mask, transform back and (you'll forgive the phrase) "Bob's Your Uncle", there are the color planes.  Speed is comparable to recombining the separated U8's that I posted earlier -- it's 6 of one, the smallest Perfect Number of another ...

Make Planes.png

Bob Schor 

0 Kudos
Message 15 of 24
(2,931 Views)

I am a student working on image dehazing , so what I did is I extracted the rgb plane of the image using IMAQ extract color plane then I applied dark channel prior algorithm (found the dark channel image  and some steps ) then finally got the image dehazed imag in gray scale format. Then I thought if I put the grayscale image as source in IMAQ Replace Color Plane and put the RGB values of original image in as input it will give me the finally coloured version of the dehazed image . But now how do I get the RGB values extracted in a form that can be used as  input in the replace color plane to get the coloured version of my dehazed image .I am using 2018 version 

0 Kudos
Message 16 of 24
(997 Views)

Please attach your code (this means files with the extension .vi, not .png!), possibly the entire Project (compress the Project Folder by right-clicking, "Send to:", Compressed (zipped)) and attach it, along with a sample Image (this time, a .png file is OK) so we have something to "chew on".

 

Bob Schor

0 Kudos
Message 17 of 24
(987 Views)

this gives us dehazed image in grayscale i tried using replace color plane where i put gray scale image as source but that didnt work . please make it so that my finale image is in rgb form

0 Kudos
Message 18 of 24
(979 Views)

Help me T T deadline is near.

0 Kudos
Message 19 of 24
(949 Views)

I didn't realize that you had attached your question to an eight-year-old Post that I posted at least two "solutions" to eight years ago!  In the Forums, we call this "Hijacking a Post".  I apologize for not noticing this earlier, and asking you to start a "New topic", but I'm going to do this now!

 

Please do not Reply to this Post.  Please start a New Topic.  I regret to say that looking at the code you did attach (thank you for that!), it does not help me to understand your problem, possibly because you and I are using slightly different terminology (and possibly speak different native languages).

 

I do not understand what sort of Image Processing you are trying to do.  Note that the Topic of this Post (as expressed by its Title) is how to extract, from an RGB color Image, the Red Plane.  I showed how to extract the R, G, and B planes, then recombine then again to reconstruct the original Image.

 

When you Post your "New Topic", please give it a title that explains, in a few words, what you are trying to do.  Are you "extracting a color plane" from a color image?  Are you attempting to "colorize" a GrayScale image?  Get the Title of your Post to say (in less than 20 words) what you need to do.

 

In your Post, explain what your input image is, what you want to do with the image, and what you want the output image (or images) to be.  I am not an "image processor" -- I have no idea what a "dehazed image in grayscale" means.  To me, "grayscale" means "intensity only, no color information".  An RGB Image has 32-bit pixels, with three 8-bit "color channels", whereas gray scale images have 8- (or 16-) bit "shades-of-gray" (or "intensity") values.

 

Make clear what kind of images are your inputs, and outputs, and how you want to transform your images as they go from Input to Output.  It might be a good idea to actually attach an input image and (if possible) the corresponding output image you are trying to achieve.  Once we know what you want to do (and, perhaps, have a "sample" of the data you are using), we can be more helpful.

 

But do start a new Post.

 

Bob Schor

 

 

0 Kudos
Message 20 of 24
(943 Views)