views:

51

answers:

2

Hi, I need to develop a software that selects a face from a photo where the background is a plain color (green, like in the movies).

Then we want to compose that selection with another background image, this part is easy with many libraries. But I don't know how can I do the selection? Can you give some links or libraries to investigate? I can do this project with any language of my choose, so examples or links in any language are welcome.

+1  A: 

Ok, what you are trying to do is called chroma key. Like you say, it used a lot in the movies with a blue/green screen. On windows its actually pretty easy to do because its built into windows as part of GDI+ (or on C#, I think its just called the Graphics class).

I dont have any sample code handy, but the process is pretty straight forward:

With GDI+, you create a bitmap object of your foreground image (the one with the green background). Then create an ImageAttributes object. Use ImageAttribute's object's SetColorKey() method to specify a color or range of colors to use as the background color. Lastly, draw that bitmap object over the target bitmap, and GDI+ will draw it as if the background color is transparent.

There's more to it in that in code, but concept-wise thats all there is to it.

GrandmasterB
+1  A: 

This is probably an area where it is easier to work in some other space than RGB - such as HSV.

I would also look at the OpenCV library.

Martin Beckett