How to generate a circle within a digital image?
조회 수: 2 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!