简体   繁体   English

如何在图像上绘制包含 surfPoints object 的矩形?

[英]How can I draw the rectangle including the surfPoints object on the image?

I have a grayscale image I want to extract the regions of interest using detectSURFFeatures().我有一个灰度图像,我想使用 detectSURFFeatures() 提取感兴趣的区域。 Using this function I get a surfPoints object.使用这个 function 我得到一个 surfPoints object。 by displaying this object on the image I get circles as regions of interest.通过在图像上显示此 object,我将圆圈作为感兴趣的区域。 For my case I want the rectangular areas encompassing these circles.就我而言,我想要包含这些圆圈的矩形区域。 To be more clear i have a image 1:为了更清楚,我有一张图片1:

初始图像

I want to extract Region of Interest (ROI) using: detectSURFFeatures(), we obtain the image我想使用:detectSURFFeatures() 提取感兴趣区域(ROI),我们获得图像

检测后的图像

if you can see we have circular region, and for my case i want the rectangular ROI that contains the circular region:如果你能看到我们有圆形区域,对于我来说,我想要包含圆形区域的矩形 ROI:

期望的结果

It looks like the radius is fully determined by the points.Scale parameter.看起来半径完全由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

And we obtain the following result:我们得到以下结果:

在此处输入图像描述

In this example the correction factor for the radius is 6 .在这个例子中,半径的修正系数是6 I guess that this value correspond to half of the default Scale propertie's value of a SURFPoints object (which is 12.0 ).我猜这个值对应于SURFPoints object (即12.0 )的默认 Scale 属性值的一半。 But since there is no information about that in the documentation, I can be wrong.但由于文档中没有关于此的信息,我可能是错的。 And be carreful, the scale parameter of each ROI is not the same thing as the scale propertie of a SURFPoints object.请注意,每个 ROI 的比例参数SURFPoints object 的比例属性不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM