9

I'm looking for ways to determine the quality of a photography (jpg). The first thing that came into my mind was to compare the file-size to the amount of pixel stored within. Are there any other ways, for example to check the amount of noise in a jpg? Does anyone have a good reading link on this topic or any experience? By the way, the project I'm working on is written in C# (.net 3.5) and I use the Aurigma Graphics Mill for image processing.

Thanks in advance!

Mats
  • 14,902
  • 33
  • 78
  • 110

5 Answers5

7

I'm not entirely clear what you mean by "quality", if you mean the quality setting in the JPG compression algorithm then you may be able to extract it from the EXIF tags of the image (relies on the capture device putting them in and no-one else overwriting them) for your library see here:

http://www.aurigma.com/Support/DocViewer/30/JPEGFileFormat.htm.aspx

If you mean any other sort of "quality" then you need to come up with a better definition of quality. For example, over-exposure may be a problem in which case hunting for saturated pixels would help determine that specific sort of quality. Or more generally you could look at statistics (mean, standard deviation) of the image histogram in the 3 colour channels. The image may be out of focus, in which case you could look for a cutoff in the spatial frequencies of the image Fourier transform. If you're worried about speckle noise then you could try applying a median filter to the image and comparing back to the original image (more speckle noise would give a larger change) - I'm guessing a bit here.

If by "quality" you mean aesthetic properties of composition etc then - good luck!

Ian Hopkinson
  • 3,412
  • 4
  • 24
  • 28
  • basically, I only need to know the amount of noise and compression in a given image. – Mats Jan 12 '09 at 14:29
  • Okay - so with any luck the EXIF tags will give you the compression and something based on a median filter and comparison back to the original image with give you a measure of noise: http://en.wikipedia.org/wiki/Median_filter – Ian Hopkinson Jan 12 '09 at 14:55
2

The 'quality' of an image is not measurable, because it doesn't correspond to any particular value. If u take it as number of pixels in the image of specific size its not accurate. You might talk about a photograph taken in bad light conditions as being of 'bad quality', even though it has exactly the same number of pixels as another image taken in good light conditions. This term is often used to talk about the overall effect of an image, rather than its technical specifications.

tayba
  • 21
  • 1
0

I wanted to do something similar, but wanted the "Soylent Green" option and used people to rank images by performing comparisons. See the question responses here.

Community
  • 1
  • 1
Paul Dixon
  • 295,876
  • 54
  • 310
  • 348
0

I think you're asking about how to determine the quality of the compression process itself. This can be done by converting the JPEG to a BMP and comparing that BMP to the original bitmap from with the JPEG was created. You can iterate through the bitmaps pixel-by-pixel and calculate a pixel-to-pixel "distance" by summing the differences between the R, G and B values of each pair of pixels (i.e. the pixel in the original and the pixel in the JPEG) and dividing by the total number of pixels. This will give you a measure of the average difference between the original and the JPEG.

MusiGenesis
  • 74,184
  • 40
  • 190
  • 334
-2

Reading the number of pixels in the image can tell you the "megapixel" size(#pixels/1000000), which can be a crude form of programatic quality check, but that wont tell you if the photo is properly focused, assuming it is supposed to be focused (think fast-motion objects, like trains), nor weather or not there is something in the pic worth looking at, that will require a human, or pigeon if you prefer.

UnkwnTech
  • 88,102
  • 65
  • 184
  • 229
  • sure, you can't tell whether you're dealing with a nice image or not ;) I just need to roughly check whether the image might be of poor quality, technically. If you have a 3000*2000px image with a filesize of 500kb, the probability is quite high that it is not of too good quality. – Mats Jan 12 '09 at 12:29
  • I just created 20,271 byte (19.7 KB) image that is 3000*2000 and I would say that the quality is Perfect, it exactly reflects what I intended it to. http://unkwndesign.com/HQPic.png – UnkwnTech Jan 12 '09 at 12:37
  • All the measurement of 3000*2000 = 1.5MB tells you is how much data is stored in the file, which may or may not be indicative of it's quality. – UnkwnTech Jan 12 '09 at 12:39
  • And more colors == bigger filesize what if the pic is of a starry sky? It could easily have a small file size, high resolution, and excelent Quality – UnkwnTech Jan 12 '09 at 12:40
  • right, the number of colors really is a drawback on this form of comparison. but once again, it doesn't have to be too exact, just a rough guideline. – Mats Jan 12 '09 at 12:49
  • I would stick with something like megapixel count, as resolution is usually a good enough (highly) rough determination. – UnkwnTech Jan 12 '09 at 12:57
  • Some of these suggestions obviously come from a complete misunderstanding of JPEG compression (which is basically an amalgam of everything from DCTs to Huffman coding). You cannot determine the quality of the image from its filesize... its just not possible. – James B Jan 12 '09 at 14:07
  • @James Burgess - That is correct which is more or less what I stated. – UnkwnTech Jan 12 '09 at 14:18