Расчет карты диспаратности с использованием Matlab Могу ли я переключиться на нужную камеру, чтобы получить расстояние от нее? - PullRequest
0 голосов
/ 29 августа 2018

Я следовал инструкции от Mathworks https://www.mathworks.com/help/vision/ug/reconstruct-3-d-scene-from-disparity-map.html?searchHighlight=disparity&s_tid=doc_srchtitle

Код от URL выглядит следующим образом:

# Load the stereo parameters.
load('webcamsSceneReconstruction.mat');

# Read in the stereo pair of images.
I1 = imread('sceneReconstructionLeft.jpg');
I2 = imread('sceneReconstructionRight.jpg');

# Rectify the images.
[J1, J2] = rectifyStereoImages(I1,I2,stereoParams);

# Display the images after rectification.
figure 
imshow(cat(3,J1(:,:,1),J2(:,:,2:3)),'InitialMagnification',50);

# Compute the disparity.
disparityMap = disparity(rgb2gray(J1), rgb2gray(J2));
figure 
imshow(disparityMap,[0,64],'InitialMagnification',50);

# Reconstruct the 3-D world coordinates of points corresponding to each 
pixel from the disparity map.
xyzPoints = reconstructScene(disparityMap,stereoParams);

# Segment out a person located between 3.2 and 3.7 meters away from the 
camera.
Z = xyzPoints(:,:,3);
mask = repmat(Z > 3200 & Z < 3700,[1,1,3]);
J1(~mask) = 0;
imshow(J1,'InitialMagnification',50);

Когда я вычисляю глубину, кажется, что она рассчитывается от основной (левой) камеры. У меня вопрос, а что если я хочу рассчитать расстояние от второй (правой) камеры? Какую часть скрипта мне нужно изменить?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...