How to superimpose images?

2 ビュー (過去 30 日間)
Jhangir
Jhangir 2013 年 10 月 9 日
回答済み: Image Analyst 2013 年 10 月 10 日
I have an image with a person in front of a green screen, I took away the green screen by finding values larger than 254 in the second matrix ( the green matrix) and that was done by AA=254<C Then I did
R(AA)=255;
G(AA)=255;
B(AA)=255;
R is the red values G is the green values and B is the blue values. BB is my matrix of 1s and 0s, 1s are the values which are larger than 254. These values are than replaced with 255 and then when I display the image I get the person in fron of a white screen. Now how do I replace the white screen with a jpg file that I have. The pixel lengths are the same so there is no reason to resize.

回答 (2 件)

Ashish Uthama
Ashish Uthama 2013 年 10 月 10 日
Give imfuse a try.

Image Analyst
Image Analyst 2013 年 10 月 10 日
jpegImage = imread(jpegFileName);
AA = ...... what you did.
jR = jpegImage(:,:,1);
jG = jpegImage(:,:,2);
jB = jpegImage(:,:,3);
% Replace by jpeg image
R(AA) = jR(AA);
G(AA) = jG(AA);
B(AA) = jB(AA);
% Concatenate to form full color RGB image
newRGB = cat(3, R, G, B);

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by