02-19-2024 01:34 AM
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?
02-19-2024 01:46 AM
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:
02-19-2024 03:38 AM
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.
02-19-2024 04:49 AM
@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.
02-19-2024 06:13 PM
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