Info

# I am trying to introduce live feed in finding distance from a person using stereo vision in MATLAB

1 view (last 30 days)
Junaid Bashir on 18 May 2018
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello! my main goal is to find distance from a person using stereovision. now i went through this matlab example "https://www.mathworks.com/help/vision/examples/depth-estimation-from-stereo-video.html" what i am trying to do is to introduce live feed in this example so that i can find distance from a person in live feed using my cameras . . . i made functions for video input objects, and tried to use them in this example instead of recorded video files but the matlab gives following error
while function for videoobject is given below which works properly and defines a video input object
kindly help me in using the right syntax or coding for introducing this live feed video input objects as input to the code mentioned in matlab example (shown as a link above) so that instead of using a video file , i can use live feed for finding distance to a person
##### 2 CommentsShow 1 older commentHide 1 older comment
Junaid Bashir on 18 May 2018
Dear sir! here is the complete code for videoobject function, the thing is i understand that there are more then one outputs but i am unable to make a function for this type of code with more functions. whole code is given velow
function videoobject
a=webcam(2);
videoframe = snapshot(a);
framesize = size(videoframe);
videoplayer= vision.VideoPlayer('Position', [100 100 [framesize(2), framesize(1)]+30]);
runLoop = true;
FrameCount = 0;
while runLoop && FrameCount < 100
FrameCount = FrameCount + 1
videoframe = snapshot(a);
videoframe = rgb2gray(videoframe);
step(videoplayer, videoframe);
runLoop = isOpen(videoplayer);
end
end
dear sir i know the syntax and method and how to make a function with multiple inputs and outputs but in this case i am unable to understand, as when i try to use this function as a video object input for depth estimation code which is as follows (it is also an example of matlab in which as i mentioned earlier, trying to give live feed and find distance from a person )
% creating video reader and video player
videoFileLeft = 'handshake_left.avi';
videoFileRight = 'handshake_right.avi';
player = vision.DeployableVideoPlayer('Location', [20, 400]);