Reconstructing 3D from two stereo images

12 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 Point Cloud Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by