how i could make better this command for detect a transparent watermark?
how i could make better this command for detect a transparent watermark?
I have a simple command for detect a transparent watermark transform the watermark to black but this command fail detect the circle but with a extra space
convert -noise 20x20 resultnn.png output.jpg
convert output.jpg +dither -posterize 2 mono12.png
how i could do this better
this is my output
i expected something like this
enter image description here
what I could do
doing a crop i obtain this
convert mono12.png -fuzz 10% -fill blue +opaque "#000000" monod12.png
corde=$(convert monod12.png -median 3x3 -format %@ info:)
convert resultnn.png -crop $corde +repage resulnmonod12.png
this is my expected output
i need detect the circle ; I would use a command to detect it by color; But as it is a transparent watermark this is impossible
Please help me
convert -noise 20x20 resultnn.png output.jpg
convert output.jpg +dither -posterize 2 mono12.png
how i could do this better
this is my output
i expected something like this
enter image description here
what I could do
doing a crop i obtain this
convert mono12.png -fuzz 10% -fill blue +opaque "#000000" monod12.png
corde=$(convert monod12.png -median 3x3 -format %@ info:)
convert resultnn.png -crop $corde +repage resulnmonod12.png
this is my expected output
i need detect the circle ; I would use a command to detect it by color; But as it is a transparent watermark this is impossible
Please help me
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how i could make better this command for detect a transparent watermark?
What is your IM version and platform? Please always provide that.
Is your watermark always the same size circle? Do you have more than one image with the same watermark?
Is your watermark always the same size circle? Do you have more than one image with the same watermark?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how i could make better this command for detect a transparent watermark?
If the watermark is always the same size circle, then you could make a black circle image and do a subimage compare to locate its coordinates and then crop accordingly.
Re: how i could make better this command for detect a transparent watermark?
i use version 7.0 and use linux ubuntu the watermark is the same circle
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how i could make better this command for detect a transparent watermark?
try this
Input:
Or replace the last line with
See viewtopic.php?f=4&t=31053 for IM 7 version requirements.
Input:
Code: Select all
magick -size 55x55 xc:black -fill white -draw "translate 27,27 circle 0,0 0,27" -alpha off mask.png
Code: Select all
magick mask.png -negate circle.png
Code: Select all
coords=`magick compare -metric rmse -subimage-search -dissimilarity-threshold 1 \
dIsul.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 dIsul.png -crop 55x55+${xoff}+${yoff} +repage watermark.png
Or replace the last line with
Code: Select all
magick \( dIsul.png -crop 55x55+${xoff}+${yoff} +repage \) mask.png \
-alpha off -compose copy_opacity -composite watermark2.png
See viewtopic.php?f=4&t=31053 for IM 7 version requirements.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how i could make better this command for detect a transparent watermark?
I have moved this post from Developers to Users forum and deleted your duplicate post in the Users forum. Please do not post to multiple forums.
Re: how i could make better this command for detect a transparent watermark?
hi very thankyou for your response but i think is so very complicated to implement for general purposes
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how i could make better this command for detect a transparent watermark?
You said all your images had the same watermark circle size and shape. So why is that hard to implement? Also, he first two lines can be combined into one command.
Re: how i could make better this command for detect a transparent watermark?
I will put an example here what happens that when using my command some watermarks darken and others simply disappear an example here
Re: how i could make better this command for detect a transparent watermark?
and other watermarks certain percentage disappears
Re: how i could make better this command for detect a transparent watermark?
This varies depending on the intensity of the watermark
Re: how i could make better this command for detect a transparent watermark?
My intention is to detect the watermark regardless of its shape or intensity
Re: how i could make better this command for detect a transparent watermark?
The problem is not the complexity of the command but the ability to adapt to different forms
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how i could make better this command for detect a transparent watermark?
It is almost impossible to extract any arbitrary watermark, unless you have multiple images with the same watermark that have the watermark in the same location and the background of all the images are different. At least I know of no way.
If you have two images, then see viewtopic.php?f=1&t=31126&p=141311&hili ... cy#p141311
If you have two images, then see viewtopic.php?f=1&t=31126&p=141311&hili ... cy#p141311
Re: how i could make better this command for detect a transparent watermark?
I want to clarify that your command helped me a lot and I am very grateful for your answer only that I wanted to get something more general however that command helped me a lot
I think summarizing this post
The command that I publish could be useful to detect a point contained in the watermark
The command you posted is useful for detecting a constant watermark
I think summarizing this post
The command that I publish could be useful to detect a point contained in the watermark
The command you posted is useful for detecting a constant watermark