Background Removal
Background Removal
Hi,
I am trying to remove the background of an semi-transparent object.
I am attaching the link.http://imageshack.us/photo/my-images/135/73869723.png/
I want to remove the green background and make the object look clear.
Thanks,
Madhu.
I am trying to remove the background of an semi-transparent object.
I am attaching the link.http://imageshack.us/photo/my-images/135/73869723.png/
I want to remove the green background and make the object look clear.
Thanks,
Madhu.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Background Removal
Semi-transparency removes of a single background color is actually not simple, and there is incomplete information.
For Perfect recovery you need teh same image on at least two different backgrounds
Background Removal using Two Backgrounds
http://www.imagemagick.org/Usage/maskin ... background
You can easily determine what is full transparency, but restoring the semi-transparent edges is something else.
The fact you have a border helps. and with that you may be able to use the following method
Recovering Semi-Transparent Edges
http://www.imagemagick.org/Usage/masking/#semi-trans
The technique you are refering too however is known as Chroma-Key Masking. And while I have not set up a speicific example of this (yet) it is very similar it what is shown in
Chroma Key Masking
http://www.imagemagick.org/Usage/photos/#chroma_key
More information on restoring semi-transparency effects (known as 'color spill') can be found on Wikipedia
http://en.wikipedia.org/wiki/Chroma_key
I would however like others to try and see what they can do, and hopefully from it we can create a full 'Green Screen Transparency' example.
For Perfect recovery you need teh same image on at least two different backgrounds
Background Removal using Two Backgrounds
http://www.imagemagick.org/Usage/maskin ... background
You can easily determine what is full transparency, but restoring the semi-transparent edges is something else.
The fact you have a border helps. and with that you may be able to use the following method
Recovering Semi-Transparent Edges
http://www.imagemagick.org/Usage/masking/#semi-trans
The technique you are refering too however is known as Chroma-Key Masking. And while I have not set up a speicific example of this (yet) it is very similar it what is shown in
Chroma Key Masking
http://www.imagemagick.org/Usage/photos/#chroma_key
More information on restoring semi-transparency effects (known as 'color spill') can be found on Wikipedia
http://en.wikipedia.org/wiki/Chroma_key
I would however like others to try and see what they can do, and hopefully from it we can create a full 'Green Screen Transparency' example.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Background Removal
Hi,
Thanks for the reply.
But I have one more doubt.I took the same pic in two different complement backgrounds but from some distance variation.
That is the distance from the camera and object is differing.
So, can I do the background subtraction of those two images. I am not sure,so can U make it clear.
That is the reason why I posted only one background link......
Thanks,
Madhu.
Thanks for the reply.
But I have one more doubt.I took the same pic in two different complement backgrounds but from some distance variation.
That is the distance from the camera and object is differing.
So, can I do the background subtraction of those two images. I am not sure,so can U make it clear.
That is the reason why I posted only one background link......
Thanks,
Madhu.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Background Removal
If the scale of the two images are different, i.e. the distance to the objects from the camera, then you would have to register (warp) the images so that there was a perfect 1:1 match of the two image geometries before you can do background subtraction. Such a perfect registration may be impossible to make.
Re: Background Removal
fmw42 wrote:If the scale of the two images are different, i.e. the distance to the objects from the camera, then you would have to register (warp) the images so that there was a perfect 1:1 match of the two image geometries before you can do background subtraction. Such a perfect registration may be impossible to make.
Can you please guide me to any tutorial about "warp" and the 1:1 perfect match
Thanks,
Madhu.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Background Removal
For background removal that would probably fail even with warping as the individual pixels must line up perfectly. Near enough is not good enough for this type of thing.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Background Removal
Thanks for the reply....
Is there any alternative for this?
Thanks,
Madhu.
Is there any alternative for this?
Thanks,
Madhu.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Background Removal
The alturnatives is as I have listed above.
There are techniques I have pointed to for recovering semi-transparent pixels.
There are techniques I have pointed to for recovering semi-transparent pixels.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Background Removal
Hi,
I have a doubt that is it possible to retain the fabric transparency only one background?
If possible please reply me ....
Thanks,
Madhu.
I have a doubt that is it possible to retain the fabric transparency only one background?
If possible please reply me ....
Thanks,
Madhu.
Re: Background Removal
Hi,
Is it possible to remove the background for this image.
http://imageshack.us/photo/my-images/35/matchnavy.gif/
The output should be http://imageshack.us/photo/my-images/40 ... vered.gif/
This output must be obtained from only single background removal.
Madhu.
Is it possible to remove the background for this image.
http://imageshack.us/photo/my-images/35/matchnavy.gif/
The output should be http://imageshack.us/photo/my-images/40 ... vered.gif/
This output must be obtained from only single background removal.
Madhu.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Background Removal
that result is shown at http://www.imagemagick.org/Usage/maskin ... background for one background color and is not as good a result as when two complementary background colors are use in the subsequent example.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Background Removal
That is the real problem. and it is the correct determination of the alpha channel value this is needed, to fully remove color spill.madhu wrote:Hi,
Is it possible to remove the background for this image.
http://imageshack.us/photo/my-images/35/matchnavy.gif/
The output should be http://imageshack.us/photo/my-images/40 ... vered.gif/
This output must be obtained from only single background removal.
Madhu.
One method that I detailed in teh raw notes of http://www.imagemagick.org/Usage/photos/#green_screen was to subtract the screen from either green or blue channel. using the formula...
a(r,b,g) => K0 * b − K1 * g + K2
modified for blue screen...
a(r,b,g) => K0 * g − K1 * b + K2
and constants (for darker blue)
a(r,b,g) => g − 2 * b + 1
Here is the result
Code: Select all
convert match_navy.gif -fx 'g-2*b+1' match_one_remove_alpha.png
Now applying it to remove the background color (as per two background color removal)
Code: Select all
convert match_navy.gif match_one_remove_alpha.png -alpha Off \
-fx "v==0 ? 0 : u/v - u.p{0,0}/v + u.p{0,0}" \
match_one_remove_alpha.png -compose Copy_Opacity -composite \
match_one_remove.png
The result is not perfect, as the dark blue seems to have caused yellows (negated blue) to become much more enhanced than they should have, but its is not too bad. more work is needed, probably works better with a bright green screen!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Background Removal
Hi!
Thanks for the reply...
It is working fine with the example what you have shown.
But it is not working with the other example.
I am posting the link for the other example http://imageshack.us/photo/my-images/811/62025428.png/
Is it possible to remove the background which is in green color and to get only the pink color object with out any background...
Thanks
Madhu
Thanks for the reply...
It is working fine with the example what you have shown.
But it is not working with the other example.
I am posting the link for the other example http://imageshack.us/photo/my-images/811/62025428.png/
Is it possible to remove the background which is in green color and to get only the pink color object with out any background...
Thanks
Madhu
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Background Removal
For this I would use the technique in....
Recovering semi-transparent edges
http://www.imagemagick.org/Usage/masking/#semi-trans
because there is a good thick well defined border between the background and the foreground.
Recovering semi-transparent edges
http://www.imagemagick.org/Usage/masking/#semi-trans
because there is a good thick well defined border between the background and the foreground.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Background Removal
From where this match_alpha.png has come fromIt is not great, but did work to some extent!Code: Select all
convert match_navy.gif -fx 'g-2*b+1' match_one_remove_alpha.png
Now applying it to remove the background color (as per two background color removal)Code: Select all
convert match_navy.gif match_one_remove_alpha.png -alpha Off \ -fx "v==0 ? 0 : u/v - u.p{0,0}/v + u.p{0,0}" \ match_one_remove_alpha.png -compose Copy_Opacity -composite \ match_one_remove.png
When I am executing this command it is showing error "match_alpha.png No such file exists"