Is there a tool that can help you do such thing? Can photoshop do it? Matlab can, but I don't want to use it.
it will show the frequency spectrum? of the picture which tells you its quality.
Sounds like you're thinking of the histogram, which shows the distribution of pixels according to either their brightness or their red, green, and blue values. It's not a measure of quality beyond the fact that it can help you evaluate exposure. But you can easily take a photo that has a nicely distributed range of values, but is completely out of focus, or badly composed, or just ugly.
Is there a tool that can help you do such thing?
If you just want the histogram, there are lots of tools that'll do that. Most photo management tools (Lightroom, Aperture, Photos, etc.) include a histogram feature.
One really easy way to get a histogram is to install the ImageMagick tools and use the
convert command, like:
convert somefilename.jpg histogram:histogramFileName.gif
And then you get something like this:
Like everything related to ImageMagick, there are lots of options to customize the output and get exactly what you want. For example, you can get the pixel counts for every unique color in the image. Or you can separate the image into red, blue, and green components and generate separate brightness histograms for each.
Your question is very confussing. But I have used a method of analizing an histogram but for comparing different compression loss.
Use google translate please: http://otake.com.mx/Apuntes/PruebasDeCompresion/1-CompresionJpgProceso.htm
The basic idea is that you overlap the exact image with different compression settings on the original image using a diference overlay mode.
After that, you amplify the resulting image and compare the histograms.
A really lazy heuristic, assuming that the images have been taken with the same process and similar framing and are available as JPEG, is to take the image with the larger file size. Basically this means that the lossy JPEG compression algorithm was of the opinion that more human-discernible details required preserving which usually means more in-focus details. Of course, whether those details are the ones of your actually interesting subject is another question, but teaching "interesting subject" to an algorithm would likely be hopeless anyway.