Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

image acquisition from 2 cameras simultaneously and writing into AVI

Hi,

 

I have a setup with two (externally triggered) synchronized Basler cameras which continuously acquires images and streams onto the front panel simultaneously. I am using the IMAQdx VI library.  The goal is to write an AVI from these continuous image acquisition. But I dont want to make 2 separate video files from the two cameras. Instead, I would like to overlay the streams vertically/horizontally in one video file. So, for output, I would like to have one AVI (or any other format) file which shows the video from both camera next to each other. 

 

Can anyone please help me or give some ideas how to achieve this? If my question is not clear, please don't hesitate to clarify. 

 

Best,

Arka

0 Kudos
Message 1 of 3
(2,867 Views)

You would have to do it in two steps.  First, combine the two images into a single image, then write that image to the AVI.

 

You can create a new image that is large enough to hold both images, then use IMAQ Image2Image 2 to insert each image into the larger image in the appropriate position.

 

Be aware that writing to AVI files is slow.  Unless you have a very low frame rate, the acquisition will get ahead of the AVI.  You need to either buffer a large number of images or do short acquisition runs.  You won't be able to write to an AVI over a long period of time if you write every image.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 3
(2,849 Views)

Hi Arkapal,

 

Bruce's advice is spot-on. In addition to his suggestions you might want to consider streaming your images to the hard disk as a binary file, as a step between combining the images and writing them to an AVI file. I've linked an example program below which demonstrates how to stream video to a binary file on your computer.

 

IMAQdx Stream Image to Disk Using Asynchronous TDMS

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

 

After you stream the data to disk, you can read it from the binary file and into an AVI file. This would allow you to use your hard disk instead of your RAM and may prevent issues with overusing memory. I hope this makes sense!

Austin
Staff Software Engineer
NI
0 Kudos
Message 3 of 3
(2,831 Views)