Borrar filtros
Borrar filtros

Making image transparent for overlaying

4 visualizaciones (últimos 30 días)
Shane
Shane el 28 de Ag. de 2013
Comentada: Image Analyst el 4 de Mayo de 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?

Respuestas (1)

Walter Roberson
Walter Roberson el 28 de Ag. de 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 comentario
Image Analyst
Image Analyst el 4 de Mayo de 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');

Iniciar sesión para comentar.

Categorías

Más información sobre Geometric Transformation and Image Registration en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by