Matlab 2012a目标检测与跟踪&x27;行不通
我正在写一篇关于室内定位特性的论文,但我在目标检测和跟踪方面没有问题。我使用的是Matlab2012A,但代码中的一些函数不起作用,可能是因为程序的旧版本。 你能给我一些建议吗? 特别是,我对showMatchedFeatures和estimateGeometricTransform的函数有问题。 这是错误消息: “SURFPoints”类型的输入参数的未定义函数“showMatchedFeatures” 如何在不下载新版Matlab的情况下解决问题 代码如下: ` `Matlab 2012a目标检测与跟踪&x27;行不通,matlab,feature-detection,feature-extraction,matlab-cvst,Matlab,Feature Detection,Feature Extraction,Matlab Cvst,我正在写一篇关于室内定位特性的论文,但我在目标检测和跟踪方面没有问题。我使用的是Matlab2012A,但代码中的一些函数不起作用,可能是因为程序的旧版本。 你能给我一些建议吗? 特别是,我对showMatchedFeatures和estimateGeometricTransform的函数有问题。 这是错误消息: “SURFPoints”类型的输入参数的未定义函数“showMatchedFeatures” 如何在不下载新版Matlab的情况下解决问题 代码如下: ` ` 谢谢你的帮助 您可以检查
谢谢你的帮助 您可以检查计算机视觉工具箱,看看它是否已安装。因为SURF需要那个工具箱。也许我可以建议你使用SIFT而不是Surf。它很容易实现。这里有一个对你有用的链接 这里是教程链接
在matlab中使用
ver
命令检查已安装的工具箱假设已安装计算机视觉系统工具箱,则可以使用Vision.GeometricTransformEstimator
对象而不是estimateGeometricTransform
函数
对于showmachedfeatures
,使用imshowpair
和plot
很容易实现
话虽如此,自2012年以来,工具箱中添加了许多很酷的功能,因此很值得升级。计算机视觉工具箱是否已安装并获得许可?
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