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

19 visualizaciones (últimos 30 días)
MathWorks Support Team
MathWorks Support Team el 27 de Sept. de 2016
Respondida: MathWorks Support Team el 27 de Sept. de 2016
サイズが同じで、グレースケールの画像Aを表示した上、カラーの画像Bを画素ごとの透明度を設定して、重ね表示する方法を教えてください。

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 27 de Sept. de 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

Más respuestas (0)

Categorías

Más información sobre インポート、エクスポートおよび変換 en Help Center y File Exchange.

Productos


Versión

R2010b

Community Treasure Hunt

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

Start Hunting!