Heuristics and some experimentation suggest that:
- Sigmoidization works much much better when used with an image converted to a color space with channels monotonic with respect to luminance (like linear RGB).
- An HDRI (floating point, with no clamping at intermediate states) toolchain should be used. (I think that ImageMagick 6 always clamps when applying sigmoidal contrast enhancement, which would be bad news with images with extreme color values, but not ImageMagick 7. I will need to check the source code.)
- (Important and new) The sigmoidal curve should not be symmetrical about the black and white points. Specifically, the sigmoid's "inflexion point" (called "threshold" in http://www.imagemagick.org/Usage/color_mods/#sigmoidal), near which the "synthetic color space" transformation is approximately affine, should be closer to white than black, so that the effect of applying the inverse sigmoidal curve resemble gamma correction somewhat.
- (Important and new) A strongly antialiasing filter should be used (if the image is sharp; otherwise it does not matter).
- There is a sweet spot in the strength of the contrast enhancement, and this sweet spot depends on the resampling filter kernel.
Code: Select all
magick input.png -colorspace RGB +sigmoidal-contrast 6.5,66% -define filter:blur=1.02 -filter Lanczos -distort Resize 500% -sigmoidal-contrast 6.5,66% -colorspace sRGB output.png
I'd love to hear what people have to say about results obtained with the above command or with variants (in particular, "6.5,66%" was settled on rather quickly, and I suspect that some people won't like the use of a 3-lobe filter, as opposed to, say, an EWA method with a Keys cubic filter kernel that sits somewhere between Robidoux http://www.imagemagick.org/Usage/filter/#robidoux and RobidouxSoft viewtopic.php?f=22&t=19823&start=30#p109820). I am particularly interested in results obtained by performing sigmoidized resampling with a tool other than ImageMagick, as part of a 16 bit or float toolchain that avoids clamping until the last minute, both upsampling and downsampling images that are fairly close to "raw" and obtained with a fairly sharp demosaicing method (with no extra sharpening applied, however).
Note that I do not expect sigmoidization to work well with heavily JPEG compressed images, but I think that with the right resampling filter kernel it may do OK with noise.