Info

This question is closed. Reopen it to edit or answer.

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

1 view (last 30 days)
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 Comments
Sandro Lecci
Sandro Lecci on 18 May 2018
Hi Junaid,
on Line 2 you consider videoobject as a function, where the result of it will be stored in videoFileLeft. However, the function videoobject does not have any output argument. Might it be that after the while loop is completed you pass the videoplayer back to the main function (testing.....m)?
Please also paste the code in the question or as an attachment instead of screenshots. It makes it easy for us to handle it and modify it.
Best, Sandro
Junaid  Bashir
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 )
load('handshakeStereoParams.mat');
% creating video reader and video player
videoFileLeft = 'handshake_left.avi';
videoFileRight = 'handshake_right.avi';
readerLeft = vision.VideoFileReader(videoFileLeft, 'VideoOutputDataType', 'uint8');
readerRight = vision.VideoFileReader(videoFileRight, 'VideoOutputDataType', 'uint8');
player = vision.DeployableVideoPlayer('Location', [20, 400]);
frameLeft = readerLeft.step();
frameRight = readerRight.step();
when i try to use this videoobject function in introducing live feed the error says ""too many input arguments"", which is due to the reason as i explained earlier that there are more then one outputs and i am unable to identify and make a function for multiple outputs ....this is the part of the code where i am stuck , introducing a live feed instead of a recorded video for further processing . Kindly Help me , Thank you

Answers (0)

Community Treasure Hunt

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

Start Hunting!