Skip to main content
gamedev.net
🔒 Locked

Determining image sharpness

Started by BlackGhost Aug 4, 2003 at 6:48 PM 3 replies 350+ views
Original Post
BlackGhost
BlackGhost
I''m new to image processing, and I need to make a program that detects the edges of an image. Firstly, however, this image must be checked for a level of sharpness and will be rejected if it is below a specified value. How would I check in general an image, and get a value that would be high if it is sharp and low if it is blurred? I''d appreciate it if you could point me to something directly if you know (e.g. not "you can check out this site"), as I''ve found out that many sites just tell how to apply a sharpness/blur filter, but not how to determine how blurred or sharp an image is in the first place.
Xtremehobo
Xtremehobo
I''ve never tried this, but here''s what I would do:

Depending on how accurate you want it to be, I''d sample about every 10 pixels of an image, then I would:
1) Retrieve the color value of that pixel
2) Retrieve the color values of the pixels next to the pixels next to the pixel you are samplling

i would then find the difference between each pixel and it''s surrounding, then average the difference. I''d do this with every 10 pixels or so, then average all the average differences. The higher the average, the sharper an image is. This method does have some problems though that might have to be worked out of it, such as, you could have an image that is just two colored bars filling the whole image and the transition between the two bars could be very sharp but the method would return a low average. Hope this helps some
pixelwrench.com | [email="matt[nospam]@pixelwrench[nospam]com"]email[/email] lethalhamster: gamedev keeps taking my money, but im too lazy to not let them
foofightr
foofightr
I would approach this from a statistical point of view. I would basically get the standard deviation for the image (collection of pixels), which would give you a crisp value for the contrast.

I don''t know if it would work well or not (or at all!), but that''s my idea and I''m sticking to it
Kylotan
Kylotan
quote:
Original post by BlackGhost
I'm new to image processing, and I need to make a program that detects the edges of an image. Firstly, however, this image must be checked for a level of sharpness and will be rejected if it is below a specified value. How would I check in general an image, and get a value that would be high if it is sharp and low if it is blurred?

Short answer - a blurred image is one where each pixel resembles the 8 around it. (And possibly the 16 around those, etc.)

Long answer: look up Laplacian and Sobel operators, and convolution filters in general. These operators check the gradient of the colour change in the image and that gradient determines the 'sharpness'. This is a nice site with some examples and the numerical values that were used as the convolution operator. And this is a more formal-looking site with a similar set of data.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]


[edited by - Kylotan on August 5, 2003 9:47:53 AM]
Yanroy
Yanroy
To solve the "vertical bars" problem with the averaging method, you might want to make it reject an average of two colors that are within a certain threshold value of each other. That way same-color regions wouldn''t count as blurry.

--------------------


You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming

You are unique. Just like everybody else.

"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.