Reconstructing 3D from two stereo images

조회 수: 7 (최근 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개)

카테고리

Help CenterFile Exchange에서 Display Point Clouds에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by