The first way we thought about is to use the Matlab image acquisition tool box. (use imaqtool to call the toolbox)
It provides pretty good results for a single camera. But our demand is to get two images from the two cameras at the same time.
So I write a simple script to capture the images synchronously.
// Get the videoinput object:
cam1 = videoinput('dcam', 1, 'Y422_800x600');
cam2 = videoinput('dcam', 2, 'Y422_800x600');
// Change the camera property:
src = getselectedsource(cam1);
set(src, 'AutoExposure', 80);
// ... a lot of properties adjustments here...
// start capturing:
preview(cam1);
preview(cam2);
index = 1;
while 1
key = input('x = exit acquisition, enter = acquire a pair of frame', 's');
if key == 'x'
break;
else
im1 = getsnapshot(cam1);
im2 = getsnapshot(cam2);
im1 = ycbcr2rgb(im1);
im2 = ycbcr2rgb(im2);
img_pair = {im1, im2};
img_pairs{index} = img_pair;
index = index + 1;
end
end
stoppreview(cam1);
stoppreview(cam2);
closepreview(cam1);
closepreview(cam2);
this code get the keyboard as input, it gets every frame once I clicked enter end exits when I hit 'x'.
If I want get continues frames as videos, I can simply comment the "keyboard input" line and let it acquire images every frame.

No comments:
Post a Comment