Page 1 of 1

Green screen / chroma key

Posted: 2012-05-11T02:32:08-07:00
by sn0wball
Hello,

I'm trying to process the following image in order to remove the green screen background and replacing it with any another image:
http://img576.imageshack.us/img576/747/ ... sample.jpg

I have no influence on the quality of the green screen or the capture itself.

As I'm new to Imagick I ended up trying the command example from the docs, such as
- http://www.imagemagick.org/Usage/masking/#difference
- http://www.imagemagick.org/Usage/photos/#green_screen
- http://www.imagemagick.org/Usage/photos/#chroma_key

Also the usual -fx algorithms for green screening didn't work out for me:
http://www.multipole.org/discourse-serv ... 8b7#p74744

The results are far away from a usable mask which I would need in order to make an almost perfect cut-out.
Expected result (via Photoshop): http://img818.imageshack.us/img818/3960 ... result.jpg
Example background image: http://upload.wikimedia.org/wikipedia/c ... t_time.jpg

The processing will have to be done on multiple images with a similar green screen.

Any help or hint is appreciated.

Re: Green screen / chroma key

Posted: 2012-05-11T04:29:02-07:00
by Bonzo
Woops - nothing to add

Re: Green screen / chroma key

Posted: 2012-05-11T09:32:17-07:00
by fmw42
Can you tell us how PS does it? Not everyone has or uses PS! Is there some PS tutorial on the topic?

Re: Green screen / chroma key

Posted: 2012-05-11T10:00:55-07:00
by fmw42
try this. Adjust the fuzz value as desired.

convert greenscreensample.jpg -channel r -separate +channel -fuzz 1% -fill black -opaque black -fill white +opaque black greenscreensample_mask_1.gif

Then use

convert backgroundimage foregroundimage maskimage -compose over -composite resultimage

Re: Green screen / chroma key

Posted: 2012-05-14T05:55:27-07:00
by sn0wball
I use the technique used shown here http://www.youtube.com/watch?v=CpJ8E4sq ... re=related.
So Photoshop uses a mask as well, which is able to reduce noise of unclean green screen in the background.

Re: Green screen / chroma key

Posted: 2012-05-14T10:05:00-07:00
by fmw42
Once you have the mask, you can clean it up often times using -morphology open or close depending up white on black or black on white

see
http://www.imagemagick.org/Usage/morphology/

You can also feather the edges.

see
http://www.imagemagick.org/Usage/masking/#difference
http://www.fmwconcepts.com/imagemagick/ ... /index.php