Clear Filters
Clear Filters

Depth estimation from live video stream

3 views (last 30 days)
john john
john john on 9 Feb 2016
Answered: Brattv on 9 Feb 2016
I have two calibrated cameras and webcam support package and image acquisition toolbox. in this post depth is estimated from two recorded videos but my application is real-time and I want to estimate depth from live video stream. how can I do this ?
  3 Comments
john john
john john on 9 Feb 2016
@Vegard Brattland : thanks for your help. in this case it should estimate depth from live video stream .is snapshot() works for this case?
Brattv
Brattv on 9 Feb 2016
Edited: Brattv on 9 Feb 2016
The snapshot function should return images from both of your cameras. I have no idea if this will work but try
frameLeft = imageLeft;
frameRight = imageRight;
[frameLeftRect, frameRightRect] = ...
rectifyStereoImages(frameLeft, frameRight, stereoParams);
figure;
imshow(stereoAnaglyph(frameLeftRect, frameRightRect));
title('Rectified Video Frames');

Sign in to comment.

Answers (1)

Brattv
Brattv on 9 Feb 2016
Posting the discussion in the comment as answer. Feel free to chose it if it solved the problem
1. Call the function "gigecamlist" from the command window. This should return a model if your camera is GigE Vision compliant.
2. Create two camera objects with the "gigecam" function. Use the serial number that was found with the gigecamlist command to seperate them. The call should be something like
cameraLeft = gigecam('serialnumber')
cameraRight = gigecam('serialnumber')
3. Use the "snapshot" function to get the images.
[imageLeft tsLeft] = snapshot(cameraLeft)
[imageRight tsRight] = snapshot(cameraRight)
The snapshot function should return images from both of your cameras. I have no idea if this will work but try
frameLeft = imageLeft;
frameRight = imageRight;
[frameLeftRect, frameRightRect] = ...
rectifyStereoImages(frameLeft, frameRight, stereoParams);
figure;
imshow(stereoAnaglyph(frameLeftRect, frameRightRect));
title('Rectified Video Frames');

Community Treasure Hunt

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

Start Hunting!