资源简介
根据论文Accurate and Efficient Stereo Processing by Semi-Global Matching and Mutual Information写的双目立体匹配代码,matlab编写方便阅读,带测试图片,注意算法只实现了4个方向,即左右,右左,上下,下上四个方向。然后,互信息没有用到。测试结果可见效果不错,对于学习动态规划,立体匹配的同学有帮助
代码片段和文件信息
% Matlab demo code accompanying the CVPR11 paper [C. Rhemann A. Hosni
% M. Bleyer C. Rother M. Gelautz Fast Cost-Volume Filtering for Visual
% Correspondence and Beyond CVPR11]
% Contributed by Christoph Rhemann (rhemann@ims.tuwien.ac.at)
%
% Please note that the running time and results reported in the paper is from a CUDA
% implementation. Hence results and running times do not match this Matlab
% implementation.
UseParallelToolbox = false; % Set true if you want to take advantage of the Matlab parallel computing toolbox
ParallelWorkers = 4; % How many workers should be used by the parallel computing toolbox (should be equal or less the number of available CPU cores)
% Set up parallel computing toolbox
if (UseParallelToolbox)
isOpen = matlabpool(‘size‘) > 0;
if (isOpen)
matlabpool close force local
end
matlabpool(ParallelWorkers)
end
% Parameter settings
r = 129; % filter kernel in eq. (3) has size r \times r
eps = 0.0001; % \epsilon in eq. (3)
thresColor = 7/255; % \tau_1 in eq. (5)
thresGrad = 2/255; % \tau_2 in eq. (5)
% thresColor = 7; % \tau_1 in eq. (5)
% thresGrad = 2; % \tau_2 in eq. (5)
gamma = 0.11; % (1- \alpha) in eq. (5)
threshBorder = 3/255; % some threshold for border pixels
% threshBorder = 3; % some threshold for border pixels
gamma_c = 0.1; % \sigma_c in eq. (6)
gamma_d = 9; % \sigma_s in eq. (6)
r_median = 19; % filter kernel of weighted median in eq. (6) has size r_median \times r_median
% Compute disparity map for middlebury test images (vision.middlebury.edu/stereo/)
% for testimage = 1:4
testimage=1;
tic
% example_referenceForCVPR11(testimagerepsthresColorthresGradgammathreshBordergamma_cgamma_dr_medianUseParallelToolbox);
% v2myexample(testimagerepsthresColorthresGradgammathreshBordergamma_cgamma_dr_medianUseParallelToolbox);
v2semi(testimagerepsthresColorthresGradgammathreshBordergamma_cgamma_dr_medianUseParallelToolbox);
toc
% end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-06-14 20:42 SGM\img_stereo\
文件 513968 2010-07-21 11:46 SGM\img_stereo\art_left.ppm
文件 513968 2010-07-21 11:46 SGM\img_stereo\art_right.ppm
文件 506265 2010-07-20 10:08 SGM\img_stereo\cones_left.ppm
文件 506265 2010-07-20 10:08 SGM\img_stereo\cones_right.ppm
文件 506265 2003-06-04 23:11 SGM\img_stereo\im2.ppm
文件 506265 2014-12-10 15:26 SGM\img_stereo\im6.ppm
文件 331791 2010-07-20 09:27 SGM\img_stereo\left.ppm
文件 331791 2010-07-20 09:27 SGM\img_stereo\right.ppm
文件 702129 2013-09-17 17:16 SGM\img_stereo\Rum_000000.png
文件 506265 2010-07-20 10:02 SGM\img_stereo\teddy_left.ppm
文件 506265 2010-07-20 10:02 SGM\img_stereo\teddy_right.ppm
文件 738605 2013-09-17 17:07 SGM\img_stereo\um_000000.png
文件 498681 2010-07-21 11:46 SGM\img_stereo\venus_left.ppm
文件 498681 2010-07-21 11:46 SGM\img_stereo\venus_right.ppm
文件 162 2015-06-14 20:46 SGM\readme.txt
文件 2105 2015-06-13 23:06 SGM\runStereoMatcher.m
文件 17574 2015-06-13 23:14 SGM\v2semi.m
- 上一篇:图象纹理分割matlab源代码
- 下一篇:Simuli
nk发动机建模实战
评论
共有 条评论