Page 1 of 1

Highpass Sharpen

Posted: 2007-12-16T14:20:09-07:00
by ithier
Hi,

I use GIMP and I have found a script from Martin Egger to sharpen an image using a highpass algorithm. The script is simple so I wanted to write it using Image Magick. I have written all the steps except the last one which is a composite overlay with an opacity of 50%.

The first steps, to generate the image to merge, are:
convert 05_0019.jpg -blur 0x10 etape1.png
convert etape1.png -negate etape2.png
composite -blend 50 etape2.png 05_0019.jpg etape3.png
convert etape3.png -level 25600,37800 etape4.png

Then the final steps: Overlay this generated image with the original image with an Opacity of 50%.
My first try was:
composite 05_0019.jpg etape4.png -compose Overlay etape5.png
The result is fine except that as there is no opacity defined the image is way too sharpened.

So I tried others methods:
Adding an alpha channel to etape4.png doesn't seems to work:
convert etape4.png -channel A -evaluate set 30% -format PNG32 etape4a.png
and then
composite 05_0019.jpg etape4a.png -compose Overlay etape5.png

I have also tried the following commands but with no result:
composite -blend 50 05_0019.jpg etape4.png -matte etape5.png
composite 05_0019.jpg -matte etape4.png -matte -dissolve 100x50 etape5.png

Does someone know how to reproduce the Opacity with 50% (or another percentage) function that I can find in GIMP.


Thanks in advance, and I hope you have understood my poor english.

Ithier

Re: Highpass Sharpen

Posted: 2007-12-16T14:41:36-07:00
by Bonzo
You could try using

Code: Select all

composite -dissolve 50% 05_0019.jpg etape4a.png etape3.png

Re: Highpass Sharpen

Posted: 2007-12-17T00:19:01-07:00
by anthony
You can even specifically use a negative percentage for Blend rather than dissolve.

See IM examples, http://imagemagick.org/Usage/compose/#blend_use
for Expratolation blending of images!!!!

PS: the operation you performed is known as 'unsharp' that is sharpening an image by subtracting the blurred form. IM also has the -unsharp operator that can do this directly

Re: Highpass Sharpen

Posted: 2007-12-17T16:01:18-07:00
by ithier
Hi,

Thanks Bonzo and Anthony for your answers. Unfortunately the result is not as close as what I can get with GIMP.
I have tried dissolve 50%, but it's lvery dimmed.
Antony I understand what you said about unsharp mask, but I would really like to implement this algorithm because simply, I prefer the result !! :)
For those interested, I made a gallery in Picasa with different settings.

If someone has an idea it will be greatly appreciated.

Ithier

Re: Highpass Sharpen

Posted: 2007-12-17T18:05:47-07:00
by fmw42
You can try my binomial script. It does something like this with a binomial filter rather than a gaussian. You can either sharpen or blur and control the mixing with the original image. My laplacian script does something similar but uses the laplacian as the high pass filter.

http://www.fmwconcepts.com/imagemagick/index.html