Settings

Theme

Ask HN: How can I determine the quality of an image file

2 points by vatsci 4 years ago · 7 comments · 1 min read


I'm building a software to extract text in image. But some uploaded images are blur, and hard to process. So, I need to build a function to determine if an image is low or high quality. How can I do it?

PS: Sorry for my bad english.

version_five 4 years ago

Downsample it and then up sample and see how different (e.g. mean squared error over the pixels) it is? (Or equivalently (assuming anti-aliasing in the sampling version), apply a low pass filter and compare.

Those are just heuristics, you'd have to try it to see how well they work.

  • vatsciOP 4 years ago

    thank you, I tried with downsample and up sample it with opencv using INTER_AREA then compare them with SSMI, but it still not work well. Could you tell me what low pass filter you applied?

    • version_five 4 years ago

      Use the pixel MSE, not SSMI - I'm not really familiar with it, but it appears to be more about structure or perception. This is not what you care about, you want to see how much fine detail gets lost. You'll have to play around with it, I would just try to Gaussian blur with different radii to see what works.

      Alternatively (though roughly equivalent) you could try some kind of edge detection (and then summing the output) - especially if you're talking about blurred text, I'd expect there to be fewer hard edges in a blurry image

meta-level 4 years ago

This is hard to answer in general, although general aspects like contrast and resolution are important of course. Maybe you can provide some background regarding your know how and technology you're going to use.

  • vatsciOP 4 years ago

    I tried with downsample and up sample image with opencv using INTER_AREA then compare them with SSMI. After that I pick the threshold to determine which is bad and which is good, but it still not work well.

    I struggle when determine the threshold, some blur image have higher score than high quality image, but other blur image has lower score than high quality image.

    So I wonder where i'm wrong or have some better approaches to resolve this.

mardiyah 4 years ago

google tools of image properties for each OS

that'd have resolution and bit ratio which I forget how to figure out honestly, not hard to learn in minutes though

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection