real time image processing using matlab and stereo camera
5 views (last 30 days)
Show older comments
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???
0 Comments
Answers (2)
Dima Lisin
on 22 Jul 2015
Use the getsnapshot method of videoinput to acquire the frame.
3 Comments
Dima Lisin
on 23 Jul 2015
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
on 13 Jun 2018
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.
0 Comments
See Also
Categories
Find more on Camera Calibration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!