I have a forum on which users often upload images with watermark of our competitors, I would like to search for the logo on the image and replace or cut it.
I know that ImageMagick has an option called subimage-search, but i had no luck with it
what I've tried so far:
compare -subimage-search logo.png sub.png similarity.png
compare -subimage-search -metric rmse large_image.png sub-image.png result.png
compare -subimage-search -metric pae large_image.png sub-image.png result.png
compare -subimage-search -metric ncc large_image.png sub-image.png result.png
ImageMagick: How to Search for sub image in a bigger image
-
- Posts: 3
- Joined: 2012-10-12T12:14:39-07:00
- Authentication code: 67789
Re: ImageMagick: How to Search for sub image in a bigger ima
I assume your competitors watermark their image for this reason.I have a forum on which users often upload images with watermark of our competitors, I would like to search for the logo on the image and replace or cut it.
If anything you should be removing the image rather than removing the watermark.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: ImageMagick: How to Search for sub image in a bigger ima
What version of IM and platform? -subimage-search was added at version 6.6.3-6
I have used successfully for quite some time now, the following syntax.
compare -metric rmse -subimage-search large_image.png sub-image.png result.png
That should produce two result.png images, -0 and -1. The second one will be the similarity image.
see
http://www.imagemagick.org/script/comma ... age-search
http://www.imagemagick.org/Usage/compare/
http://www.imagemagick.org/script/compare.php
viewtopic.php?f=1&t=14613&p=51076&hilit ... ric#p51076 (though current versions of IM now require the addition of -subimage-search)
Perhaps you should post links to your two images so others can test.
I have used successfully for quite some time now, the following syntax.
compare -metric rmse -subimage-search large_image.png sub-image.png result.png
That should produce two result.png images, -0 and -1. The second one will be the similarity image.
see
http://www.imagemagick.org/script/comma ... age-search
http://www.imagemagick.org/Usage/compare/
http://www.imagemagick.org/script/compare.php
viewtopic.php?f=1&t=14613&p=51076&hilit ... ric#p51076 (though current versions of IM now require the addition of -subimage-search)
Perhaps you should post links to your two images so others can test.
-
- Posts: 3
- Joined: 2012-10-12T12:14:39-07:00
- Authentication code: 67789
Re: ImageMagick: How to Search for sub image in a bigger ima
Thanks for replay.fmw42 wrote:What version of IM and platform? -subimage-search was added at version 6.6.3-6
I have used successfully for quite some time now, the following syntax.
compare -metric rmse -subimage-search large_image.png sub-image.png result.png
That should produce two result.png images, -0 and -1. The second one will be the similarity image.
see
http://www.imagemagick.org/script/comma ... age-search
http://www.imagemagick.org/Usage/compare/
http://www.imagemagick.org/script/compare.php
viewtopic.php?f=1&t=14613&p=51076&hilit ... ric#p51076 (though current versions of IM now require the addition of -subimage-search)
Perhaps you should post links to your two images so others can test.
I'm using:
Version: ImageMagick 6.7.7-10 2012-08-27 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
The images:
sub-image to search
image to replace with
results:
I can see the two results images, but i don't know how to move forward and replace with
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: ImageMagick: How to Search for sub image in a bigger ima
There should be some output to the terminal that tells you the rmse error, its values scaled to the range 0 to 1 (in parenthesis) and the x,y coordinates of the best match, all in that order. Use the x,y coordinates to composite the new image at the same x,y location.
convert image newsmallimage -geometry +X+Y -compose over -composite result
see
http://www.imagemagick.org/Usage/layers/#convert
convert image newsmallimage -geometry +X+Y -compose over -composite result
see
http://www.imagemagick.org/Usage/layers/#convert
-
- Posts: 3
- Joined: 2012-10-12T12:14:39-07:00
- Authentication code: 67789
Re: ImageMagick: How to Search for sub image in a bigger ima
Worked! Thanks a lot you are the man
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: ImageMagick: How to Search for sub image in a bigger ima
This I don't think can be classed as a watermark. It is probbaly better classed as SPAM advertising, and you just wanted to replace that spam with your own spam.
A true watermark would be very hard to locate and replace, as it is a distortion of the color values rather than a bold and obvious overlay. Direct sub-image searches of real watermarks would be very difficult.
And even in the frequency domain, it would probably be very hard to locate, though probably easier than for direct sub-image searches.
A true watermark would be very hard to locate and replace, as it is a distortion of the color values rather than a bold and obvious overlay. Direct sub-image searches of real watermarks would be very difficult.
And even in the frequency domain, it would probably be very hard to locate, though probably easier than for direct sub-image searches.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/