how to make the background of an image transparent?

I'm having a bird image with white background..and i need to make the background transparent so that i can add it to a block of the sky image naturally. Can anyone please help me to do it in Matlab..Thanks in advance..

댓글 수: 2

This might be related to this question or are you trying to take an image (say a png file), process it, and create a new image (also a png file)?
EDIT Moved answer to comments john-john said: how can we help or suggest you.. you didn't post your picture =)

댓글을 달려면 로그인하십시오.

답변 (2개)

Image Analyst
Image Analyst 2013년 1월 23일

0 개 추천

Extract color channels of each RGB image:
% Extract the individual red, green, and blue color channels.
redChannel = rgbBirdImage(:, :, 1);
greenChannel = rgbBirdImage(:, :, 2);
blueChannel = rgbBirdImage(:, :, 3);
skyRedChannel = rgbSkyImage(:, :, 1);
skyGreenChannel = rgbSkyImage(:, :, 2);
skyBlueChannel = rgbSkyImage(:, :, 3);
For each color channel, threshold
bird = greenChannel < threshold; % Create binary mask image.
Then do the replacement:
skyGreenChannel(bird) = greenChannel(bird); % Replace with bird pixels.
Then recombine:
compositeImage = cat(3, skyRedChannel, skyGreenChannel, skyBlueChannel);
Walter Roberson
Walter Roberson 2013년 1월 23일

0 개 추천

Create a logical array BirdMask that is true for pixels that you want to continue to show, and false for background pixels. Display the sky image first. Then
image(BirdImage, 'AlphaData', BirdMask)

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

질문:

2013년 1월 23일

댓글:

2015년 12월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by