Page 2 of 2

Re: how i could make better this command for detect a transparent watermark?

Posted: 2017-03-09T18:50:40-07:00
by diegomage
The command that I publish is useful for detect 60% to 80% of watermark sometimes works perfectly with a hight intensity watermark

Re: how i could make better this command for detect a transparent watermark?

Posted: 2017-03-09T20:02:49-07:00
by diegomage
Adding more information to the post I would like to ask you another question for example in this image

Image

this command output
coords=$( compare -metric rmse -subimage-search -dissimilarity-threshold 1 dIsuln3.png \( -read-mask mask.png circle.png \) null: 2>&1 | cut -d@ -f2 | sed 's/ *//g')
xoff=$(echo $coords | cut -d, -f1)
yoff=$(echo $coords | cut -d, -f2)
magick \( dIsuln3.png -crop 55x55+${xoff}+${yoff} +repage \) mask.png -alpha off -compose copy_opacity -composite watermark2.png

this

Image

but using this command

convert -negate dIsuln3.png dIsuln4.png
convert dIsuln4.png -level 10%,80 dIsuln5.png
convert -noise 20x20 dIsuln5.png dIsuln6.png
convert dIsuln6.png +dither -posterize 2 mono1g2.png


output this

Image

how i could doing better with the first command

Re: how i could make better this command for detect a transparent watermark?

Posted: 2017-03-09T20:04:15-07:00
by diegomage
Adding more information to the post I would like to ask you another question for example in this image

Image

this command output
coords=$( compare -metric rmse -subimage-search -dissimilarity-threshold 1 dIsuln3.png \( -read-mask mask.png circle.png \) null: 2>&1 | cut -d@ -f2 | sed 's/ *//g')
xoff=$(echo $coords | cut -d, -f1)
yoff=$(echo $coords | cut -d, -f2)
magick \( dIsuln3.png -crop 55x55+${xoff}+${yoff} +repage \) mask.png -alpha off -compose copy_opacity -composite watermark2.png

this

Image

Image
but using this command

convert -negate dIsuln3.png dIsuln4.png
convert dIsuln4.png -level 10%,80 dIsuln5.png
convert -noise 20x20 dIsuln5.png dIsuln6.png
convert dIsuln6.png +dither -posterize 2 mono1g2.png


output this

Image
Image

how i could doing better with the first command

Re: how i could make better this command for detect a transparent watermark?

Posted: 2017-03-09T20:04:54-07:00
by diegomage
Adding more information to the post I would like to ask you another question for example in this image

Image

this command output
coords=$( compare -metric rmse -subimage-search -dissimilarity-threshold 1 dIsuln3.png \( -read-mask mask.png circle.png \) null: 2>&1 | cut -d@ -f2 | sed 's/ *//g')
xoff=$(echo $coords | cut -d, -f1)
yoff=$(echo $coords | cut -d, -f2)
magick \( dIsuln3.png -crop 55x55+${xoff}+${yoff} +repage \) mask.png -alpha off -compose copy_opacity -composite watermark2.png

this

Image

Image
but using this command

convert -negate dIsuln3.png dIsuln4.png
convert dIsuln4.png -level 10%,80 dIsuln5.png
convert -noise 20x20 dIsuln5.png dIsuln6.png
convert dIsuln6.png +dither -posterize 2 mono1g2.png


output this

Image
Image

how i could doing better with the first command

Re: how i could make better this command for detect a transparent watermark?

Posted: 2017-03-09T20:43:22-07:00
by fmw42
When the foreground and background are too similar, the compare method does not work well. However, if you use an actual watermark from your other image, that seems to work.

Image:
Image

Watermark Image:
Image

Mask Image:
Image

Code: Select all

coords=$( magick compare -metric rmse -subimage-search -dissimilarity-threshold 1 hTSox.png \( -read-mask mask.png watermark2.png \) null: 2>&1 | cut -d@ -f2 | sed 's/ *//g')
xoff=$(echo $coords | cut -d, -f1)
yoff=$(echo $coords | cut -d, -f2)
magick \( hTSox.png -crop 55x55+${xoff}+${yoff} +repage \) mask.png -alpha off -compose copy_opacity -composite watermark3.png
Image

Re: how i could make better this command for detect a transparent watermark?

Posted: 2017-03-09T20:47:47-07:00
by fmw42
Sorry, I edited my post to remove my special scripting code "im7" that allows me to run different versions of IM on my Mac.

Re: how i could make better this command for detect a transparent watermark?

Posted: 2017-03-09T20:51:38-07:00
by diegomage
ok very thank you for your response; I am very grateful