我正在研究关于室内定位功能的论文项目,但我对物体检测和跟踪没有任何问题。我正在使用MATLAB 2012a,但代码的某些功能不起作用,可能是因为该程序的旧版本。 你能给我一些建议吗? 特别是我对 showMatchedFeatures 和 estimateGeometricTransform 的功能有疑问。 这是错误消息:
未定义函数'showMatchedFeatures'用于'SURFPoints'类型的输入参数。
如何在不下载新版Matlab的情况下解决我的问题?
这是代码:
`
boxImage = imread('img_box.png');
sceneImage = imread('img_desk.png');
I= rgb2gray (boxImage);
K= rgb2gray (sceneImage);
boxPoints = detectSURFFeatures(I)
scenePoints = detectSURFFeatures(K);
figure; imshow(I);
title('100 Strongest Feature Points from Box Image');
hold on;
plot(boxPoints.selectStrongest(100));
figure; imshow(K);
title('300 Strongest Feature Points from Scene Image');
hold on;
plot(scenePoints.selectStrongest(300));
[boxFeatures, boxPoints] = extractFeatures(I, boxPoints);
[sceneFeatures, scenePoints] = extractFeatures(K, scenePoints);
boxPairs = matchFeatures(boxFeatures, sceneFeatures);
matchedBoxPoints = boxPoints(boxPairs(:, 1), :);
matchedScenePoints = scenePoints(boxPairs(:, 2), :);
figure;
showMatchedFeatures(boxImage, sceneImage, matchedBoxPoints,matchedScenePoints, 'montage');
title('Putatively Matched Points (Including Outliers)');
[tform, inlierBoxPoints, inlierScenePoints] = ...
estimateGeometricTransform(matchedBoxPoints, matchedScenePoints, 'affine');
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
newBoxPolygon = transformPointsForward(tform, boxPolygon);
figure; imshow(sceneImage);
hold on;
line(newBoxPolygon(:, 1), newBoxPolygon(:, 2), 'Color', 'y');
title('Detected Box');
end
`
感谢您的帮助!
答案 0 :(得分:1)
您可以检查计算机视觉工具箱,看看它是否已安装。因为SURF需要那个工具箱。可能我建议你使用SIFT而不是Surf。它很容易实现。这是一个对您有用的链接。
This is a link where you can download the library
这是教程链接
This tutorial will help u more on how SIFT can be used
在matlab中使用ver
命令检查已安装的工具箱
答案 1 :(得分:1)
假设您安装了计算机视觉系统工具箱,您可以使用vision.GeometricTransformEstimator
对象而不是estimateGeometricTransform
功能。
至于showMatchedFeatures
,使用imshowpair
和plot
很容易实现。
话虽如此,自2012a以来,工具箱中添加了许多很酷的功能,因此升级可能是值得的。