I'm trying to remove the noise that runs around the border on these polaroid images
I think the correct approach is to separate out each part of the image that is completely surrounded by only transparent background, then discard the small pieces which should leave us with just the larger image?
Remove noise surrounded by transparency
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Remove noise surrounded by transparency
There are two ways to approach it. First is to use -morphology open on the alpha channel. The second is to use -connected-components to remove small regions.
These both work on your first image for me with IM 6.9.10.11 Q16 Mac OSX Sierra. But you will likely have to change the value for octagon:X or area-threshold=X
__________________________
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620
If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli
For novices, see
http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
These both work on your first image for me with IM 6.9.10.11 Q16 Mac OSX Sierra. But you will likely have to change the value for octagon:X or area-threshold=X
Code: Select all
convert wrnTV0w.png -channel a -morphology open octagon:5 +channel result.png
Code: Select all
convert wrnTV0w.png \
\( +clone -alpha extract -type bilevel \
-define connected-components:area-threshold=1000 \
-define connected-components:mean-color=true \
-connected-components 4 \) \
-alpha off -compose copy_opacity -composite \
result2.png
__________________________
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620
If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli
For novices, see
http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown