Matlab 无法再现视差贴图和点云

Matlab 无法再现视差贴图和点云,matlab,computer-vision,point-clouds,stereoscopy,disparity-mapping,Matlab,Computer Vision,Point Clouds,Stereoscopy,Disparity Mapping,我的立体图像对的点云输出似乎非常不准确和奇怪。我相信这可能是由于不正确的视差图造成的,因为与立体图像相比,视差图中的任何内容看起来都不清晰。我需要使用什么方法来获得正确的视差图和最终正确的点云 如果需要,我可以提供摄像机参数 % load stereo images and camera parameters load('stereoFrames.mat') load('stereoParameters.mat') % read stereo images frameLeft = stereo

我的立体图像对的点云输出似乎非常不准确和奇怪。我相信这可能是由于不正确的视差图造成的,因为与立体图像相比,视差图中的任何内容看起来都不清晰。我需要使用什么方法来获得正确的视差图和最终正确的点云

如果需要,我可以提供摄像机参数

% load stereo images and camera parameters
load('stereoFrames.mat')
load('stereoParameters.mat')

% read stereo images
frameLeft = stereoFrames{1};
frameRite = stereoFrames{2};

% undistort and rectify stereo images
frameLeftRect = undistortImage(frameLeft, stereoParameters.CameraParameters1);
frameRiteRect = undistortImage(frameRite, stereoParameters.CameraParameters2);
[frameLeftRect, frameRiteRect] = rectifyStereoImages(frameLeftRect, frameRiteRect, stereoParameters, 'OutputView', 'valid');
frameLeftGray = rgb2gray(frameLeftRect);
frameRiteGray = rgb2gray(frameRiteRect);

% obtain disparity map and point cloud
frameDisparity = disparity(frameLeftGray, frameRiteGray);
framePoints = reconstructScene(frameDisparity, stereoParameters);
pointCloud = pointCloud(framePoints);
左立体图像

右侧立体图像

视差图

点云


您是否校正了图像?如果没有,很明显,视差图将不准确。输入图像,参照与摄像机1对应的I1,以二维灰度指定。立体图像I1和I2必须进行校正,以使相应的点位于同一行上。您可以使用RectiveyStereoImages函数执行此校正。@John,正如您在代码中所看到的,在生成视差贴图之前,图像没有失真,并且也进行了校正。@John,校正的结果可能是由于错误的相机参数而不正确吗?我看到您正在校正frameLeftRect和frameRiteRect,然后在frameLeftGray和frameRiteGray上应用视差函数。视差图中的错误对齐表明(在我看来)存在校正问题。否则,与对象的距离相比,基线相对较高。@John我意识到我忘了包含
frameLeftGray
frameRiteGray
变量,我已经更新了代码。你所说的基线是什么意思?