How to generate a circle within a digital image?

조회 수: 2 (최근 30일)
Marino Kosorcic
Marino Kosorcic 2019년 5월 3일
답변: KSSV 2019년 5월 3일
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.

채택된 답변

KSSV
KSSV 2019년 5월 3일
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')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by