Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create a color mask

Hi I'm new to LabView and over the past few weeks I've been trying to familiarize myself with the software for Image and real time video processing purposes and I've run into what I feel is a rather elementary problem, I can't filter out colors from an image.

 

I was wondering if there is a way to create a color mask of some sort to do this, in which LabView would...

1.) identify a color or colors

2.) find all instances of that color or color

3.) reduce pixel instances to zero or create a geometry containing.

 

what I'm having trouble with specifically is 2 and 3 because I found a VI that will identify colors. Is there anyway to do this in LabView? Also, I do have several years of programming under my belt using MATLAB and I know how to do this in MATLAB but I don't know if LabView can sync up with MATLAB although I found several posts in these forums talking about MATLAB. If there is a way to create MATLAB code and run it in LabView that could also solve my problems.

 

I'm running LabView Student version 2009 with Vision Developer 2010 SP1 and Vision Builder AI 3.6

 

Any help would be appreciated

0 Kudos
Message 1 of 3
(2,987 Views)

So there is a way to accomplish this within LabVIEW, which basically involves converting to an array, manipulating the array within LabVIEW, and then converting back.

You would use the "ColorImageToArray" VI to read out an array, at which point you would use the standard LabVIEW VIs within the array palette to search the array and whatnot.

 

If you want to set pixel values directly, there is a VI called "IMAQ SetPixelValue" that can accomplish that.

 

If you want to get the values for the individual color planes (R, G, and B), you can first separate them into their color planes. Essentially, you'll have three greyscale images, and then you can use "ImageToArray" to convert those to arrays with pixel values of 0 to 255 (if you have 8 bits per color per pixel). This example can get you started on that...

https://decibel.ni.com/content/docs/DOC-5655

Ravi A.
National Instruments | Applications Engineer
Message 2 of 3
(2,977 Views)

There is also a VI called IMAQ Mask (Functions Palette: Vision and Motion >> Image Processing >> Operators) as well.

Ravi A.
National Instruments | Applications Engineer
0 Kudos
Message 3 of 3
(2,976 Views)