Can I use the Image Acquisition Toolbox to write to disk with two video sources and two output files at the same time?

4 views (last 30 days)
I have two winvideo adapters and I'm using videoinput to create two video objects. I can use DiskLogger to save my frame data to avi files (I used the DiskLog demo from help).
I can successfully save to disk from my two adapters sequentially but I would like to do so simultaneously. When I try to start the acquisition of the second and the first is still going, I get an error saying the device is not accessible. Here is a code snippet of how I'm doing it:
adaptorName1 = 'winvideo';
deviceID1 = 1;
vidFormat1 = 'I420_640x480';
vidObj1 = videoinput(adaptorName1, deviceID1, vidFormat1);
set(vidObj1, 'LoggingMode', 'disk&memory');
logfile1 = avifile('data1.avi');
logfile1.Compression = 'None';
logfile1.Colormap = gray(256);
vidObj1.DiskLogger = logfile1;
start(vidObj1);
wait(vidObj1, 5);
f1 = close(vidObj1.Disklogger);
delete(vidObj1);
clear vidObj1;
In this code I have the acquisition from one source and I was hoping to be able to do two at the same time. Is there a way to write to disk from two video objects at the same time?

Answers (1)

David Tarkowski
David Tarkowski on 21 Nov 2013
If I understand your question properly, the problem doesn't seem to be with the disk logging, but with starting the acquisition.
When you try to start the second device, are you using a different device ID? If you are using device ID 1 for both videoinput objects.
If you are using different device IDs for each videoinput object, it still might not work. In theory it should work, but I've found that some camera drivers do not allow it. Are you able to start two videoinput objects when they are configured to log to memory?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!