![](/img/trans.png)
[英]Matlab 2012a Mex to work with Xcode 4.5 on Mountain Lion
[英]Matlab 2012a Object Detection and Tracking doesn't work
. 我正在从事有关室内定位功能的论文项目,但在方面没有任何问题。 我正在使用MATLAB 2012a,但是某些代码功能无法正常工作,可能是由于该程序的版本过旧。 你能给我一些建议吗? and . 特别是和的功能存在问题。 这是错误消息:
类型为“ SURFPoints”的输入参数的未定义函数“ showMatchedFeatures”。
如何解决我的问题而不必下载新版本的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
`
谢谢您的帮助!
您可以检查计算机视觉工具箱,然后查看是否已安装。 因为SURF需要该工具箱。 也许我可以建议您使用SIFT代替Surf。 易于实现。 这是一个对您有用的链接。
这是教程链接
在Matlab中使用ver
命令检查已安装的工具箱
假设您已经安装了计算机视觉系统工具箱,则可以使用vision.GeometricTransformEstimator
对象而不是estimateGeometricTransform
函数。
至于showMatchedFeatures
,使用imshowpair
和plot
很容易实现。
话虽如此,自2012a以来,工具箱中已添加了许多很酷的功能,因此可能值得升级。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.