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 Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by