LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Colour pattern matching with a webcam

Solved!
Go to solution

Hi,

 

I have a web cam which I am able to use successfully in labview (i.e.. Get images)

 

I have looked at the colour pattern matching examples and tried to modify them, so that I can detect a red spot, that can be seen through the webcam, but have been unsuccessful. 

 

In essence I'm trying to do real time colour pattern matching

 

Can anyone steer me in the right direction? Or help me out?

 

Thanks 

0 Kudos
Message 1 of 6
(6,234 Views)

Hi kr121,

 

I'm trying to work on color myself right now.

 

What have you tried so far?  What type of web camera are you using?  I'm using a Microsoft Life Camera with LV 2011 on Windows 7.

 

I started here:  http://zone.ni.com/devzone/cda/epd/p/id/5030 

 

If you are not using an NI camera I was able to get this to work using the cmd prompt and extracting the files manually to at least run the NI-IMAQ for USB: Snap and Save Image with USB Camera and NI-IMAQ for USB: Grab and Save Image with USB Camera examples.

 

The command prompt command is:

 ni_imaq_usb_installer_86.exe /x

 

Don't know if this is 100% correct but it at least allowed me to capture images and avi's.

 

Regards,

 

-SS



0 Kudos
Message 2 of 6
(6,220 Views)
Solution
Accepted by topic author kr121

Hi Guys,

 

There is a great example which installs with the vision developement module. This example might not be EXACTLY what you are after, as it allows you to dynamically define a colour pattern to match. However, you could always save a static "pattern template" to disk, and use this within your code - if that is more relevent to you application. As an adding bonus, removing the dynamic pattern learning would simplify the code a little.

 

Color Pattern Matching Example

 

When searching ni.com or the LabVIEW example finder, remember to spell COLOUR the American way... color.

 

Thanks,

Rich Roberts
Senior Marketing Engineer, National Instruments
Connect on LinkedIn: https://www.linkedin.com/in/richard-roberts-4176a27b/
Message 3 of 6
(6,202 Views)

Also you can do a simple color threshold if you dont want the full blown pattern match you can do a simple color threshold in the Imaq pallette, I usually use HSL instead of RGB since it performs ofe more lighting conditions.  Using Hue Red falls around 0 level with a 255 wraparound, thresholding red would be anything with a Hue of ~240-20 (Wraps around zero) restricting the Saturation and Lum will make your color threshold more selective.  A second check on the binary blob size morphology can help find exactly what you are looking for. 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 4 of 6
(6,190 Views)
Hey yea this really helped I was able to use the example and learn from it. Also simplifying the example code. Thanks
0 Kudos
Message 5 of 6
(6,181 Views)

 

Example using the color identified by selecting a region of interest ROI and activating indicator when there is coincidence in color

 

0 Kudos
Message 6 of 6
(5,783 Views)