0

I want to determine if an image has been overly compressed and thus if it contains those pixelated artifacts you can see clearly, for example, in the upper right portion of the image below. In the following comparison there are two JPEG images, the left one is the original, the right one has been saved at 30% quality and then saved again with 80% quality.

On the left, the original picture. On the one saved with higher compression.

The loss of details in the right one is easily detactable at naked eye. I'm looking for an algorithm which, given the final image only and not the original one, detects if it's been overly compressed or if it has this kind of "disturb" which implies those clusters of similar/identical pixels and therefore determines an average poor quality of detail.

I analyzed them through ImageMagick and they have very similar values and histograms, and pretty the same min/max values on the RGB channels. The original image quality is 71% and the compressed one is 80% just because, as I already said before, I saved it back to 80% after saving it at 30% quality in first place, which makes the "quality" factor unreliable.

Before anyone asks, I wrote no code yet. I'm doing some research just looking for some tips to eventually find a solution but I don't really know how this phenomenon is called nor the algorithm(s) to serve the purpose. The matter of image and signal analysis is huge, so I'd really appreciate if you could help me to narrow it down.

zangarmarsh
  • 319
  • 5
  • 18
  • Z. Wang, H.R. Sheikh and A.C. Bovik. No-reference perceptual quality assessment of JPEG compressed images, Proc. of ICIP, Sept. 2002. – Cris Luengo Mar 16 '21 at 17:07
  • As JPEG encodes in separate 8x8 macroblocks, there are often discontinuities at the 8th, 16th, 24th pixel across and down your image, so you could probably start by looking at the edges/discontinuities at those 8-pixel boundaries as a ratio versus elsewhere in the image. Or maybe the variance within 8x8 blocks versus the variance when straddling such boundaries. Oftentimes, if the colour has been sub-sampled (*"chroma subsampling"*) the Saturation channel is worse affected if you convert to HSL colourspace. Try `magick BADIMAGE.JPG -colorspace hsl -separate -normalize +append HSL.png` – Mark Setchell Mar 16 '21 at 17:47
  • Read about JPEG here https://en.wikipedia.org/wiki/JPEG or if you have many hours to spare and want to know every last detail https://youtu.be/CPT4FSkFUgs – Mark Setchell Mar 16 '21 at 17:49
  • You could try edge detection and thresholding and then get the mean to see if you can enhance the 8x8 block nature. The threshold would set your detection limit and you can check the mean value for brightness of edges detected and set some limit. – fmw42 Mar 16 '21 at 22:30

0 Answers0