基于Matlab平台的视觉特征匹配与显示
来源:互联网 发布:安卓应用市场源码 编辑:程序博客网 时间:2024/05/19 03:43
clc; clear; close all; load colorImage3005; load colorImage3006; I11=colorImage3005; I22=colorImage3006;% extractFeatures 函数输入为灰度图像,因此要将RGB图像用函数 rgb2gray 进行转换image1= rgb2gray(I11);image2= rgb2gray(I22);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Surf 特征检测ptsImage1 = detectSURFFeatures(image1,'MetricThreshold',800,'NumOctaves',6);ptsImage2 = detectSURFFeatures(image2,'MetricThreshold',800,'NumOctaves',6);disp('SURF Features of Image1')size(ptsImage1)disp('SURF Features of Image2')size(ptsImage2)% Surf 特征提取[featuresOriginal,validptsImage1] = extractFeatures(image1,ptsImage1);[featuresDistorted,validptsImage2] = extractFeatures(image2,ptsImage2);% Surf 特征匹配index_pairs = matchFeatures(featuresOriginal,featuresDistorted,'MatchThreshold',1,'MaxRatio',1);matchedptsImage1 = validptsImage1(index_pairs(:,1));matchedptsImage2 = validptsImage2(index_pairs(:,2));%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% points1 = detectHarrisFeatures(image1);% points2 = detectHarrisFeatures(image2);% % [f1, vpts1] = extractFeatures(image1, points1);% [f2, vpts2] = extractFeatures(image2, points2);% % indexPairs = matchFeatures(f1, f2) ;% matchedptsImage1 = vpts1(indexPairs(1:20, 1));% matchedptsImage2 = vpts2(indexPairs(1:20, 2));% 显示有误匹配的情况figure;subplot(2,1,1)showMatchedFeatures_fgy(I11,I22,matchedptsImage1,matchedptsImage2,'montage');str=sprintf('Matched inlier points\n(including outliers)');title(str,'fontname','Times New Roman','FontSize',12);disp('Matched features without MLESAC')size(matchedptsImage1)% estimateGeometricTransform 函数 剔除误匹配 (MSAC算法)[tform,inlierptsImage2,inlierptsImage1] =estimateGeometricTransform(matchedptsImage2,matchedptsImage1,'similarity','Confidence',99,'MaxDistance',3);disp('Matched features with MLESAC')size(inlierptsImage2)% 显示没有误匹配的情况subplot(2,1,2)showMatchedFeatures_fgy(I11,I22,inlierptsImage1,inlierptsImage2,'montage');str=sprintf('Matched inlier points\n(excluding outliers)');title(str,'fontname','Times New Roman','FontSize',12);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 显示匹配图像(有一定间距) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% N 是两幅图像中间空出的像素距离N=500;I1=I11;I2=I22; I = zeros([size(I1,1) size(I1,2)*2+N size(I1,3)]); I(:,1:size(I1,2),:)=I1; I(:,size(I1,2)+1:size(I1,2)+size(I2,2)+N,:)=255; I(:,size(I1,2)+1+N:size(I1,2)+size(I2,2)+N,:)=I2; figure, imshow(I/255); hold on; n_matched_features=size(inlierptsImage1);% 显示匹配点for i=1:n_matched_features % 画点 % plot([inlierptsImage1.Location(i,1) inlierptsImage2.Location(i,1)+size(I1,2)+N],[inlierptsImage1.Location(i,2) inlierptsImage2.Location(i,2)],'o','Color','b') plot(inlierptsImage1.Location(i,1),inlierptsImage1.Location(i,2),'o','Color','b', 'MarkerSize',9,'LineWidth',1.5) plot(inlierptsImage2.Location(i,1)+size(I1,2)+N,inlierptsImage2.Location(i,2),'+','Color','g', 'MarkerSize',9,'LineWidth',1.5) % 画线 plot([inlierptsImage1.Location(i,1) inlierptsImage2.Location(i,1)+size(I1,2)+N],[inlierptsImage1.Location(i,2) inlierptsImage2.Location(i,2)],'-','Color','y','LineWidth',1.5) end
阅读全文
0 0
- 基于Matlab平台的视觉特征匹配与显示
- 基于Harris的特征检测与匹配
- Java基于OpenCV的Surf特征检测与匹配
- 基于SIFT点特征匹配的图像配准MATLAB程序
- 基于SIFT点特征匹配的图像配准MATLAB程序
- 基于SIFT点特征匹配的图像配准MATLAB程序
- 【计算机视觉】BRIEF特征匹配
- 基于高维视觉特征模型的目标图像检测与图像分割技术研究---论文摘录
- 计算机视觉-论文阅读笔记-基于高性能检测器与表观特征的多目标跟踪
- OpenCV-基于特征点的图像匹配
- 基于OpenCV的简单图片特征匹配
- 基于特征点匹配的车辆跟踪
- 基于opencv的特征点匹配法
- 基于特征匹配的摄像头姿态估计
- 特征点匹配应用——图像拼接的原理与基于OpenCV的实现
- 基于DSPC6678与FPGA协同处理的双目交汇视觉图像处理平台
- clfeak与matlab的匹配
- OpenCV-Python sift/surf特征匹配与显示
- 训练日记
- 敏捷开发
- 猜数字游戏
- VB学习1_vb基础知识和文件操作
- spring的属性注入和构造器注入
- 基于Matlab平台的视觉特征匹配与显示
- CS231n(7):线性分类笔记(上)
- 自动化测试流程学习整理
- 最近两周我们接触到的两种线上抓娃娃机的技术实现方案(一种RTSP/一种RTMP)
- HTTP请求头分类
- Tensorflow实现基于LSTM的文本分类方法
- Python--生成二维码
- CS231n(8):线性分类笔记(中)
- Apache服务(www服务器)