Figの書き出しの時に不要な空白ができる
70 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
これは黒と白2値の画像に赤い楕円をプロットして書き出したものです. 元の画像には周囲に白い空白がなかったのに,printやsaveasで書き出すとこのように画像の周囲に白い余白が できてしまいます. 余白ができないようにするにはどうしたらよいのでしょうか?
0 commentaires
Réponse acceptée
Akiko
le 24 Juin 2016
imshow コマンドで画像を表示する際、Border プロパティを 'tight' に設定することで、この領域を予め非表示にすることができます。
以下、簡単なサンプルコードです。
I = rgb2gray(imread('peppers.png')); % サンプル画像の読み込み
imshow(I,'Border','tight') % 周囲に枠を表示しない
hold on
rectangle('Position',[50 100 50 100],'Curvature',[1 1],'EdgeColor',[1 0 0])
print -dpng test.png % PNG 形式で保存
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Convert Image Type dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!