Filter löschen
Filter löschen

Making image transparent for overlaying

4 Ansichten (letzte 30 Tage)
Shane
Shane am 28 Aug. 2013
Kommentiert: Image Analyst am 4 Mai 2020
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?

Antworten (1)

Walter Roberson
Walter Roberson am 28 Aug. 2013
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 Kommentar
Image Analyst
Image Analyst am 4 Mai 2020
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');

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Geometric Transformation and Image Registration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by