Well, to make it simple,
I want to replace theyellow pattern that have a line over them in this image:
=> Pattern to replace:
with this one:
I'm not quite sure IF this is possible, however as no other tools exist to do this I'm betting my hope on ImageMagick so it will help me (once again).
Thanks in advance for awesome answers.
Replace pattern in image with other one
Replace pattern in image with other one
Version: ImageMagick-7.0.7-28-Q16-x64-static http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Replace pattern in image with other one
A compare with subimage-search will find the two locations, expressed as a "match score" image with brightest points (probably pure white in this case). The location of these brightest points are the coordinates to put the replacement image.
snibgo's IM pages: im.snibgo.com
Re: Replace pattern in image with other one
since I don't actually get the usage of those "bright points".
Mind posting an example ?
Mind posting an example ?
Version: ImageMagick-7.0.7-28-Q16-x64-static http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Replace pattern in image with other one
Windows script:
This outputs:
It has found a match at coords (39,37). In your script, paste the replacement at that position. Then repeat until the number in brackets is no longer (0).
Code: Select all
set SRC="22 HP+200.png"
set SUB=test.png
set REP="03 (yellow) +-Part.png"
"%IMG%compare" -metric RMSE %SRC% %SUB% -subimage-search found.png
Code: Select all
0 (0) @ 39,37
snibgo's IM pages: im.snibgo.com
Re: Replace pattern in image with other one
what would have to be added to this script so it will automatically repeat a paste till a match is no longer found ?
Version: ImageMagick-7.0.7-28-Q16-x64-static http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
Re: Replace pattern in image with other one
How can I modify the script to actually use these coordinates right now and paste the other images in ?
Version: ImageMagick-7.0.7-28-Q16-x64-static http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC