JPEG noise, a comparison study

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

JPEG noise, a comparison study

Post by rnbc »

Since the use of JPEG as a proper method of transmission for high quality image evaluation recently arose I think it would be interesting to share some results I got in the past concerning JPEG noise under various quality settings and chroma subsampling settings:

Image

Above is the JPEG noise to signal ratio as a function of quality and chroma subsampling.

The scale is linear and the values are calculated as the standard deviation of module of the difference of the encoded signal versus a 16bit tiff "master".

A multiplicity of natural images were used. The jpeg encoder was the one on cjpeg.

A few values are also added for comparison:

25ke- -- the shot noise in a sensor with a well depth of 25000 electrons. Gamma 2.0 encoding was used.

25ke- Bayer -- the shot noise in a sensor with a well depth of 25000 electrons, considering there is Bayer color interpolation. Gamma 2.0 encoding was used.

EffectiveDither -- the minimum dithering necessary for correct 8 bit per channel color encoding. Adding dither noise is only necessary if the source signal noise is below this one. OTOH this is the minimum noise a properly encoded 8bit image will contain.

16_bit_to_8bit -- error caused by 8 bit coding itself.

PS: 25ke- and 25ke- Bayer does not take into consideration that conversion from native sensor RGB color space into sRGB or Adobe RGB adds noise.

PPS: 25000 electrons per pixel is a typical value in a large sensor camera (DSLR) as of 2010.
rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

Re: JPEG noise, a comparison study

Post by rnbc »

My conclusion at the time was that JPEG when used without chroma subsampling and 100% quality is perfectly ok for high quality image transmission and evaluation, since the noise introduced is on the same level as good image sensors and 8 bit encoding itself.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: JPEG noise, a comparison study

Post by anthony »

Interesting study and graphs, though a little hard to follow at first.

I would agree that JPEG at 100% quality and no croma-subsampling is good enough in practically all cases.

However I would still prefer to warn people against using JPEG for anything except final the image image they are trying to generate, sumply because the reason people chose JPEG is for its compression capability. All the defaults are for a higher compression level than 100%. Also by default IM will save intermediate PNG images, that have been heavilly modified at 16bit compression. Basically it saves a lot of problem and hassles to simply request they use PNG (or MIFF) for intermediate images.

However your point is noted.

If you can write your explanation and graph in terms that a less technical user can understand, (yes that can be a difficult task), then I would like to include it in IM Examples, JPEG compression.

Actually the whole JPEG section could use a re-write as it was done a long long time ago and has sort of grown in a piece-meal fashion rather than as a comprehensive whole. I tried my best with my limited understanding of JPEG at that time.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

Re: JPEG noise, a comparison study

Post by rnbc »

I'll try to. Perhaps I can write an article detailing the concepts, and with pointers, so that anyone willing can understand it. I wrote an article about this issues a few years ago in portuguese. Let's see what I can come up with!

BTW, the reason to use gamma 2.0 is that shot noise grows with the sqrt of the signal counts. The y=sqrt(x) transform makes noise from a such a (poisson) source constant. It's rather neat :) Of course, real sensors feature other noise sources, so JPEG is even better than it seems from this comparison.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: JPEG noise, a comparison study

Post by anthony »

JPEG images should be saved as SRGB, which is of course approximately Gamma 2.0

Be warned however the IMv6 colorspace handling is currently a little weird and awkward. Something taht will be fixed in IMv7.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

Re: JPEG noise, a comparison study

Post by rnbc »

There is nothing in the JPEG standard specifying you should use sRGB. At least in the version I have. They seem to imply JPEG is encoded in some native output color space, ready for display. That happens to be close to sRGB in most modern LCDs, but not really sRGB. The ideal would be to include an ICC profile within each image.

In fact most monitors I've actually measured, including my Dell U2410, are closer to gamma 2.0 than gamma 2.2, except in deep shadows, were they follow some weird curve due to lack of contrast. Some also happen to support extended color gamut.

Most images use some kind of sigmoid contrast, and are processed to look good, instead of mapping as correctly as possible into the natural scene they captured. So I wouldn't be too strict... as far as your monitor is close to sRGB andthe image looks good, then fine!

For noise measurements I greatly encourage using gamma = 2.0, since it greatly simplifies math with photon shot noise, etc...
Post Reply