Image not able to detect SURF features

3 views (last 30 days)
Prayag Bhatia
Prayag Bhatia on 15 Feb 2019
Answered: Alok Nimrani on 21 Feb 2019
I have a image and I am trying to detect SURF features points on image. Instead of detecting features points , I am getting error as :
Operands to the || and && operators must be convertible to logical scalar values.
Error in vision.internal.FeaturePoints/plot (line 152)
if k==1 && ~wasHeld
Error in SURFPoints/plot (line 172)
h = plot@vision.internal.FeaturePoints(this, ...
Error in surf_features (line 31)
plot(selectStrongest(boxPoints, 50));
boxImage1 = imread('C:\Users\prayag\Desktop\images-capstone\gandhi_crop.jpg') ;
boxImage = rgb2gray(boxImage1) ;
boxPoints = detectSURFFeatures(boxImage);
figure;
imshow(boxImage);
title('50 Strongest Feature Points from Box Image');
hold on;
plot(selectStrongest(boxPoints, 50));
This is the code I am using.
and below is the image I am using.
gandhi_crop.jpg

Answers (1)

Alok Nimrani
Alok Nimrani on 21 Feb 2019
This error is seen if the operands being evaluated by the short-circuit || and && operators are empty or non-scalar arrays. If yes, please use the logical and (&), or (|) operators for those non-scalar operands.
One way to verify this could be to identify the line which is throwing this error. You can do so as folllows:
1) You can halt the execution of the code at the point when the error occurs by using the following command in MATLAB.
>> dbstop('if','error')
2) Once the above command is executed, execute the MATLAB script / function in the same command Window. For example
>> sample_script.m
3) Now the execution will halt at the line in the script which throws error. Please confirm if any of the operands used by || or && in this line is non-scalar (by checking the value of the operand variables in the MATLAB workspace).

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!