Search code examples
matlabcomputer-visionmatlab-cvst

Matlab detectSURFFeatures() error: "Expected input number 1, I, to be two-dimensional."


I'm following Matlab > Help guide "Object Detection in a Cluttered Scene Using Point Feature Matching" and detectSURFFeatures() gets error because it expects a 2-dimensional input argument. .png doesn't work either.

boxImage = imread('C:\WORK\images for feature matching\iPhone6p_back_clean.JPG');

boxPoints = detectSURFFeatures( boxImage );

Error using detectSURFFeatures Expected input number 1, I, to be two-dimensional.

Error in detectSURFFeatures>checkImage (line 124) validateattributes(I,{'logical', 'uint8', 'int16', 'uint16', ...

Error in detectSURFFeatures (line 81) checkImage(I);


Solution

  • Here's the fix:

    boxPoints = detectSURFFeatures( rgb2gray( boxImage ));