Clear Filters
Clear Filters

Is it possible to plot a SURFPoints or MSERRegions object using App Designer on UIAxes? Or any other Point Object?

4 views (last 30 days)
I can execute these series of commands outside of app designer:
image is an imported BW jpeg. uint8 class Executing the below lines in the Command Window work great.
fixedPoints = detectSURFFeatures(image);
hold on
However, executing these lines in the app designer results in an error:
imshow(image, 'Parent',app.UIAxes)% this works also with imshowpair or showMatchedFeatures
plot(app.UIAxes, fixedPoints); % unfortunately this results in an error:
Error using plot
Data must be numeric, datetime, duration, categorical, or an array convertible to double.
I am running this code using Matlab 2024a, Update 2, on an Apple M2 Max with Ventura 13.4.1.
Might anyone know how to fix this or maybe a workaround?

Accepted Answer

Pratyush Swain
Pratyush Swain on 21 May 2024
Hi Darral,
The error you're encountering in MATLAB App Designer when trying to plot "fixedPoints" (which are SURF feature points detected in an image) directly using plot on "app.UIAxes" is due to the fact that "fixedPoints" is not a set of numeric data, but rather an object of type "SURFPoints". The workaround for this is as follows:
% Detect SURF features - assuming app has a property "image"
fixedPoints = detectSURFFeatures(app.image);
% Extract the points locations by using the property - "Location"
pointsLocation = fixedPoints.Location;
% Extract "Scales" property to determine the size of circles which will be plotted
scales = fixedPoints.Scale;
% Plot the points
hold(app.UIAxes, 'on');
for i = 1:length(fixedPoints)
viscircles(app.UIAxes, pointsLocation(i,:), scales(i), 'Color', 'y','LineWidth', 0.25);
hold(app.UIAxes, 'off');
Instead of utilizing the "Location" property for a SURFPoints object , you can also leverage its "selectStrongest" object function to select points with strongest metrics. For more information please refer to following resources:
I have also implemented a very basic app designer app to showcase the working of surf points detection in appdesigner. It contains an axes component and two buttons( for loading image and detecting surf points).
I have attached the sample image and app designer file for your reference.
Hope this helps.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!