adaptive-sharpen not working?

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
areohbee
Posts: 23
Joined: 2010-09-29T21:05:23-07:00
Authentication code: 8675308

Re: adaptive-sharpen not working?

Post by areohbee »

There is thread dedicated to the ICC profile problem - apparently it has been fixed now (I haven't verified fix), ref:

viewtopic.php?f=3&t=16699
areohbee
Posts: 23
Joined: 2010-09-29T21:05:23-07:00
Authentication code: 8675308

Re: adaptive-sharpen not working?

Post by areohbee »

Just tried latest version 6.8.9 (windows binary) and I still can't get adaptive sharpen to do anything, no matter what I try, e.g.

-adaptive-sharpen 0x0.6
nothing

-adaptive-sharpen 6x2
nothing

Am I doing something wrong or is it still broken?

note: regular sharpening works fine, e.g.
-sharpen 0x.6
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: adaptive-sharpen not working?

Post by snibgo »

It works fine for me, IM v6.8.9-0 on Windows 8.1. Take the Lena image on the previous page.

Code: Select all

convert lena.png -adaptive-sharpen 0x2 l.png
convert lena.png -sharpen 0x2 l2.png
l.png has sharper feathers but the background hasn't changed. l2.png is sharper overall. "compare" confirms the images are different.

(Personally, I prefer to roll-my-own adaptive sharpen, which takes longer but I know exactly what it does. But "-adaptive-sharpen" does work.)
snibgo's IM pages: im.snibgo.com
areohbee
Posts: 23
Joined: 2010-09-29T21:05:23-07:00
Authentication code: 8675308

Re: adaptive-sharpen not working?

Post by areohbee »

Does anybody have any clue as to why adaptive sharpening is NOT working, for me?

I mean, I'm happy that that it works for some folks, but my objective in posting is 2-fold:
* Raise the possibility of a bug.
* If no bug, determine why I can't get it to do anything.

Am I the only one having this problem? Anybody else??

More info: The image is being modified: i.e. output image is different than input image, when doing image-compare using Beyond Compare by Scooter Software.

However, it's just not noticeably sharper, no matter parameters I try.

Does it only work on pngs, or........ ???
Is it depending on an environment setting which is missing or wrong?
Dunno - I got no clue.

PS - How do you "roll your own" adaptive sharpening?
PS - How do you "roll your own" adaptive sharpening?

Rob
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: adaptive-sharpen not working?

Post by fmw42 »

You are using a very small sigma, which will produce limited effects if visible at all. try a larger sigma

convert image -adaptive-sharpen 0x3 result

It is not limited to png.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: adaptive-sharpen not working?

Post by snibgo »

areohbee wrote:Does anybody have any clue as to why adaptive sharpening is NOT working, for me?
Put your input image somewhere like dropbox.com and paste the URL here. Some images don't have the vaiation required for the "adaptive" to work.

Have you tried it with the Lena image?
areohbee wrote:PS - How do you "roll your own" adaptive sharpening?
See http://im.snibgo.com/zingph.htm#lbdm , which is effectively adaptive-sharpen and adaptive-blur combined, to further sharpen already sharp areas, and further blur already blurred areas.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: adaptive-sharpen not working?

Post by fmw42 »

How do you roll your own
If you are on Linux, Mac OSX or Windows with Cygwin, then you can try my gaussianedge or sharpedge adaptive sharpening scripts. See the link below.
areohbee
Posts: 23
Joined: 2010-09-29T21:05:23-07:00
Authentication code: 8675308

Re: adaptive-sharpen not working?

Post by areohbee »

Works perfectly on lena, but not my jpegs.

Here is a demo file - it's a zip with

original jpeg, converted jpegs, commands issued to create the conversions.

http://www.robcole.com/ImageMagickForum ... keyard.zip

Note: conversions differ (unnoticeably) from original, but each conversion is identical (byte-for-byte) to the next (despite different sigma).

Thanks,
Rob
areohbee
Posts: 23
Joined: 2010-09-29T21:05:23-07:00
Authentication code: 8675308

Re: adaptive-sharpen not working?

Post by areohbee »

More info: I found if I shrink my images more, the adaptive sharpening becomes effective.

For example:
300 long edge - strong edge-sharpening effect, amount depends on sigma - as it should..
1000 long edge - no adaptive sharpening, at any sigma. Note: if I crank up the radius, it takes a long time, but still comes up with an identical conversion. Also, if I pre-sharpen to make sure there are some unambiguous edges.. - doesn't help... - it's like it only works on small images - I haven't identified a cutoff point, yet.

UPDATE: at 500 (long edge, and above) no appreciable adaptive-sharpening can be had, at 400 and below adaptive-sharpening works. Unless I am the only one experiencing like this, it seems the usefulness of adaptive sharpening is quite limited..

Rob
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: adaptive-sharpen not working?

Post by fmw42 »

Adaptive sharpening may be scale dependent. At high resolution, edges may not be as sharp (and so not as clearly an edge -- too gradual a change) as at lower resolutions. So you may need to use a higher sigma on high resolution images than you do on low resolution images.
areohbee
Posts: 23
Joined: 2010-09-29T21:05:23-07:00
Authentication code: 8675308

Re: adaptive-sharpen not working?

Post by areohbee »

Did you try my files? (posted above).

Also, I tried exporting from Lightroom with high output sharpening, to assure there was something for the algorithm to bite on - still no possibility for adaptive sharpening at 1000 pixels long edge - I tried sigmas between 2 and 50.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: adaptive-sharpen not working?

Post by snibgo »

It seems that "-adaptive-sharpen" on the jpg of the turkeys does nothing, but converting it to png and then "-adaptive-sharpen" works fine. Looks like a weird bug to me.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: adaptive-sharpen not working?

Post by fmw42 »

snibgo wrote:It seems that "-adaptive-sharpen" on the jpg of the turkeys does nothing, but converting it to png and then "-adaptive-sharpen" works fine. Looks like a weird bug to me.
On my system (Mac OSX) if I convert to png, then use -adaptive-sharpen 0x50 and save as png, there is still no change in the turkey image as evidence by a compare -metric rmse.

If I resize by 50%, I still see no effect and compare is 0.

I took a 512x512 version (converted from tiff to png from http://sipi.usc.edu/database/database.php?volume=misc) of the lena image) and applied adaptive-sharpen 0x20 and got no change again as evident from compare resulting in 0.

Code: Select all

convert lena.png -adaptive-sharpen 20 lena_as20.png
compare -metric rmse lena.png lena_as20.png null:
0 (0)
So I would have to agree that -adaptive-sharpening appears not to be working correctly.

Mac OSX Snow Leopard

Version: ImageMagick 6.8.9-1 Q16 x86_64 2014-05-09 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules
Delegates: bzlib cairo fftw fontconfig freetype gslib jbig jng jpeg lcms lqr ltdl lzma openexr png ps rsvg tiff webp x xml zlib
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: adaptive-sharpen not working?

Post by snibgo »

snibgo wrote:It seems that "-adaptive-sharpen" on the jpg of the turkeys does nothing, but converting it to png and then "-adaptive-sharpen" works fine. Looks like a weird bug to me.
Sorry, this comment was wrong. It was finger trouble.
snibgo's IM pages: im.snibgo.com
siunhun
Posts: 1
Joined: 2014-05-27T01:37:07-07:00
Authentication code: 6789

Re: adaptive-sharpen not working?

Post by siunhun »

Now even that does not work for me. But again, this is an adaptive script and it may be image dependent. However, I would have expected to see some difference and not a perfect compare value of zero.
Post Reply