LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

webcam continuous capture and save to avi later

Solved!
Go to solution

Hello,

 

I am new to LabVIEW.  If anyone could help with the USB webcam and LabVIEW 2010.  I have all the IMAQ drivers installed.

What I am try to do is capture video continuously into a buffer memory or an array and be able to extract that buffer video and save it as an AVI video.

So the main question is buffering video in memory and write as an avi file in later time.

Sorry if this confusing.  Please let me know, I can be more details to clear thing up.

 

Thank you so much for all your help.

 

Dan

 

0 Kudos
Message 1 of 15
(7,832 Views)

 Hi Dan,

In order for you to create AVI file, I am assuming that you are using the IMAQ AVI Write Frame from IMAQ library. The function receives an image to add to the AVI frame so the image buffer that you want to create in the memory should allow you to keep the images captured by the USB camera in frames as well.

 

Have you tried to use queue to save the images? To use queue, you would need to create an IMAQ image (IMAQ Create) for every image (create a unique handle for the image) and then add the IMAQ frame to the queue, hence saving it to the memory. Once you finished the acquisition, you can dequeue images from the queue to save the IMAQ frame to AVI.

 

I hope that this helps you started.

 

Best Regards

- Meadow -
LabVIEW 7.0 - 2011, Vision, RT, FPGA
TestStand 3.0 - 4.5
0 Kudos
Message 2 of 15
(7,819 Views)

Hello Meadow,

 

Thank you so much for a quick respond.  To answer to your questions.  Yes I did tried using IMAQ AVI Write in state machine.

 

For the second question about using queue, no I have not use queue to save images.  I am not quite sure of understanding of using queue in LabVIEW.

 

Could you please explain or direct me where I can find more information about using queue?

 

Thank again.

 

Dan

0 Kudos
Message 3 of 15
(7,804 Views)

marlin12,

 

To get started with IMAQ programming, I really like to use the shipping examples to base my code off of.  In particular, the one that comes to mind for your application (saving an AVI image) is called Grab and Save to AVI.vi.  You can find it in the NI Example Finder from LabVIEW. 

 

Click Help » Find Examples... then search for "AVI".  You should then see several examples relating to IMAQ and AVI files, and the one I listed above should be there, too.

 

Does this code help?

0 Kudos
Message 4 of 15
(7,788 Views)

Hi Rory,

 

Thank you for your input.  Yes I did used the AVI save image called Grab and Save AVI VI.  I guessed you not quite clear with my question.  What I am trying to do is be able to capture image continously and put that image in array or buffing in memory so I can save it later.

 

For example if I am running a test VI, I want to capture the image contionously for certain period of time like 30 seconds and put that image in memory instead of saving the image live.  Then when the test VI is finished, it would be pass or fail test and that will allow me to determine to save image or disgard the image that is in buffer or in memory.

 

I hope this clear thing up a little.  Please let me know.

 

Thank you so much for the help.

 

Dan

0 Kudos
Message 5 of 15
(7,772 Views)

Hello Rory,

Queue is an array with first in first out mechanism which allow you to keep the images in the memory. To create queue, you would need to use Obtain Queue function with string name and image data type as input, the result is that you have a queue to put your image into. During each acquisition loop, you would need to create a new IMAQ image before enqueueing so that each images has it's own memory space.

Attached is an example that you can try to see as an example, in addition, LabVIEW example finder also have many queue examples.

 

Hope that this help you started.

 

Regards

- Meadow -
LabVIEW 7.0 - 2011, Vision, RT, FPGA
TestStand 3.0 - 4.5
0 Kudos
Message 6 of 15
(7,763 Views)

Oops, Meadow, I think you mean "Hello Dan/marlin12" Smiley Happy

 

I like the queue idea, though, and the example code looks to do exactly that.

0 Kudos
Message 7 of 15
(7,747 Views)
Solution
Accepted by topic author marlin12

Hi marlin12,

 

To add to the conversation, there is another example in the LabVIEW Example Finder related to creating a buffer.  It can be found in Hardware Input and Output>>IMAQdx>>Low-Level Grab.vi.  I hope this helps!

 

Kim

Applications Engineer
National Instruments
0 Kudos
Message 8 of 15
(7,741 Views)

Hi Rory, You are right!!

The message is intended for Dan/Marlin12.

 

Hi Dan, have you tried to use the code? Any feedback?

 

 

- Meadow -
LabVIEW 7.0 - 2011, Vision, RT, FPGA
TestStand 3.0 - 4.5
0 Kudos
Message 9 of 15
(7,688 Views)

Hello friend, I need help. That project you did with the web cam, I had completed it, you have? I need a program that takes photo web cam image and compare it to a standard.

0 Kudos
Message 10 of 15
(7,453 Views)