How to generate a circle within a digital image?

3 vues (au cours des 30 derniers jours)
Marino Kosorcic
Marino Kosorcic le 3 Mai 2019
Réponse apportée : KSSV le 3 Mai 2019
Hi all,
I am working on a function H for generating a circle of radius R centered within an M-by-N digital image. The prompt suggests that I use imshow to visualize the image H for various values of R, M, and N. My issue is with generating the M-by-N digital image. I have been unable to find relevant documentation.
I am not familiar with the digital image processing capabilities of MATLAB and I am working on some exercises in anticipation for a digital image processing course. Any help would be greatly appreciated.

Réponse acceptée

KSSV
KSSV le 3 Mai 2019
I = imread('peppers.png') ;
[nx,ny,nz] = size(I) ;
C = [round(ny/2) round(nx/2)] ; % center of circle
R = 100 ; % Radius of circle
th = linspace(0,2*pi) ;
xc = C(1)+R*cos(th) ;
yc = C(2)+R*sin(th) ;
imshow(I)
hold on
plot(xc,yc,'b')

Plus de réponses (0)

Catégories

En savoir plus sur Images 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!

Translated by