how to Isolate person from image and place it on a different background.

1 次查看(过去 30 天)
Hello, my problem is the following, i have images of people in front of a white background, people may be dressed whatever color they want. I have managed to isolate the person from the background i first converted the image into gray-scale, used threshold to isolate the person from the background, used some criteria to only the silhouette then used the command: originalImage(~silhouette) = 0; to get to the person silhouette isolated from the background. However i still have some problems and i need some help. I am not able to isolate the RGB silhouette neither am i able to place it on another background without ruining the background. Here are the results i am getting, i used images that i downloaded from the internet just to test. Any help would be appreciated. Thanks in advance.

回答(1 个)

Bshara Murr
Bshara Murr 2017-11-18
Hello again, i solved my problem, in case it is useful for anyone i will be explaining what i did here. The original problem was to cut a person's silhouette standing in front of a white background and place it in front of whatever background. What i did is the following. 1. I transformed the image into a gray-scale image. 2. Applied "threshold" to isolate the person from the white background and got a "binary image". 3. Filled the holes using imfill. 4. Put i condition that whenever a pixel has nonzero value on the binary image, i replaced a pixel from the background image by the corresponding pixel from the original image. Here is what i got. Of course the the position and the size ratios can be adjusted by the user.

Community Treasure Hunt

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

Start Hunting!

Translated by