Stuck on computer vision example
이전 댓글 표시
Hi I am trying to implement the computer vision example found on
and this is my code:
clear
clc
%%Step1: Read images
% Read reference Image containing the object to be recognised
boxImage = imread('stapleRemover.jpg');
%Convert image to 2D grayscale. Needed by detectSURFFeatures() function.
grayscaleboxImage = rgb2gray(boxImage);
figure; imshow(grayscaleboxImage);
title('Image of a box');
% Read the target image containing the cluttered scene
sceneImage = imread('clutteredImage.jpg');
%Convert image to 2D grayscale. Needed by detectSURFFeatures() function.
grayscaleSceneImage = rgb2gray(sceneImage);
figure; imshow(grayscaleSceneImage);
title('Image of a Cluttered Scene');
%%Step2: Detect Feature Points
%Detect feature points in both images
boxPoints = detectSURFFeatures(grayscaleboxImage);
scenePoints = detectSURFFeatures(grayscaleSceneImage);
% visualize the strongest feature points found in the reference image
figure; imshow(grayscaleboxImage);
title('100 strongest feature points from Box Image');
hold on;
plot(boxPoints.selectStrongest(100));
% visualize the strongest feature points found in the target image
figure; imshow(grayscaleSceneImage);
title('3000 stongest feature points from scene Image');
hold on;
plot(scenePoints.selectStrongest(300));
%%Step3: Extract feature descriptors
% xtract feature descriptors at the interest points in both images
[boxFeatures,boxPoints] = extractFeatures(grayscaleboxImage,boxPoints);
[sceneFeatures,scenePoints] = extractFeatures(grayscaleSceneImage,scenePoints);
%%Step4: Find Putative (assumed) Point Matches
%Match the features using their descriptors.
boxPairs = matchFeatures(boxFeatures,sceneFeatures);
%Display putatively matched features
matchedBoxPoints = boxPoints(boxPairs(:,1),:);
matchedScenePoints = scenePoints(boxPairs(:,2),:);
figure;
showMatchedFeatures(grayscaleboxImage,grayscaleSceneImage,matchedBoxPoints,matchedScenePoints,'montage');
title('Putatively Matched Points (Including Outliers)');
I get this error message:
Warning: Image is too big to fit on screen; displaying at 50%
> In imuitools\private\initSize at 72
In imshow at 259
In ComputerVisionExample at 20
Warning: Image is too big to fit on screen; displaying at 50%
> In imuitools\private\initSize at 72
In imshow at 259
In ComputerVisionExample at 35
Error using assert
Too many input arguments.
Error in cvstGetCoordsChoice (line 47)
assert(strncmp(clientName, 'fcn', 3) || ...
Error in extractFeatures (line 128)
isXY = cvstGetCoordsChoice('fcnExtractFeatures');
Error in ComputerVisionExample (line 43)
[boxFeatures,boxPoints] = extractFeatures(grayscaleboxImage,boxPoints);
I do not know where I went wrong. Can anyone help out?
답변 (1개)
Walter Roberson
2015년 7월 17일
0 개 추천
Checking around, it appears most probably that you have your own assert.m that is being used instead of the MATLAB assert.m . Please check with
which -all assert
and probably the first entry is something you have added to your MATLAB path.
카테고리
도움말 센터 및 File Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!