资源简介
基于sift算法的图像拼接matlab代码,经过测试,可以运行,对有重叠部分的图像进行拼接,效果不错
代码片段和文件信息
function [Him1_inliersim2_inliers] = ComputeH(im1_matches im2_matches nb_iter epsilon)
%
% ComputeH
% -> robust estimation of the homography using RANSAC
%
% function [Him1_inliersim2_inliers] = ComputeH(im1_matches im2_matches nb_iter epsilon)
%
% Input
% - im1_matches im2_points : points matching in the two images
% im2 = Him1
% - nb_iter : number of iterations for the RANSAC algorithm
%
% Output
% - H : computed homography
% @author: JB Fiot
% @Version: Nov08
nb_points = size(im1_matches1);
Best_nb_inliers = 0;
for iter=1:nb_iter
selected_points = [];
im1_inliers=[]; im2_inliers=[];
while size(unique(selected_points)1)~=4
selected_points = random(‘discrete uniform‘ nb_points [4 1]);
end
A=[];
for i=1:4
x1 = im1_matches(selected_points(i)1);
y1 = im1_matches(selected_points(i)2);
x2prime = im2_matches(selected_points(i)1);
y2prime = im2_matches(selected_points(i)2);
ax = [-x1-y1-1 000 x2prime*x1x2prime*y1x2prime];
ay = [000 -x1-y1-1 y2prime*x1y2prime*y1y2prime];
A = [A;ax;ay];
end
[USV] = svd(A);
h = V(:end);
H = reshape(h [33])‘;
H = H/H(33);
nb_inliers = 0;
for i=1:nb_points
Hi = H*[im1_matches(i1);im1_matches(i2);1];
% invHi=inv(H)*[im1_matches(i1);im1_matches(i2);1];
% if (Hi(3) ~= 0 && invHi(3)~=0)
% if ((Hi(1)/Hi(3)-im2_matches(i1))^2+(Hi(2)/Hi(3)-im2_matches(i2))^2+(invHi(1)/invHi(3)-im1_matches(i1))^2+(invHi(2)/invHi(3)-im1_matches(i2))^2) if Hi(3) ~= 0
if ((Hi(1)/Hi(3)-im2_matches(i1))^2+(Hi(2)/Hi(3)-im2_matches(i2))^2) nb_inliers = nb_inliers + 1;
im1_inliers = [im1_inliers;im1_matches(i:)];
im2_inliers = [im2_inliers;im2_matches(i:)];
end
end
end
if nb_inliers>Best_nb_inliers
Best_nb_inliers = nb_inliers;
Best_im1_inliers=im1_inliers;
Best_im2_inliers=im2_inliers;
end
end
im1_inliers=Best_im1_inliers;
im2_inliers=Best_im2_inliers;
%Re-estimation of the homographies with all inliers.
A=[];
for i=1:size(im1_inliers1)
x1 = im1_inliers(i1);
y1 = im1_inliers(i2);
x2prime = im2_inliers(i1);
y2prime = im2_inliers(i2);
ax = [-x1-y1-1 000 x2prime*x1x2prime*y1x2prime];
ay = [000 -x1-y1-1 y2prime*x1y2prime*y1y2prime];
A = [A;ax;ay];
end
[USV] = svd(A);
h = V(:end);
H = reshape(h [33])‘;
t=H(1:);
H(1:)=H(2:);
H(2:)=t;
t=H(:1);
H(:1)=H(:2);
H(:2)=t;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2990 2009-06-04 23:19 492216156 Image_stitching\acomputeH.m
文件 846 2009-06-04 23:19 492216156 Image_stitching\adist2.m
文件 1267 2009-06-04 23:19 492216156 Image_stitching\aGetDesc
文件 1171 2009-06-04 23:19 492216156 Image_stitching\aharris.m
文件 642 2009-06-04 23:19 492216156 Image_stitching\aLessHarrisPoints.m
文件 1306 2009-06-04 23:19 492216156 Image_stitching\aMatchDesc
文件 5762 2009-06-04 23:19 492216156 Image_stitching\aStitcher.m
文件 3001 2009-06-04 23:19 492216156 Image_stitching\avgg_warp_H.m
文件 30 2013-04-25 11:07 492216156 Image_stitching\read.txt
目录 0 2013-04-25 11:06 492216156 Image_stitching\data
目录 0 2013-04-25 11:07 492216156 Image_stitching
----------- --------- ---------- ----- ----
17015 11
- 上一篇:交流电机spwm调速
- 下一篇:检测ECG信号的R波
相关资源
- 基于Matlab的最大熵模糊图像复原算法
- KITTI雷达点云与图像数据融合matlab源码
- matlab 解码 NMEA0183格式GGA数据
- 一个有关飞机的模板匹配的跟踪的m
- 基于MATLAB的电弧模型仿真
- PRI信号分选
- Matlab论文:基于Matlab的二进制数字调
- 802.11协议吞吐量随节点数性能仿真
- matlab图片rgb转yuv,存.yuv文件 播放器
- Duda模式分类Pattern Classification MATLAB 代
- dijkstra算法的matlab实现31274
- 随机路径生成函数matlab
- matlab语音信号处理工具箱
- matlab2013激活文件
- matlab实现游程编码
- 暗通道先验+引导滤波MATLAB代码
- 边缘检测中的canny算法及其matlab实现
- 通过达曼光栅生成点阵的matlab程序.
- MATLAB核函数算法
- 求控制系统的性能指标MptrtsFAI,matl
- matlab 求DTFT
- 逆变器重复控制算法MATLAB仿真
- MATLAB R2014b 许可协议文件
- matlab读取comtrade格式的程序
- 基于Matlab的RC一阶电路仿真
- Las点云数据读取代码
- 雷达回波加天线方向图模拟程序
- MATLAB 2017b 安装文件及其破解文件百度
- Matlab实现音频降噪
- matlab实现导航卫星系统中计算多普勒
评论
共有 条评论