viscircles function generates an error message

6 vues (au cours des 30 derniers jours)
John
John le 3 Juil 2024
Commenté : John le 3 Juil 2024
When I run the following code, the circles are detected but viscircles generates an error.
clear;
close all;
myImage = imread("washers.png");
G = im2gray(myImage);
fig1 = figure(1);
imshow(myImage);
[centers, radii] = imfindcircles(myImage, [10 150], 'ObjectPolarity', 'bright');
h = viscircles(centers, radii, Color='b');
Error Message -
Error using line
Too many input arguments.
Error in viscircles (line 43)
line(x,y,'Parent',h, ...
Error in ImageCircle (line 11)
h=viscircles(centers, radii,Color='b');

Réponses (1)

Steven Lord
Steven Lord le 3 Juil 2024
I'm guessing you've created your own line.m that's taking precedence over the line function that is part of MATLAB. To check this, show what this command displays:
which -all line
built-in (/MATLAB/toolbox/matlab/graphics/primitive/line)
If you see your own line.m, rename it.
  1 commentaire
John
John le 3 Juil 2024
Good catch! That was the problem.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Tags

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by