LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When performing Pattern Matching, can the camera start video recording when it detects the object?

I am doing Pattern Matching for a project and I want to start video recording when the camera does not record a video while it is at the threshold and detects the pattern matching object. Can I add my VI?

0 Kudos
Message 1 of 5
(2,293 Views)

I regret to say I do not completely understand what you want to do (from your very brief description).  You can certainly set your video camera to acquire images at some frame rate, you can certainly analyze each frame as it is acquired, you can certainly make a decision based on the frame analysis.

 

Suppose we assume that you are acquiring frames at 30 fps, analyzing each frame in 33 msec (the time between frames), and detect "something" at Frame 214.  What do you want to do?  I'm guessing (but am not sure if I'm right) that you want to make an AVI starting at Frame 214 and continuing for (not specified ... 20 Frames?  100 seconds?), then close and save the Video.  Then what?

 

Do you know about State Machines?  [If not, open a new LabVIEW Project and when the right-hand pane asks what type of Project, choose Simple State Machine and study the example produced, as this might be a good Design for your Project].

 

Bob Schor

0 Kudos
Message 2 of 5
(2,238 Views)

I want video recording to start when an object is detected while the camera is running

0 Kudos
Message 3 of 5
(2,229 Views)

Hello,

 

You could use a case structure to start recording video to a file once your number of matches is greater than one, assuming you're seeing a match every time the object you want to record is on-screen. You can find a good example demonstrating how to save images to an AVI file in the example finder by following the steps below:

 

1. Open the example finder by opening any LabVIEW window and clicking Help -> Find Examples...

2. You will see the task tree as soon as the example finder opens. Navigate the task tree to Hardware Input and Output -> Vision Acquisition -> NI-IMAQ -> File Input and Output

3. All the examples in this folder save images to an AVI file, but Grab and Save to AVI is probably the simplest one.

 

Writing to an AVI file is an expensive operation, so you may want to consider a producer/consumer architecture to stream to disk. I've linked an example below which demonstrates how you can do so.

 

IMAQdx Stream Image to Disk Using Asynchronous TDMS

http://www.ni.com/example/31550/en/

 

Note this example streams to TDMS, so you'd want to replace the TDMS elements with the Write to AVI functions demonstrated in the shipping examples.

Austin
Staff Software Engineer
NI
0 Kudos
Message 4 of 5
(2,208 Views)

I can not apply the solution to your own VI. If you wish, can you add my VI?

Can you (grab and save) add my VI?

0 Kudos
Message 5 of 5
(2,201 Views)