Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

processed video in color

Hello, how can i process video in color, because when i apply filters or brightness and contrast it processed only in black and white,here the VI attached,thank you for answering me.

0 Kudos
Message 1 of 8
(3,300 Views)

Posting from mobile Can't see code.

- There are many algorithms which are specific to gray-scale images.

- When you are not having extra buffer then most of them will change the original and image.

- If you want to have original image unchanged then keep separate buffer for original image and use imaq copy to have another image and process it.

- Read more on image types : https://zone.ni.com/reference/en-XX/help/370281AC-01/nivisionconcepts/image_types/

Thanks
uday
0 Kudos
Message 2 of 8
(3,289 Views)

Hi, Touitou.

     The IMAQ Create function, by default (meaning if unwired) will create a buffer for an 8-bit greyscale Image.  Many (most?) of the Image Processing Functions work on 8-bit data.  Color images are made by arranging four "planes" in a u32 representation (three of those planes are R, G, and B 8-bit values) -- you need to do some "extra work" to handle color processing (and it gets complicated pretty quickly).

 

     In the VI you attached, all of your IMAQ Buffers were 8-bit, hence "shades of grey".

 

Bob Schor 

0 Kudos
Message 3 of 8
(3,208 Views)

separate your image RGB plane with imaq extract color planes use your filter and BSG on plane and at the end gather them with imaq replace color plane 
use a simple white image with same size for replace color plane

0 Kudos
Message 4 of 8
(3,189 Views)

thank you for replying me,but i didn't know how to apply what you had say in this VI.can you help me?

0 Kudos
Message 5 of 8
(3,173 Views)

try some thing like this 

0 Kudos
Message 6 of 8
(3,165 Views)

Its not working,they give me three errors.

 

0 Kudos
Message 7 of 8
(3,163 Views)

Here is a suggestion -- start simple.  Forget about processing Video images, but instead work with a single color Image.  One that I like to use is Desert.jpg, contained in the Sample Pictures folder in the Public Pictures folder.  Use the IMAQ ReadFile to input the Image and simply display it in an Image Display.  Now play with the Image to figure out how to do whatever Image processing you want, without having to worry about Grab, timing, saving, reading/writing, etc.

 

Here is a two-Image-VI routine to get you started, built essentially on the code that you posted.  Note that you'll have to Browse for the Image, which is not going to be exactly where mine was stored (in all likelihood).

Desert Image.png

This code runs fine, and produces the following image (I used Zoom-to-Fit to see the entire Image):

Grey Desert.png

See the lovely colors?  I explained, in an earlier post, exactly why the code that you are using produces gray images instead of the following:

Color Desert.png

Read my earlier response in this string, "fix" the code that I posted, and see the Desert in Color.

 

Once you have a proper Color Image, you can work on "taking it apart" or "modifying the Colors".  Do the processing one (small) step at a time, displaying the intermediate results so you know you are "doing the right thing".  Experiment, try things out -- you won't "break" any pixels.

 

Bob Schor

0 Kudos
Message 8 of 8
(3,159 Views)