画素ごとの透明度を設定する方法がありますか?

11 vues (au cours des 30 derniers jours)
MathWorks Support Team
MathWorks Support Team le 27 Sep 2016
サイズが同じで、グレースケールの画像Aを表示した上、カラーの画像Bを画素ごとの透明度を設定して、重ね表示する方法を教えてください。

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 27 Sep 2016
画像を表示する際に、「AlphaData」という透明度を設定するパラメータがありますので、このパラメータを利用すれば、画素ごとの透明度を設定した上の重ね表示が可能です。下記のサンプルコードをご参考ください。
- サンプルコード:
I=imread('cameraman.tif');
% グレースケール画像の表示
figure,image(I),truesize,colormap(gray(256))
J=imread('football.jpg');
J=J(:,1:256,:);
% カラー画像の表示
figure,image(J),truesize
figure,image(I),truesize,colormap(gray(256))
hold on
% AlphaDataパラメータの設定によって透明度の設定が可能です。
image(J,'AlphaData',0.5),truesize
hold off
figure,image(I),truesize,colormap(gray(256))
hold on
% AlphaDataパラメータに画像サイズと同じ大きさ(256×256)の行列(uint8データタイプ)を代入すれば、
% 行列の値により、ピクセル単位での透明度設定が可能です。
image(J,'AlphaData',I),truesize
hold off

Plus de réponses (0)

Catégories

En savoir plus sur インポート、エクスポートおよび変換 dans Help Center et File Exchange

Produits


Version

R2010b

Community Treasure Hunt

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

Start Hunting!