资源简介
老外写的NCC匹配算法,备注十分详细,通俗易懂,对新接触到双目视觉立体匹配的学生很有参考价值,还有SAD算法,
SSD算法我也从不同老外的要到了,如果需要的话,也可以去我的主页下载
代码片段和文件信息
% *************************************************************************
% title: Function-Compute Correlation between two images using the
% similarity measure of Normalized Cross Correlation (NCC) with Right Image
% as reference.
% Author: Siddhant Ahuja
% Created: May 2008
% Copyright Siddhant Ahuja 2008
% Inputs: Left Image (var: leftImage) Right Image (var: rightImage)
% Window Size (var: windowSize) Minimum Disparity (dispMin) Maximum
% Disparity (dispMax)
% Outputs: Disparity Map (var: dispMap) Time taken (var: timetaken)
% Example Usage of Function: [dispMap timetaken]=funcNCCR2L(‘StereogramLeft.jpg‘ ‘StereogramRight.jpg‘ 9 0 16);
% *************************************************************************
function [dispMap timetaken]=funcNCCR2L(leftImage rightImage windowSize dispMin dispMax)
try
% Grab the image information (metadata) of left image using the function imfinfo
leftImageInfo=imfinfo(leftImage);
% Since NCCR2L is applied on a grayscale image determine if the
% input left image is already in grayscale or color
if(getfield(leftImageInfo‘ColorType‘)==‘truecolor‘)
% Read an image using imread function convert from RGB color space to
% grayscale using rgb2gray function and assign it to variable leftImage
leftImage=rgb2gray(imread(leftImage));
% Convert the image from uint8 to double
leftImage=double(leftImage);
else if(getfield(leftImageInfo‘ColorType‘)==‘grayscale‘)
% If the image is already in grayscale then just read it.
leftImage=imread(leftImage);
% Convert the image from uint8 to double
leftImage=double(leftImage);
else
error(‘The Color Type of Left Image is not acceptable. Acceptable color types are truecolor or grayscale.‘);
end
end
catch
% if it is not an image but a variable
leftImage=leftImage;
end
try
% Grab the image information (metadata) of right image using the function imfinfo
rightImageInfo=imfinfo(rightImage);
% Since NCCR2L is applied on a grayscale image determine if the
% input right image is already in grayscale or color
if(getfield(rightImageInfo‘ColorType‘)==‘truecolor‘)
% Read an image using imread function convert from RGB color space to
% grayscale using rgb2gray function and assign it to variable rightImage
rightImage=rgb2gray(imread(rightImage));
% Convert the image from uint8 to double
rightImage=double(rightImage);
else if(getfield(rightImageInfo‘ColorType‘)==‘grayscale‘)
% If the image is already in grayscale then just read it.
rightImage=imread(rightImage);
% Convert the image from uint8 to double
rightImage=double(rightImage);
else
error(‘The Color Type of Right Image is not acceptable. Acceptable color types are truecolor or grayscale.‘);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5478 2016-03-17 19:33 NCC局域立体匹配算法tsukuba图像\funcNCCR2L.m
文件 70186 2016-03-17 17:16 NCC局域立体匹配算法tsukuba图像\tsukubaleft.jpg
文件 70064 2016-03-17 17:17 NCC局域立体匹配算法tsukuba图像\tsukubaright.jpg
文件 301 2016-03-28 10:00 NCC局域立体匹配算法tsukuba图像\使用说明.txt
目录 0 2016-03-28 10:21 NCC局域立体匹配算法tsukuba图像
----------- --------- ---------- ----- ----
146029 5
评论
共有 条评论