Sign in to follow this  
agent007bond

Chroma Key plugin request (Automatic removal of colour)

Recommended Posts

Can anyone be kind enough to create a plugin that can do chromakey effects on an image or a selected part of an image?

Chroma key means removal of colour. Best example would be your favorite news channel's weather reporter. When the reporter is shot (camera) in the studio, he is standing in front of a green background (or blue). After chroma key processing it looks like he's standing in front of a dynamic weather report information screen.

A picture example would be this:

winchroma.png

Basically I should be able to remove the background colour (of my choice) and go back to the transparent version (top left) without losing shadow and translucency (partly transparent pixels at edges).

Share this post


Link to post
Share on other sites

So that's like replacing the color with another one or it being transparent? That would be nice, and it'll make things easier. But I think you can get a similar result with Conditional Hue/Saturation...

but it's limited.

Share this post


Link to post
Share on other sites

This plug-in would become very handy indeed. An example of its use is taking picture with a solid colour background and then being able to change to background of the picture without changing the foreground.

If anyone is willing to give the plug-in a try i would be willing to test it and experiment with it.

Geoff

Share this post


Link to post
Share on other sites
By any chance, would Boltbait's "Strip Primary Color" Plugin work for this purpose?

Nope, unless you used the Magic wand on the zrea which is the background, kind of killing the point of it.

Share this post


Link to post
Share on other sites

WHOA! 12 hours and this topic has turned into a major discussion!

PS: To get a better idea and a more detailed explanation about Chroma key, visit "Chroma key - Wikipedia".

~Everyone (All who replied)

Thanks a lot for your time :)

~Panhead

I saw the plug-in you're referring to, but I don't think it serves what I'm requesting for.

This allows you to import an image from a file and make it an alpha mask.
Now what does that mean?

EDIT: Yes, chroma key is mainly used in video, but even there, every video is made up of a series of photo frames (heard of fps?), so if a video goes through chroma key processing, every photo frame of it has to go through the processing one by one. This happens automatically at a high/real-time speed in live programs like a weather report. So I do believe the processing can be applied to a single photo frame, if it can be done to multiple photo frames in a video.

~Kristoff

Yes, it's about replacing a specific colour (all shades of it) while still maintaining the other colours. It's hard to explain, that's why I gave examples of the weather-man and the Windows logo. If you didn't notice, the logo has shadow in all the pictures, no matter what the background colour is.

~Geoff

Thanks for the heads-up and for volunteering :)

~ncfan51 (cc: Andrew D)

Strip Primary Colour, I don't think so. I've never tried that plug-in but as far as the name goes, I don't think it will work how I want it to. Moreover Andrew's reply seems to confirm it.

EDIT: I just tried the plug-in but it doesn't fulfil my request at all.

Alpha Mask, read my reply for Panhead above.

Thanks everybody once again.

Share this post


Link to post
Share on other sites

Based on the description of BoltBait's color removal plugin, it should work, but that's no guarantee that it does... I've never used it, nor have I looked at its algorithm. You can, however, probably use Alpha Mask Import, and if you're feeling particularly brave, Curves+ should do the trick as well.

Share this post


Link to post
Share on other sites
With the alpha mask plugin, you could make the mask and then use it, but that can be a major pain in the potato (e.g. hair)

Actually, here's what I think is probably the best solution: Use Curves+ to make the mask, then use Alpha Mask Import to apply it. The best of both worlds!

Share this post


Link to post
Share on other sites
Actually, here's what I think is probably the best solution: Use Curves+ to make the mask, then use Alpha Mask Import to apply it. The best of both worlds!

I got as far as correcting the transparency to remove the unneeded background using your suggested method, but the shadow remains a semi-transparent green or fuchsia. Any ideas?

Share this post


Link to post
Share on other sites

I appreciate that all of you are trying to come up with alternative solutions. However these alternative solutions of using already existing plugins in a twisted manner to emulate a chroma-key plugin does not guarantee the full potential of a would-be chroma-key plugin. If anyone understands fully how chroma-key works, he or she can work on a plug-in that would just do that!

Once again, I'm thankful for you all putting in efforts, and I'm appreciative of that. But I'm just putting in my two cents. :)

Share this post


Link to post
Share on other sites
I appreciate that all of you are trying to come up with alternative solutions. However these alternative solutions of using already existing plugins in a twisted manner to emulate a chroma-key plugin does not guarantee the full potential of a would-be chroma-key plugin. If anyone understands fully how chroma-key works, he or she can work on a plug-in that would just do that!

Once again, I'm thankful for you all putting in efforts, and I'm appreciative of that. But I'm just putting in my two cents. :)

I'm trying to come up with alternate solutions to help you out right now not because I don't want to write this as a plugin, but simply because I don't have the time right now. If another plugin author is willing to give it a shot...

Share this post


Link to post
Share on other sites
I appreciate that all of you are trying to come up with alternative solutions. However these alternative solutions of using already existing plugins in a twisted manner to emulate a chroma-key plugin does not guarantee the full potential of a would-be chroma-key plugin. If anyone understands fully how chroma-key works, he or she can work on a plug-in that would just do that!

Once again, I'm thankful for you all putting in efforts, and I'm appreciative of that. But I'm just putting in my two cents. :)

