'Paste' a binary image onto a background image? (image blending)
1 次查看(过去 30 天)
显示 更早的评论
Project is to take a picture of myself, make it into a binary image (background around me all white, my body is completely black), then I have to pretty much paste that image onto a background. My goal is to create a function (x-y coordinates) that returns the first picture (me) on top of the second picture (the background). I have to choose a spot to place the picture of me also.
Can someone just give me pseudo code or something just so i have an idea of where to start/how to do it? I'm so lost :(
0 个评论
回答(1 个)
Image Analyst
2015-4-27
I don't understand. If the original picture is on top of the background, how can the background even be seen? Some part of your original picture must be transparent. If it's where the binary image is all white, then for a gray scale image, do
grayImage(binaryImage) = 255;
If you have a color image, then do it for every color channel.
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Multiply the mask by each color channel individually.
redChannel(mask) = 255;
greenChannel(mask) = 255;
blueChannel(mask) = 255;
% Recombine separate masked color channels into a single, true color RGB image.
maskedRgbImage = cat(3, redChannel, greenChannel, blueChannel);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!