Matlab实现SURF算法总是报错!!求助

代码如下:

clc;clear all;close all;
tic;
% Read_object
obj = imread('E:\研究生文件\硕士论文\SURF\object_detection-master\yoyo_3.jpeg');
obj = rgb2gray(obj);
imshow(obj);
title('Object image');
% Read reference_image, from which to find/detect object
ref = imread('E:\研究生文件\硕士论文\SURF\object_detection-master\pic11.jpeg');
ref = rgb2gray(ref);
figure;
imshow(ref);
title('Reference image');
%%
%Detecting feature points from both images
%from object image
object_pts = detectSURFFeatures(obj);
%from refernce image
refr_pts = detectSURFFeatures(ref);
%Show 50 strongest feature points in object image
figure;
imshow(obj);
hold on
plot(selectStrongest(object_pts, 50));
%Show 100 strongest feature points in the reference image
figure;
imshow(ref);
hold on
plot(selectStrongest(refr_pts, 100));
%Extract feature descriptors from both object and refr image
[boxFeatures, boxPoints] = extractFeatures(obj, object_pts);
[sceneFeatures , scenePoints] = extractFeatures(ref, refr_pts);
%Matching features from object image and reference image
boxPairs = matchFeatures(boxFeatures, sceneFeatures);
%Display matched features.
matchedBoxPoints = boxPoints(boxPairs(:, 1), :);
matchedScenePoints = scenePoints(boxPairs(:, 2), :);
figure;
showMatchedFeatures(obj, ref, matchedBoxPoints, ...
    matchedScenePoints, 'montage');
title('Matched Points (Including Outliers)');
%Locating the object in the reference imagee using these matches.
[tform, inlierBoxPoints, inlierScenePoints] = ...
    estimateGeometricTransform(matchedBoxPoints, matchedScenePoints,...
    'affine');
%display feature matches after eliminating outliers
figure;
showMatchedFeatures(obj, ref, inlierBoxPoints, ...
    inlierScenePoints,'montage');
title('Matched Points (Inliers Only)');
%Get bounding rectangle of reference image
boxPolygon = [1, 1;... 
        size(obj, 2), 1;... 
        size(obj, 2), size(obj, 1);...
        1, size(obj, 1);... 
        1, 1]; 
%Transforming polygon into coordinate system of target image
newBoxPolygon = transformPointsForward(tform, boxPolygon);
%Display final detected object
figure;
imshow(ref);
hold on;
line(newBoxPolygon(:, 1), newBoxPolygon(:, 2), 'Color', 'r','Linewidth',5);
title('Detected Box');
toc;

报错总是提示:


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值