LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to detect red frame in a series of images using web cam?

Solved!
Go to solution

hey i am a new use of lab view(8.2 n 8.6).kindly ca any1 help me out in red color detection in a series of frames being capture by a usb web cam.i have done the grabbing thing but dont knw what to do now.plz help me out. basically i hve to do the following things:

1 )the camera is continuously making video


 2)the moment a red color or red frame comes across the camera the camera is programmed such that it will capture that red frame. and display that captured frame

 

plz hep me out.i need serious help.

i am attaching a vi that is grabbing the images and then xtracting the red color info n thn displyaing its intensities rows and coumn wise on a graph.here i have used a guassian surface to locate the red color.

0 Kudos
Message 1 of 23
(4,775 Views)

Hey armank,

 

There are a few things that can be fixed in your code (your imaq dispose is not wired to any images) but for the most part, its pretty easy to follow. Some of the functions you are using can be done with just the IMAQ palette also, such as IMAQ Convolute.

 

If you are looking for a "red frame," there are a few ways you can go about doing that. If you know exactly what your red frame is going to look like, you could utilize some of our color pattern matching VIs:

  • LabVIEW\examples\Vision\2. Functions\Color Pattern Matching\Color Pattern Matching Example.llb
  • LabVIEW\examples\Vision\3. Applications\Fusebox Inspection Example.llb
  • LabVIEW\examples\Vision\3. Applications\Blister Pack Inspection Example.llb

If you just know that it is going to be a little more red than the rest of the frames, you could always just extract the red plane and check the intensity.

 

As far as "grabbing" the image, your computer sees every image that is passed from the camera, it is just a matter of what you want to DISPLAY to the user. To only update with the red frames, you can just right-click on an image output on your front panel and select snapshot. Now when you use your code deciding if it is a red frame or not; if it IS a red frame, and you send it to that image control, it will stay there until it is populated with the next red image.

 

Hope this helps get you started.

 

 

 

Chris Van Horn
Applications Engineer
0 Kudos
Message 2 of 23
(4,763 Views)

plz any one could tell me how to do the following things:

i have to capture a red frame when ever it comes across ma web cam that is making video

i have dont the grabbing thing but i am very new lerner of labview(8.2) so dont know how to use it.

i know the algo to implement ma code but unable to do it practically.

i want to compare each image seen by my web cam with a red color or i want to match each image seen by ma web cam with a red color defining a specific level and if that frame contains the red color thn that frame is captured otherwise the camera keeps on seeing the images.i know which vi to use but unable to implement it.plzz some body help me.

can any1 only give me the blok diagram for simply taking an image and then if that image has a red color in it then an indication is given..

plzzz do rep soon.

0 Kudos
Message 3 of 23
(4,735 Views)

Hi armank,

 

Did you take a look at any of the examples that Chris provided to you in his previous post?  If you look at them, I think you'll find some tools that you can adapt for your application.

Stephen Meserve
National Instruments
0 Kudos
Message 4 of 23
(4,696 Views)

yup i checked those examples.thanks your advice was a big help tto me.i have modified the code but a strange error is coming.

 

an exception occured within the external code called by a library function node.this might have corrupted labview's memory.save any work to a new location and restart labview:
"name ".vi was stopped at node " " at a call to "IMAQ USB INit.vi"

 

i restarted lab view but again the same error.actually i am trying to compare the colors of an imge taken by a web cam and an image loaded from memry.i am attaching the vi.plz do chk and rep soon.=(

0 Kudos
Message 5 of 23
(4,679 Views)

Hi armank,

 

I don't think you've wired up the IMAQ USB Init VI correctly.  You have wired in a string control with the name 'usb web cam', which I doubt is the official internal name of your USB Webcam. You need to wire the output of the index array function to the IMAQ USB Init so that you are taking the exact name of the webcam as the input to the USB Init VI.

Stephen Meserve
National Instruments
0 Kudos
Message 6 of 23
(4,676 Views)

thnx alot for your help.i will surely debug ma code and then tell u about ma progress.

sorry for the duplicate threads actually i was using the ni forums for the first time thats why =(..nw on wards will rep at the same thread.

actually i wanted to discuss something with u:

 

as u already know that ma project is basicaly the detection and capturing of a red frame when ever it comes across a web cam that is continuiously grabbibng the images.do u thnk ma algo will work??(the vi that i hv attached before)..actually i am trying to make it for the universal red color.i have a bit confusion: the code i had made is only comparing a specific value of the pixel colors of red image that is made in piant(jpg)..if i implement this algo then will it work??

 

1)if i divide each image seen by ma web cam in to its respective pixels

2)then comparing those pixel values with the pixel values given by me(that has a specific range for red,blue and greea color)

3)and if that image has the pixel values in the range defined by me thn that image is somehow captured and displayed

 

do u thnk this algo is work able enough???actualy i have recently started programming on labview thats y only could make the pseudo code and finding difficulty in implementing it.

 

pls guide me.

rep soon.

thnx

0 Kudos
Message 7 of 23
(4,653 Views)

HEY i am working on color matching vis

wnted to convert a jpg pic to for thr input of imaq color learn and color match.i have converted the pic to an image but ma vi is still givig error that it is not an image.plz help me out.rep soon.and do rep for thr ref color detection.

0 Kudos
Message 8 of 23
(4,621 Views)

Hi armank,

 

If you are looking for a universal red color, you don't have to analyze each pixel individually. You could use the IMAQ Color Threshold.vi to look for areas high in red but low in blue and green for you. 

 

As for the attached vi from your last post, to make it work you need to indicate in your IMAQ Create.vi that the image is a RGB(U32). You need to specify this because IMAQ ColorLearn and IMAQ ColorMatch look for this image type or else it gives an error. 

0 Kudos
Message 9 of 23
(4,610 Views)

hey,i have made the code plz chk it and do rep soon as ma project sbmission date is very near =((

i am snaping an image from the web cam then comparing it with the red colored jpg image made in paint.

the jpg image is converted  to give input image to imaq match vi.but after the comparison it gives the same output.

on the front pannel the snapped image is displayed,the red colored image that is converted in to its respective pixels is displayed and the image that is obtained after cheking the image in the draw fails vi...the pic converted to pixels is all the time displayed.and the pass/fail icon always denotes one pass led on..plz chk the code =((.

 

also can u provide me some guide line for using thr hough transform for the red color detection in lab view..i dont have to import the matlab code..i have to purely make it using the lb view libraries.

also one more request pl rep me regularly as i really need your golden piece of advice for ma success.

thnx

Download All
0 Kudos
Message 10 of 23
(4,582 Views)