Reconstructing 3D from two stereo images

6 ビュー (過去 30 日間)
Jenko Nguyen
Jenko Nguyen 2022 年 3 月 22 日
回答済み: Birju Patel 2022 年 4 月 27 日
I am trying to reconstruct 3D from two stereo grayscale images. The reason im using grayscale because it show vein's depth. But the disparity map and pointcloud doesn't show much information from images. Here the code
clc
clear all
close all
load('handshakeStereoParams.mat');
I1 = im2double(imread('back_left_10_n1.png'));
I2 = im2double(imread('back_right_10_n1.png'));
[G1, G2] = rectifyStereoImages((I1),(I2),stereoParams);
A = stereoAnaglyph(G1,G2);
figure
imshow(A)
title('Red-Cyan composite view of the rectified stereo pair image')
imshow(cat(3,A),'InitialMagnification',50);
disparityMap = disparity(im2gray(G1),im2gray(G2)) ;
figure
imshow(disparityMap,[0 64],'InitialMagnification',50);
title('Disparity Map');
colormap jet
colorbar
points3D = reconstructScene(disparityMap, stereoParams);
% Convert to meters and create a pointCloud object
points3D = points3D ./ 500;
ptCloud = pointCloud(points3D,"Intensity",G2);
% Create a streaming point cloud viewer
player3D = pcplayer([-1, 2], [-1, 2], [0, 4], 'VerticalAxis', 'y', ...
'VerticalAxisDir', 'down');
% Visualize the point cloud
view(player3D, ptCloud);

採用された回答

Birju Patel
Birju Patel 2022 年 4 月 27 日
Hi,
You will need to calibrate the stereo camera used to capture your images. In the code you posted, you're using calibration parameters from a specific stereo camera setup:
load('handshakeStereoParams.mat');
This won't match your setup and will return in meaningless disparity values.

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by