필터 지우기
필터 지우기

Making image transparent for overlaying

조회 수: 4 (최근 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 CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by