Is it me or.. is something screwy with contrast

Because it might be I’m doing something wrong here or it could be a local issue with me I’m posting here, anyway here’s the odd thing:
When I use the contrast command with a positive value everything is normal but when I use a negative value nothing happens at all to the image.
The help says you can use negative values though, I quote:

  • If ‘strength’ is positive, image contrast is amplified.
  • If ‘strength’ is negative, image contrast is reduced.

So do you guys have that too that negative values do nothing?

----edit------
Example (using the new radom_patches command, just for s. 'n g.)
gmic random_patches 1,256 +contrast -30 +contrast[0] 30

breakdown: create a random_patches image sized 256x256,
add a copy with -30 contrast,
add a copy of the original patches picture with a contrast of +30
Result: first 2 pics are indentical, last one is more contrasty

If you look at the image with the default G’MIC viewer, then it’s not surprising because the default viewer (command display) renormalizes the image in range [0,255] to display them, by default. That’s because G’MIC can handle float-valued images with any range, so to be sure image content is always visible, such a value normalization is the default.

If you use display0 (aka d0) instead, you will see that the images are not the same (d0 disable value normalization, so your viewed images must be in range [0,255]) :

$ gmic random_patches 1,256 +contrast -30 +contrast[0] 30 display0

You can also press the n key when the images are displayed to cycle/disable the normalization. I know i do!

2 Likes

Thanks.
I thought I covered that when I tried it with normalization (although that was not in my example).
And when I originally tried it I used an actual image and even loaded it with -in as an experiment.
But yeah I should have tried it with d0, apologies and thanks again to both of you.

In retrospect, seems that was what threw me, I used n 0,255 after the command in my batch script, as a sort of standard procedure, and that causes the output to undo the negative contrast before writing it out. I mean it is an excuse right? :slight_smile:

This whole debacle, of me using n 0,255 in a script and then basically making the same mistake differently when using ‘display’ in a shell which also does the normalization reminds me of one of those disaster investigations where some NASA or Boeing or Microsoft engineer or something did something silly like that.
Not that I’m directly comparing myself of course, but the double traping yourself thing is similar.

To give David some insight into what a random guy like me is using GMIC for:
I’m still experimenting with neural network created 3D images from 2D images.
Now the software I use creates depthmaps of 256 gray values, and I can use that with other software to create side-by-side or anaglyph images.
However the 3D effect is a hit or miss, there are some things that are known to create a good 3D effect, but the knowledge is not complete.

And with an 8 bit grayscale there are limits, because if you for instance have an outdoor scene that 8 bit has to cover a huge range.
Also when there is something near the viewer, like say a pole or branch the NN applies a fair bit of that 8 bit to that object leaving even less available for the actual scene.
(Although of course there is a limit on human perception in the first place.)

So I’m sometimes experimenting with doing more with the depthmaps given by doing compound filtering on that depthmap, manipulating the contrast and boosting the light or dark parts and applying vignettes and local blur et cetera to see if I get interesting results.

There are some who did research in what works well and I perused their thoughts, but as I said, the knowledge is incomplete I think, because sometimes you get a picture that makes you say ‘wow, this one is really good’ but objectively it’s hard to say why it’s better than others that seem to have similar elements. As demonstrated by people’s reaction in places like Reddit that has forums where people show off side-by-side images.

Since you (David) are active in the field and work with people doing 3D stereoscopic stuff I thought it might be interesting to hear how ‘some random scrub’ thinks about the subject.

Not much to say, except that encoding a depth map in 8 bits is definitely not a good idea :slight_smile: (I wonder why the software you use does that, knowing there are plenty of well-supported 16bits/value format, as .png or .tiff).

… and now i wish you’d show us what you do. I think there should be more g’mic images around here… don’t want to be the only one pqosting whatever lol.
And i love the depthmap look! Wanted to write something to create this look but i don’t think i can manage to do that, sadly.