LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I link the webcam in a program using an event loop, to run continuously, and the image from the camera can be used further to process it?

How can I link the webcam in a program using an event loop, to run continuously, and the image from the camera can be used further to process it?
I have a program that runs based on some photos. I would like that part to disappear and replace it with a web camera, to extract the image.
How could I modify the program with this part? Or where exactly should it be put, in Timeout?

Download All
0 Kudos
Message 1 of 5
(298 Views)

We cannot debug truncated pictures. There is no such thing as an "event loop", and you seem to have an event structure inside a while loop, but we can't really see enough of the code to draw any conclusions.

 

What's the connection between the two images?

 

An event structure is used for user interaction and thus "anti-continuous". While you could use the timeout case, there is no guarantee that it executes, depending on what other events a queued up. If you spin the loop anyway, you should not use an event structure.

 

So:

  • Attach all your VIs.
  • Explain exactly what should happen as a function of time and user interaction?
0 Kudos
Message 2 of 5
(292 Views)

I did an image processing project, used in the automatic detection of food. So far, I have used images, and now I want to connect a web camera. I used an event loop inside the while loop, because the user can interact with certain buttons, for example to manually add food or delete.
Everything works perfectly, but I don't really know how to link the program from image 2 (the one with Imaxdx open camera) to the main program. I want to delete the part of selecting an image when running the program, with the web camera binding.

Download All
0 Kudos
Message 3 of 5
(262 Views)

@Costin2001 wrote:

How can I link the webcam in a program using an event loop, to run continuously, and the image from the camera can be used further to process it?
I have a program that runs based on some photos. I would like that part to disappear and replace it with a web camera, to extract the image.
How could I modify the program with this part? Or where exactly should it be put, in Timeout?


First: as already stated, there's no Event Loop. An Event Structure in a While Loop allows you to monitor continuously for (user) events like mouse clicks or buttons pressed.

 

Second: if you want to set up a camera session, stream images and save some you need the LabVIEW Vision package.

Because you've indicated you want to use your webcam, you'll likely need to set up an IMAQdx session to the camera.

 

Finally: a Queued Message Handler allows you to run several processes in parallel. It may be the right software architecture for your goal.

It allows one While Loop dedicated to user input (like start video, stop video, save image, ...) and another While Loop to run the camera.

0 Kudos
Message 4 of 5
(255 Views)

I largely agree with @matys.

 

The first thing you need to do is to create a simple While Loop that can acquire a video image (from your Web Cam) and display it on an Image Display.  You'll need to consider the nature of your Image (which will be, in part, governed by the Camera you use).  Note that there are at least 4 components to consider -- X dimension, Y dimension, pixel "characteristics" (2-bit, 8-bit, 32 (color)-bit), and time.

 

Once you know how to do that, you can think about how to "capture" segments of this 4-D "stream" as a Video file.

 

Note that video processing is somewhat different (and more complicated) than the 1-D time streams characteristic of DAQmx.

 

Bob Schor

0 Kudos
Message 5 of 5
(224 Views)