基于SURF特征的目标检测

简介: 转战matlab了。步骤说一下:目标图obj 含目标的场景图scene载入图像分别检测SURF特征点分别提取SURF描述子,即特征向量用两个特征相互匹配利用匹配结果计算两者之间的transform关系tform根据obj位置与变换关系tform,在scene图上框出obj代码,来...

转战matlab了。步骤说一下:
目标图obj 含目标的场景图scene

  1. 载入图像
  2. 分别检测SURF特征点
  3. 分别提取SURF描述子,即特征向量
  4. 用两个特征相互匹配
  5. 利用匹配结果计算两者之间的transform关系tform
  6. 根据obj位置与变换关系tform,在scene图上框出obj

代码,来自matlab,http://localhost:9090/vision/gs/object-detection-and-tracking.html#btt5qyu

%step1:读取图片
%读取object图片
boxImage = imread('stapleRemover.jpg');
%读取场景图片
sceneImage = imread('clutteredDesk.jpg');

%step2:检测特征点
boxPoints = detectSURFFeatures(boxImage);
scenePoints = detectSURFFeatures(sceneImage);

% figure; imshow(boxImage);
% title('Box Image中最强的100个feature points');
% hold on;
% plot(boxPoints.selectStrongest(100));

%step3 extract feature descriptors  提取出特征的描述子
%使用extractFeatures(),具体的feature类型是通过boxPoints位置的参数指定的,这里是SURF
%烂设计,为什么extractFeatures输入了boxPoints后,还要返回boxPoints?
[boxFeatures, boxPoints] = extractFeatures(boxImage, boxPoints);
[sceneFeatures, scenePoints] = extractFeatures(sceneImage, scenePoints);

%step4 find putative point matches
%Match the features using their descriptors.
boxPairs = matchFeatures(boxFeatures, sceneFeatures);
%Display putatively matched features.
matchedBoxPoints = boxPoints(boxPairs(:,1), :);
matchedScenePoints = scenePoints(boxPairs(:,2),:);
figure;
showMatchedFeatures(boxImage, sceneImage, matchedBoxPoints, matchedScenePoints, 'montage');
title('Putatively Matched Points (Including Outliers)');

%step5 locate the Object in the Scene Using Putative Matches
[tform, inlierBoxPoints, inlierScenePoints] = ...
    estimateGeometricTransform(matchedBoxPoints, matchedScenePoints, 'affine');
figure;
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
%将多边形变换到目标图片上,变换的结果表示了物体的位置
newBoxPolygon = transformPointsForward(tform, boxPolygon);

%display the detected object 显示被检测到的物体
figure; imshow(sceneImage);
hold on;
line(newBoxPolygon(:, 1), newBoxPolygon(:, 2), 'Color', 'y');
title('Detected Box');
目录
相关文章
|
8月前
|
算法 Java 数据挖掘
使用MeanShift算法进行图像分割的实现
使用MeanShift算法进行图像分割的实现
|
8月前
|
机器学习/深度学习 算法 BI
图像处理之HOG特征提取
图像处理之HOG特征提取
228 0
|
算法 计算机视觉
图像特征提取--ORB算法
图像特征提取--ORB算法
136 0
|
传感器 机器学习/深度学习 Ubuntu
【论文解读】F-PointNet 使用RGB图像和Depth点云深度 数据的3D目标检测
​F-PointNet 提出了直接处理点云数据的方案,但这种方式面临着挑战,比如:如何有效地在三维空间中定位目标的可能位置,即如何产生 3D 候选框,假如全局搜索将会耗费大量算力与时间。 F-PointNet是在进行点云处理之前,先使用图像信息得到一些先验搜索范围,这样既能提高效率,又能增加准确率。 论文地址:Frustum PointNets for 3D Object Detection from RGB-D Data  开源代码:https://github.com/charlesq34/frustum-pointnets
1005 0
|
机器学习/深度学习 算法 BI
图像处理HOG特征提取
简要介绍hog特征提取的原理和python代码实现。
150 0
|
机器学习/深度学习 传感器 算法
【图像分割】基于局部空间信息直方图模糊聚类FGFCM 实现图像图像分割附matlab代码
【图像分割】基于局部空间信息直方图模糊聚类FGFCM 实现图像图像分割附matlab代码
|
资源调度 算法 机器人
图像特征提取与描述_角点特征02:SIFT算法+SURF算法
前面两节我们介绍了Harris和Shi-Tomasi角点检测算法,这两种算法具有旋转不变性,但不具有尺度不变性,以下图为例,在左侧小图中可以检测到角点,但是图像被放大后,在使用同样的窗口,就检测不到角点了。
267 0
|
机器学习/深度学习 存储 算法
图像特征提取与描述_角点特征03:Fast算法+ORB算法
我们前面已经介绍过几个特征检测器,它们的效果都很好,特别是SIFT和SURF算法,但是从实时处理的角度来看,效率还是太低了。为了解决这个问题,Edward Rosten和Tom Drummond在2006年提出了FAST算法,并在2010年对其进行了修正。
690 0
|
算法 API 计算机视觉
图像特征提取与描述_角点特征01:Harris算法+Shi-Tomas算法
Harris角点检测的思想是通过图像的局部的小窗口观察图像,角点的特征是窗口沿任意方向移动都会导致图像灰度的明显变化
235 0
|
机器学习/深度学习 监控 算法
YOLOv7姿态估计pose estimation(姿态估计+目标检测+跟踪)
YOLOv7姿态估计pose estimation(姿态估计+目标检测+跟踪)