Alphamap using Binary Mask
古いコメントを表示
Is it possible to make an alphamap for a figure based on its binary mask?
Here is a sample image and its binary:

I = imread('saturn.png');
a = im2bw(I, graythresh(I));
I want the regions in black to be made transparent and white regions to be opaque. So the only area visible is the image itself without the background.
Is this possible in Matlab? I couldn't find any information or examples in the documentation.
2 件のコメント
Image Analyst
2017 年 4 月 22 日
Do you mean that you want to create a PNG file with transparent pixels? If so, clarify which pixels are to be transparent - Saturn, or the space? Because when you say "the image itself", well, that is the entire image - both Saturn and the space. They're both part of the image.
Sordin
2017 年 4 月 23 日
採用された回答
その他の回答 (2 件)
KSSV
2017 年 4 月 22 日
I = imread('saturn.jpg') ;
I = rgb2gray(I) ;
I(I<50) = 255 ;
imshow(I)
Walter Roberson
2017 年 4 月 23 日
I = imread('saturn.png');
a = im2bw(I, graythresh(I));
image(I, 'alphadata', double(a) )
Alpha data needs to be between 0 and 1 (inclusive), so just double() the logical data to get suitable alpha data.
カテゴリ
ヘルプ センター および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!