计算机视觉 | 使用MATLAB实现图像SURF特征的提取与匹配以及目标定位(代码类)
了解博主更多项目查看
github:https://github.com/MichaelBeechan
CSDN:https://blog.csdn.net/u011344545
====================================================================
%% Name:Michael Beechan
%% School:Chongqing University of Technology
%% Time:2018.12.11
%% Function:Extract image features
原图像:
%% read image
boxImage = imread('1.jpg');
boxImage = rgb2gray(boxImage);
%{
figure;
imshow(boxImage);
title('Image of a box');
%}
sceneImage = imread('2.jpg');
sceneImage = rgb2gray(sceneImage);
%{
figure;
imshow(sceneImage);
title('Image of cluttered scene');
%}
%% detect image feature points
boxPoints = detectSURFFeatures(boxImage);
scenePoints = detectSURFFeatures(sceneImage);
figure(1);
imshow(boxImage);
title('100 Feature Points');
hold on;
plot(selectStrongest(boxPoints, 100));
figure(2);
imshow(sceneImage);
title('300 Feature Points');
hold on;
plot(selectStrongest(scenePoints, 300));
%% Extract feature descriptor
[boxFeatures, boxPoints] = extractFeatures(boxImage, boxPoints);
[sceneFeatures, scenePoints] = extractFeatures(sceneImage, scenePoints);
%% find Putative point matches
boxPairs = matchFeatures(boxFeatures, sceneFeatures);
%% display matched features
matchedBoxPoints = boxPoints(boxPairs(:, 1), :);
matchedScenePoints = scenePoints(boxPairs(:, 2), :);
figure(3);
showMatchedFeatures(boxImage, sceneImage, matchedBoxPoints, matchedScenePoints, 'montage');
title('Putatively Matched Points(Including Outliers)');
%% Locate the Object in Scene Using Putative Matches
[tform, inlierBoxPoints, inlierScenePoints] = ...
estimateGeometricTransform(matchedBoxPoints, matchedScenePoints, 'affine');
figure(4);
showMatchedFeatures(boxImage, sceneImage, inlierBoxPoints, inlierScenePoints, 'montage');
title('Matched Points(Inliers Only)');
%% Get the bounding polygon(多边形)of the reference image
boxPolygon = [1, 1;... %top-left
size(boxImage, 2), 1;... %top-right
size(boxImage, 2), size(boxImage, 1);... %bottom-right
1, size(boxImage, 1);... %bottom-left
1, 1]; %top-left again to close the polygon
%% Transform the polygon into the coordinate system of the target image
%% The transformed polygon indicates the location of the object in scene
newBoxPolygon = transformPointsForward(tform, boxPolygon);
figure(5);
imshow(sceneImage);
hold on;
line(newBoxPolygon(:, 1), newBoxPolygon(:, 2), 'Color', 'y');
title('Detected Box');
- 利用SURF特征检测和FLANN最近邻算法实现图像的目标提取
- 计算机视觉 | Matlab实现单目视觉里程计基于SURF特征(代码类)
- 使用OpenCV3进行SURF特征提取和暴力匹配代码详解
- 图像边缘检测、角点特征检测以及SURF特征提取
- matlab实现彩色图像特征提取1
- OpenCV中feature2D学习——SIFT和SURF算子实现特征点提取与匹配
- 计算机视觉学习笔记:图像特征提取
- MATLAB GUI ,2,使用MATLAB的函数来实现MATLAB GUI,part 5,imshow绘图方式以及主辅图像缓存
- Opencv中使用Surf特征实现图像配准及对透视变换矩阵H的平移修正
- MATLAB图像处理与计算机视觉(3):实现Carsten Steger 的曲线检测算法(1)
- 利用RobHess源码实现SIFT算法及RANSAC去错的图像特征提取匹配及去除错匹配
- 在android 上,使用Opencv3.0实现图像无缝拼接,Fast查找特征点,BruteForce进行匹配
- 特征提取、匹配以及位姿计算(2D-2D)--参考视觉SLAM十四讲7.4
- Opencv下利用SIFT、SURF、ORB三种特征点实现图像匹配
- OpenCV中feature2D学习——SIFT和SURF算子实现特征点提取与匹配
- Matlab/OpenCV自己实现Harris特征点提取和匹配
- OpenCV3计算机视觉Python语言实现(三):使用OpenCV3处理图像
- 计算机视觉----图像底层特征提取之边缘提取(一)
- 计算机视觉----图像底层特征提取之边缘提取(一)
- Opencv下利用SIFT、SURF、ORB三种特征点实现图像匹配