2次元画像の中心に以下のコードのような円を描写したいのですが、どうすればよいでしょうか?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
%// radius
r = 2;
%// center
c = [3 3];
pos = [c-r 2*r 2*r];
rectangle('Position',pos,'Curvature',[1 1])
axis equal
0 Commenti
Risposta accettata
Kojiro Saito
il 24 Mag 2022
imshow で2 次元の画像表示をした後に、その座標軸(gca)に対してrectangle を実行すればできます。rectangle で画像の中心座標(width と height のそれぞれの半分)を指定します。
見やすくするために下記ではrを20にしています。
img = imread('peppers.png');
imshow(img)
r = 20;
%// center
c = [width(img)/2 height(img)/2];
pos = [c-r 2*r 2*r];
rectangle(gca, 'Position',pos,'Curvature',[1 1],'EdgeColor', 'r')
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox 入門 in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!