[英]How can I draw the rectangle including the surfPoints object on the image?
我有一個灰度圖像,我想使用 detectSURFFeatures() 提取感興趣的區域。 使用這個 function 我得到一個 surfPoints object。 通過在圖像上顯示此 object,我將圓圈作為感興趣的區域。 就我而言,我想要包含這些圓圈的矩形區域。 為了更清楚,我有一張圖片1:
我想使用:detectSURFFeatures() 提取感興趣區域(ROI),我們獲得圖像
如果你能看到我們有圓形區域,對於我來說,我想要包含圓形區域的矩形 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
object (即12.0
)的默認 Scale 屬性值的一半。 但由於文檔中沒有關於此的信息,我可能是錯的。 請注意,每個 ROI 的比例參數與SURFPoints
object 的比例屬性不同。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.