资源简介

MATLAB关于立体匹配,实现方法SAD SSD NCC CENSUS,适合初学者。

资源截图

代码片段和文件信息

%function StereoMatching()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This function consits of three methods for stereo matching (SADSSDNCC).
% Usage 
%       1. A input dialog will appear for setting Window Size. Set a
%          number bigger than 2 and click OK button.
%       2. Wait for some seconds. Then you can see the results of SAD SSD and
%          NCC stereo mathing in order.
%
%       You can also compare the results by changing window size ! 
%
%          InYeopJang(20082044) Dept.of Mechatronics GIST
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function StereoMatching
prompt = {‘Enter window size:‘};
dlg_title = ‘Input for setting window size‘;
num_lines = 1;
def = {‘9‘};

answer=inputdlg(promptdlg_titlenum_linesdef);
winSize = str2double(answer);

if(winSize>2)
    fprintf(1‘Loading Images....\n‘);
    imL=rgb2gray(imread(‘imL.png‘));
    imL=double(imL);
    imR=rgb2gray(imread(‘imR.png‘));
    imR=double(imR);
    %groundtruth=imread(‘disp2.pgm‘);
    %groundtruth=double(groundtruth);
   
    fprintf(1‘Now Processing SAD based Stereo Matching....\n‘);
    [dispMap_SAD]=StereoMatchingSAD(imLimRwinSize052);
    dispMap=dispMap_SAD;
    figure(‘Name‘‘SAD‘‘Numbertitle‘‘off‘);   imshow(dispMap[0 52]);
    %fprintf(1‘SAD RMSE : %f\n‘sqrt( (mean( dispMap)-groundtruth).^2));
    fprintf(1‘Now Processing SSD based Stereo Matching....\n‘);
    [dispMap_SSD]=StereoMatchingSSD(imLimRwinSize052);
    dispMap=dispMap_SSD;  
    figure(‘Name‘‘SSD‘‘Numbertitle‘‘off‘);   imshow(dispMap[0 52]);
    
    fprintf(1‘Now Processing NCC based Stereo Matching....\n‘);
    [dispMap_NCC]=StereoMatchingNCC(imLimRwinSize052);
    dispMap=dispMap_NCC;
    figure(‘Name‘‘NCC‘‘Numbertitle‘‘off‘);   imshow(dispMap[0 52]);
else
    fprintf(1‘\nYou must set window-size integer bigger than 2!!!!\n‘);
end

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      23826  2013-07-02 09:03  StereoMatching_SAD&SSD&NCC&Census\imL.jpg

     文件     342036  2005-06-21 12:35  StereoMatching_SAD&SSD&NCC&Census\imL.png

     文件      23826  2013-07-02 09:03  StereoMatching_SAD&SSD&NCC&Census\imR.jpg

     文件     343316  2005-06-21 12:35  StereoMatching_SAD&SSD&NCC&Census\imR.png

     文件       1968  2011-03-01 14:53  StereoMatching_SAD&SSD&NCC&Census\StereoMatching.m

     文件       2358  2018-09-09 20:01  StereoMatching_SAD&SSD&NCC&Census\StereoMatchingCensus.m

     文件       1699  2009-06-06 04:06  StereoMatching_SAD&SSD&NCC&Census\StereoMatchingNCC.m

     文件       1543  2009-06-06 01:52  StereoMatching_SAD&SSD&NCC&Census\StereoMatchingSAD.m

     文件       1406  2011-02-25 14:28  StereoMatching_SAD&SSD&NCC&Census\StereoMatchingSSD.m

     文件        537  2018-09-09 20:01  StereoMatching_SAD&SSD&NCC&Census\stereomatch_Census_Hamming.m

     目录          0  2018-09-09 20:00  StereoMatching_SAD&SSD&NCC&Census

----------- ---------  ---------- -----  ----

               742515                    11


评论

共有 条评论