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].
I want video recording to start when an object is detected while the camera is running
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
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.
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?