MATLAB: Make a box around a circle

digital image processingimage processingmachine learningMATLABsimulinkvideo processing

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?

Best Answer

Use the rectangle() function?