我想从返回的 SURF 点中提取 (x,y) 像素坐标,如 the example provided here using Matlab 中的示例.很明显,使用“ptsIn(1).Location”我可以返回点的 (x,y) 坐标。但是返回的点也包括一些小数点,例如 (102.9268, 51.7285)。有什么方法可以将其转换为图像平面中的像素位置,或者仅对这些值进行平均即可得出像素位置?谢谢。
最佳答案
为了进一步理解它,我尝试了以下代码 in this link .
% Extract SURF features
I = imread('cameraman.tif');
points = detectSURFFeatures(I);
[features, valid_points] = extractFeatures(I, points);
% Visualize 10 strongest SURF features, including their
% scales and orientation which were determined during the
% descriptor extraction process.
imshow(I); hold on;
strongestPoints = valid_points.selectStrongest(10);
strongestPoints.plot('showOrientation',true);
然后,在 Matlab 控制台中尝试命令 strongestPoints.Location
,它返回以下 (x,y) 坐标。
139.7482 95.9542 107.4502 232.0347 116.6112 138.2446 105.5152 172.1816 113.6975 48.7220 104.4210 75.7348 111.3914 154.4597 106.2879 175.2709 131.1298 98.3900 124.2933 64.4942
由于有一个坐标(107.4502 232.0347),我尝试将第232行标记为黑色(I(232,:)=0;
),看看它是否匹配232.0347中的y坐标SURF点,收到如下图。因此,似乎 SURF 点的四舍五入值给出了图像的 (x,y) 像素坐标。
关于Matlab SURF指向像素坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23421094/