views:

636

answers:

4

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!

A: 

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
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.
Matthias
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
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
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
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.
Matthias
I would stick with something like megapixel count, as resolution is usually a good enough (highly) rough determination.
Unkwntech
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 Burgess
@James Burgess - That is correct which is more or less what I stated.
Unkwntech
A: 

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.

Paul Dixon
A: 

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
+3  A: 

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
basically, I only need to know the amount of noise and compression in a given image.
Matthias
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