I'm working on my thesis project on indoor localization features but I have no problems with regard to object detection and tracking . I am using MATLAB 2012a, but some functions of the code do not work, probably because of the old version of the program. Could you give me some advice? In particular I have problems with the functions of showMatchedFeatures and estimateGeometricTransform . This is the error message:
Undefined function 'showMatchedFeatures' for input arguments of type 'SURFPoints'.
How can I solve my problem without having to download the new version of Matlab?
This is the code:
`
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
`
Thank you for your help!
You can check the computer vision toolbox and see whether it is installed or not. Because SURF needs that toolbox. Probably I can suggest u to use SIFT instead of Surf. It is easy to implement. Here is a link that will be useful for you.
This is a link where you can download the library
Here is the tutorial link
This tutorial will help u more on how SIFT can be used
Use ver
command in matlab to check for the installed toolboxes
Assuming that you have the Computer Vision System Toolbox installed you can use the vision.GeometricTransformEstimator
object instead of the estimateGeometricTransform
function.
As for showMatchedFeatures
, it is easy to implement using imshowpair
and plot
.
Having said that, lots of cool functions have been added to the toolbox since 2012a, so it may well be worth to upgrade.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.