Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal,... gamma?

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by fmw42 »

Your sigmoidal-contrast first value 0.45 is so small as to be hardly doing anything, if I am not mistaken. It is nearly a linear function with slope almost unity, thus an no-op situation. What do you get if you remove the -sigmoidal-contrast on both sides? Is it at all visually different?

What is the "default" method?

Can you post the original size building image?
Last edited by fmw42 on 2012-09-23T20:10:51-07:00, edited 1 time in total.
BryantMoore
Posts: 56
Joined: 2011-04-23T22:21:52-07:00
Authentication code: 8675308

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by BryantMoore »

fmw42 wrote:Your sigmoidal-contrast first value 0.45 is so small as to be hardly doing anything, if I am not mistaken. It is nearly a linear function with slope almost zero, thus an no-op situation. What do you get if you remove the -sigmoidal-contrast on both sides? Is it at all visually different?

What is the "default" method?

Can you post the original size building image?
Here's take 2.

Image
convert xc: -bordercolor black -border 1x1 -colorspace RGB -sigmoidal-contrast 8x50% -define filter:kaiser-beta=4 -define filter:window=kaiser -filter sinc -distort resize 10000% -sigmoidal-contrast 8x50% -colorspace sRGB -sampling-factor 1x1 -quality 100% -strip 3x3-bamscaler2.jpg
The default method is a -resize without calling a -filter.

Original building image: https://dl.dropbox.com/u/106615031/dsp/ ... 871921.jpg
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by fmw42 »

A sigmoidal contrast value of 8 is more in range with what Nicolas Robidoux has been using.

Are you trying to use the same filter for both enlarging and reducing?
BryantMoore
Posts: 56
Joined: 2011-04-23T22:21:52-07:00
Authentication code: 8675308

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by BryantMoore »

fmw42 wrote:A sigmoidal contrast value of 8 is more in range with what Nicolas Robidoux has been using.

Are you trying to use the same filter for both enlarging and reducing?
Yes I am.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by anthony »

fmw42 wrote:Your sigmoidal-contrast first value 0.45 is so small as to be hardly doing anything, if I am not mistaken. It is nearly a linear function with slope almost zero, thus an no-op situation. What do you get if you remove the -sigmoidal-contrast on both sides? Is it at all visually different?
values below 1.0 are usless in sigmoidal-contrast. You may as well not use it at all.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

To illustrate what's going on, I'm going to add some small comparisons to "The Recommendations".
First pass:
Image
Image
Image
Comments?
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

fmw42 wrote:A sigmoidal contrast value of 8 is more in range with what Nicolas Robidoux has been using.
With filters that are not blurry, contrast = 8 is close to the upper end of the "do no harm" range. When enlarging images that have the character of CG or text, or images which don't have extreme pixel values or are greyscale, or blurry images, higher values may work well, esp. with less sharp filters. But lots of images do not fit one of these types.
Maybe sigmoidization is OK with such images when downsampling, but it is generally not safe when downsampling. It's actually slightly evil. (So is sRGB.)
So, I am pretty sure that no sigmoidized scheme should make the "one single scheme for everything" short list.
Because linear light rules downsampling.
So if one single scheme is going to be used for enlarging and reducing, it has to be a linear light scheme. (Does not need to be linear RGB: XYZ works just fine.)
P.S. It's going to be linear light, unless something new is discovered, of course. But at this point, I think that it is unlikely that sigmoidization be worthwhile when downsampling, unless the image has some rather specific characteristics.
Last edited by NicolasRobidoux on 2012-09-28T05:33:12-07:00, edited 4 times in total.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

"Do no harm" is rather stringent a requirement.
With "more good than harm most of the time", the upper range of the contrast is about 13, slightly more for blurry filters like Quadratic and Spline.
BryantMoore
Posts: 56
Joined: 2011-04-23T22:21:52-07:00
Authentication code: 8675308

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by BryantMoore »

Perhaps I was too excited to develop my own filter and my naivety got the best of me. I should read more before I pursue this further. :)

I appreciate all the information you guys have given me. :D
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by anthony »

Can you try the above tables again but using light gray for the line?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

Image
Image
Image
These images would not encourage people to use linear RGB, because sRGB is pretty good with dark halos. sRGB is worse than sigmoidized and linear RGB with light halos.
Also, thin dark features on a light background are more common than the converse.
But this set makes sigmoidization look pretty good IMHO.
Last edited by NicolasRobidoux on 2012-09-27T18:46:55-07:00, edited 3 times in total.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

If I took sRGB as defining "safe", I'd use a higher contrast.
But sRGB color bleeds a bit too much for my taste. You can even see it in the simplest situation:

Code: Select all

magick -size 2x1 xc:white -fill '#007FFF' -draw 'point 1,0' small.png
magick small.png -filter Triangle -resize 1200x128\! big.png
#007FFF is (R,G,B)=(0,127,255).
Going down from white, it first becomes greenish (turquoise), then reddish (I'm not too good with English color names), and finally goes to the right color.
P.S. This is a bad example: Through linear RGB, it does not look "obviously right" either. The green shift is less pronounced, however.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

This is exactly the type of image for which more sigmoidization works well:
Image
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

@Bryant:
It was interesting watching you "go".
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?

Post by NicolasRobidoux »

I'm taking out EWA Lanczos2Sharp and adding Cosine-windowed Sinc 3-lobe (a.k.a. -filter Cosine), which is then the sharpest scheme in the collection. Works well with slightly blurry images.
Post Reply