如何解决如何在图像上绘制包括surfPoints对象的矩形?
我有一个灰度图像,我想使用detectSURFFeatures()提取感兴趣的区域。使用此函数,我得到一个surfPoints对象。 通过在图像上显示该对象,我将圆圈作为感兴趣的区域。 就我而言,我想要包含这些圆的矩形区域。 更清楚地说,我有一张图片1:
我想使用:detectSURFFeatures()提取感兴趣区域(ROI),我们获得图像
如果您看到我们有一个圆形区域,那么我希望包含圆形区域的矩形投资回报率:
解决方法
半径似乎完全由points.Scale
参数确定。
% Detection of the SURF features:
I = imread('cameraman.tif');
points = detectSURFFeatures(I);
imshow(I); hold on;
% Select and plot the 10 strongest features
p = points.selectStrongest(10)
plot(p);
% Here we add the bounding box around the circle.
c = 6; % Correction factor for the radius
for ii = 1:10
x = p.Location(ii,1); % x coordinate of the circle's center
y = p.Location(ii,2); % y coordinate of the circle's center
r = p.Scale(ii); % Scale parameter
rectangle('Position',[x-r*c y-r*c 2*r*c 2*r*c],'EdgeColor','r')
end
我们得到以下结果:
在此示例中,半径的校正因子为6
。我猜想这个值对应于SURFPoints
对象(即12.0
)的默认Scale属性的一半。但是由于文档中没有关于此的信息,所以我可能是错的。而且要小心,每个ROI的比例 parameter 与SURFPoints
对象的比例 propertie 不同。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。