make a box around a circle
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Mihael Rakic
le 27 Déc 2017
Réponse apportée : Mihael Rakic
le 28 Déc 2017
Hi, I have a code that detects a circle in the picture, but what I wan't is to make a rectangle that surrounds the circle. The code that I use is:
if true
function output_image = findCircels(Gevoeligheid,lijn,StraalMin,StraalMax)
output_image = lijn;
coder.extrinsic('imfindcircles');
[centers,radii] = imfindcircles(lijn,[StraalMin, StraalMax], 'ObjectPolarity','dark', 'Sensitivity',Gevoeligheid,'Method','twostage');
lijn = insertShape(lijn,'Circle',[centers radii],'LineWidth',5);
output_image=lijn;
end
Does anyone know how I can make this box around the circle and retract the coordinates of the edges of the rectangle?
0 commentaires
Réponse acceptée
Image Analyst
le 27 Déc 2017
Use the rectangle() function?
5 commentaires
Image Analyst
le 27 Déc 2017
So I guess the answer is "No, I did not look at the documentation for rectangle to see how they created a circle, and I did not pass anything in for curvature." So . . . why not? Here is the link to the documentation:
and here is the example:
pos = [2 4 2 2];
rectangle('Position',pos,'Curvature',[1 1])
axis equal
Also note that the Position variable is [xLeft, yTop, xWidth, yHeight], not the coordinates of the 4 corners or whatever you had.
You might need to call hold on to prevent the rectangle from blowing away any image or data already in your axes.
Also, state whether you want the circle burned into an image or if you just want it to be put into the overlay (like the rectangle function does).
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Computer Vision with Simulink dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!