フィルターのクリア

Making image transparent for overlaying

5 ビュー (過去 30 日間)
Shane
Shane 2013 年 8 月 28 日
コメント済み: Image Analyst 2020 年 5 月 4 日
I have a couple of images that I am using the imregister function from the Image Processing Tool Box. I have it working great. However, in my two images, I have random spots of missing data. As a PNG, they are values of 0. I want to turn those 0 values into transparent images, so that when imregister overlays them correctly, I am essentially filling in the missing pixels from one image, with the filled pixels from the other.
I am searching for transparent images with MatLab, but I do not seem to be finding exactly what I need?

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 8 月 28 日
im1 = image(YourUnderlayImage);
overlaymask = YourOverlayImage ~= 0; %0 being the marker for missing
im2 = image(YourOverlayImage, 'AlphaData', overlaymask );
Underlay will then be visible where-ever Overlay was 0.
  1 件のコメント
Image Analyst
Image Analyst 2020 年 5 月 4 日
img = imread('peppers.png');
subplot(3, 1, 1);
image(img);
axis('on', 'image');
title('Original Image');
YourOverlayImage = rgb2gray(img) > 100;
subplot(3, 1, 2);
imshow(YourOverlayImage);
axis('on', 'image');
title('Overlay Image');
subplot(3, 1, 3);
overlaymask = YourOverlayImage ~= 0; % 0 being the marker for missing
im2 = image(YourOverlayImage, 'AlphaData', overlaymask );
axis('on', 'image');
title('Original + Overlay Image');

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by