资源简介
基于动态规划的立体匹配代码-使用MATLAB实现。此代码已经将各个参数调试完毕,下载后可直接运行。在学习的道路上希望大家相互帮助。。。这是第一次上传代码,若大家喜欢的话在后期还会继续上传一些立体匹配的源代码,供大家学习与参考。
代码片段和文件信息
%A script that processes rectified stereo image pair to generate disparity map
%using dynamic programming
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Cox Ingemar J. Sunita L. Hingorani Satish B. Rao and Bruce M. Maggs.
%“A maximum likelihood stereo algorithm.“ Computer vision and image understanding 63
%no. 3 (1996): 542-567.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;
clearvars;
% close all;
I_1 = imread(‘_left.png‘); %Read Left Image
I_2 = imread(‘_right.png‘); %Read Right Image with same size as the Left
[nRow nColnChannel] = size(I_1);
if(nChannel==3)
I_1 = rgb2gray(I_1);
I_2 = rgb2gray(I_2);
end
I_1 = im2double(I_1);
I_2 = im2double(I_2);
figure;imshow(I_1);
figure;imshow(I_2);
C = zeros(nCol nCol);
M = ones(size(C));
displeft = zeros(nRow nCol);
dispright = zeros(nRow nCol);
occ = 0.0009; %Occlusion cost
for row = 1:nRow
% row %To display which row of the image is being processed
for i=2:nCol
C(i1) = i*occ;
end
for j = 2:nCol
C(1j) = j*occ;
end
for i = 2:nCol
for j = 2:nCol
temp = (I_1(rowi)-I_2(rowj))^2;
min1 = C(i-1j-1)+temp;
min2 = C(i-1j)+occ;
min3 = C(ij-1)+occ;
cmin = min([min1min2min3]);
C(ij) = cmin; % Cost Matrix
if(cmin==min1)
M(ij) = 1; %Path Tracker
elseif(cmin==min2)
M(ij) = 2;
elseif(cmin==min3)
M(ij) = 3;
end
end
end
i = nCol;
j = nCol;
while(i~=1 && j~=1)
switch M(ij)
case 1
displeft(rowi) = abs(i-j); % Disparity Image in Left Image coordinates
dispright(rowj) = abs(j-i); % Disparity Image in Right Image coordinates
j = j-1;
i = i-1;
case 2
displeft(rowi) = NaN;
i = i-1;
case 3
dispright(rowj) = NaN;
j = j-1;
end
end
clear C M
end
figure;imshow(displeft[0255]);
figure;imshow(dispright[0255]);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2171 2020-04-08 21:40 Dynamic_Programming_Stereo_Matching-master\Dynamic_programming_stereo_matching.m
文件 404 2017-10-03 17:28 Dynamic_Programming_Stereo_Matching-master\README.md
文件 358802 2017-10-03 17:28 Dynamic_Programming_Stereo_Matching-master\_left.png
文件 358496 2017-10-03 17:28 Dynamic_Programming_Stereo_Matching-master\_right.png
文件 18431 2018-11-09 22:03 Dynamic_Programming_Stereo_Matching-master\left.jpg
文件 18366 2018-11-09 22:03 Dynamic_Programming_Stereo_Matching-master\right.jpg
目录 0 2020-04-08 21:40 Dynamic_Programming_Stereo_Matching-master\
- 上一篇:matlab预测控制工具箱
- 下一篇:BPSK调制.ms11
相关资源
- matlab实现文件读写波形处理,小波变
- 标准差分进化算法多目标线性规划的
- 罚函数matlab实现
- Matlab实现Topsis算法
- matlab实现协作中继放大转发
- matlab实现最小二乘估计
- 基于MATLAB实现的采用混沌和小波相结
- 稀疏自编码深度学习的Matlab实现
- dijkstra算法的matlab实现
- matlab实现游程编码
- 边缘检测中的canny算法及其matlab实现
- Matlab实现音频降噪
- matlab实现导航卫星系统中计算多普勒
- 用matlab实现利用双MZI结构产生NRZ-OOK信
- matlab实现的区域增长和分水岭算法
- zw_u201113636-7467879-MATLAB实现.zip
- matlab实现的小波变换彩色图像水印嵌
- MATLAB实现GPS单点定位
- matlab实现图像边缘检测、图像分割、
- Serial Port Communication matlab实现的串口采
- BP Match 基于置信传播的立体匹配算法
- OFDM系统的matlab实现
- matlab实现的读取视频和音频
- matlab实现节点定位的三边定位算法
- CLAHE的matlab实现算法
- matlab实现加权最小二乘拟合
- MATLAB实现协同过滤算法
- 《神经模糊预测控制及其matlab实现》
- LBP特征提取的MATLAB实现
- matlab实现遗传算法 (Matlab Genetic Al
评论
共有 条评论