real time image processing using matlab and stereo camera

9 次查看(过去 30 天)
how do i process each frame of a video feed coming from a pair of stereo camera in matlab in real time?
I have written this code
right = videoinput('winvideo', 1, 'MJPG_640x480');
right1 = getselectedsource(right);
right.FramesPerTrigger = 1;
preview(right);
left = videoinput('winvideo', 2, 'MJPG_640x480');
left2 = getselectedsource(left);
left.FramesPerTrigger = 1;
preview(left);
Thsi fucntion creates two new windows and acquires video from a pair of webcam(stereo) 1 frame by frame.Now how do i do image processing on each frame??
How do i extract each frame of the real time video ,process it and then show the out put in real time in an another video?
I basically want to compute the dispairty map in real time using my disparity algorithm.
So i wud be rectifying and calibrating the images first.
this is my fucntion for rectification and disparity map for a static image/frame
% % Read in the stereo pair of images.
% I1 = imread('leftxy.png');
% I2 = imread('rightxy.png');
function [J1,J2]=calibdisp(stereoParams)
% Rectify the images.
I1=imread('leftxy.png');
I2=imread('rightxy.png');
[J1, J2] = rectifyStereoImages(I1, I2, stereoParams);
% Display the images before rectification.
figure;
imshow(stereoAnaglyph(I1, I2), 'InitialMagnification', 50);
title('Before Rectification');
% Display the images after rectification.
figure;
imshow(stereoAnaglyph(J1, J2), 'InitialMagnification', 50);
title('After Rectification');
how do i apply the same code for each frame of the real time video???

回答(2 个)

Dima Lisin
Dima Lisin 2015-7-22
Use the getsnapshot method of videoinput to acquire the frame.
  3 个评论
Dima Lisin
Dima Lisin 2015-7-23
I am not sure exactly what you mean... Are you asking how to display the processed video? For that you should use vision.VideoPlayer or vision.DeployableVideoPlayer.

请先登录,再进行评论。


Thomas Dutrannois
Thomas Dutrannois 2018-6-13
How did you do to acquire both video ? Do they come from external cameras ? I'm trying to do such a thing but i don't know how to import video's in real time from mutiple cameras.

类别

Help CenterFile Exchange 中查找有关 Camera Calibration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by