By finding a method that works when using standard tools, we can automate that into a plugin.

This process is not a waste of time.

Share this post


Link to post
Share on other sites
By finding a method that works when using standard tools, we can automate that into a plugin.

This process is not a waste of time.

So I've made some tests using Curves+. See screenshots below.

As you can see, in Advanced mode, using Hue as input and Alpha as output gives an almost fair result (finding correct hue in the curve is a bit tricky, though).

Problems:

- shadow isn't preserved at all

- edges aren't that smooth and retain some artifacts of background color

So, this is not a real solution, but I think it can be a good start.

In the third picture, I used another approach. With white background, I used Luminosity as input with a completely different curve.

(I know, white is never used as background for chroma-key. Take it just as an exercise :wink: )

See that shadow is preserved in this case, but it's fully opaque. Not what we want... :(

chromakeymagentakk9.png

chromakeygreenij3.png

chromakeywhitesn8.png

Note: if you think images are too big, I can replace them by thumbnails.

Share this post


Link to post
Share on other sites

As a coincidence, I have been developing similar plugin for some weeks.

You can try this "draft" version: Link

(it is not yet fine enough to be published in plugins section)

My basic idea for this plugin is to extract certain color range from image, by making surrounding pixels transparent. Hence the name Tone Picker.

"Invert" mode should give you the "chroma key" effect.

The plugin uses primary color to define it's default color range.

So: I recommend to use color picker tool *before* opening the plugin - to define your color of interest.

By default this plugin will extract pixels with hue P+-30, saturation P+-20, brightness P+-50 (P for primary color).

You can override the input parameters by moving hue, saturation and brightness controls.

Tolerance control makes selection more "rough" by ignoring fine details.

Please comment.

Share this post


Link to post
Share on other sites

Thanks for letting us in on this plug-in Tanel. You have made a significant advancement from what we have been doing before.

Just out of interest what more are you thinking (hoping) of adding to the plug-in in the future. Personally i would recommend incorporating the "Feather" plug-in"feather" plug-in from BoltBait or the "Anti-alias" plug-in from jsonchiu in future editions.

Geoff

Share this post


Link to post
Share on other sites
Just out of interest what more are you thinking (hoping) of adding to the plug-in in the future. Personally i would recommend incorporating the "Feather" plug-in"feather" plug-in from BoltBait or the "Anti-alias" plug-in from jsonchiu in future editions.

Geoff

Thx for feedback, Geoff.

I will definitely add Amount control for backround transparency.

Second I add Fade control for smooth alpha fall-off through hue/saturation/brightness channels.

But Feather seems to be tricky to implement. Because I already pre-render blur effect for Tolerance control. Maybe I figure out something. Final version has still long way to go.

Share this post


Link to post
Share on other sites
As a coincidence, I have been developing similar plugin for some weeks.

You can try this "draft" version: Link

(it is not yet fine enough to be published in plugins section)

Hi, Tanel, I've made some quick tests. Your plug-in looks really promising. Keep the work going!

I noticed, though, it doesn't keep shadows, just like the curves+ method I used above.

I his original post, agent007bond says:

Basically I should be able to remove the background colour (of my choice) and go back to the transparent version (top left) without losing shadow and translucency (partly transparent pixels at edges).

Do you think it's possible to implement this (without too much work, I mean)?

Share this post


Link to post
Share on other sites
As a coincidence, I have been developing similar plugin for some weeks.

You can try this "draft" version: Link

(it is not yet fine enough to be published in plugins section)

Hi, Tanel, I've made some quick tests. Your plug-in looks really promising. Keep the work going!

I noticed, though, it doesn't keep shadows, just like the curves+ method I used above.

I his original post, agent007bond says:

Basically I should be able to remove the background colour (of my choice) and go back to the transparent version (top left) without losing shadow and translucency (partly transparent pixels at edges).

Do you think it's possible to implement this (without too much work, I mean)?

It is possible, though would require a bit of work, seeeing how it's a complicated process.

Share this post


Link to post
Share on other sites
I noticed, though, it doesn't keep shadows, just like the curves+ method I used above.
'Tis no problem. Run either method for the best result without retention of shadow, duplicate the layer and run Drop Shadow with a colour of black, then either use Curves+ to adjust the alpha of the layer or decrease the layer opacity via its properties dialog. So:

- Pseudo-chroma key with the elimination of shadow;

- Duplicate layer;

- Run Drop Shadow with a colour of black;

- Use Curves+ to lower the layer transparency via Alpha mode, or;

  • - Lower layer opacity by Properties dialog.

Combination of a few techniques until something more substantial, or an actual chroma key plugin, comes along.

Share this post


Link to post
Share on other sites
...

I noticed, though, it doesn't keep shadows, just like the curves+ method I used above.

I his original post, agent007bond says:

Basically I should be able to remove the background colour (of my choice) and go back to the transparent version (top left) without losing shadow and translucency (partly transparent pixels at edges).

Do you think it's possible to implement this (without too much work, I mean)?

It is possible to keep shadows, by playing around with saturation and brightness limiters.

1728_bd98307964d527e89f5c79712626f318

But making the shadow semi-transparent is not yet possible (I'm adding Fade control for this).

In order to desaturate the shadow, you should use Conditional Hue/Saturation plugin.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this