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

3 次查看(过去 30 天)
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);
figure;imshow(image);
hold on
plot(fixedPoints);
However, executing these lines in the app designer results in an error:
imshow(image, 'Parent',app.UIAxes)% this works also with imshowpair or showMatchedFeatures
hold(app.UIAxes,"on");
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?
Thanks

采纳的回答

Pratyush Swain
Pratyush Swain 2024-5-21
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);
end
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Computer Vision Toolbox 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by