A New and Exciting Method. The Isophote.

by Joe

Some few of you may recall one of my previous posts (Success! Joe’s new method.) I outlined and implemented a technique to detect circles. My idea was to consider pairs of adjacent pixels, and calculate where their gradients intersected, thus giving an approximate centre for any dark circles they lay on. Well, I was reading a paper recently, and it outlined a very similar method, but instead of considering two pixels, you considered only one (something that I had assumed was possible, but had no idea how to do).

First the paper introduced the concept of an isophote. This is simply an area of constant darkness/intensity. So if our image is described by a function f(x,y), then we have an isophote at (x,y) where f(x,y) = f0 (f0 is constant). This is essentially describing contours. It then goes on to use the curvature of each pixel, assuming it is on an isophote, to estimate the radius of the circle it is on. Curvature is the second derivative of y with respect to x, and a formula for this can be derived from the definition of an isophote using total derivatives (as f = a constant, we have y(x), so we must use the total derivative, paying attention to the chain rule). The radius of the circle that it is on is given by 1/curvature, which is very convenient. To convince yourself of this, try plugging the values x = 0, y = r into the definition of curvature, and you should get 1/r. Easy. So now we have the distance to the centre. The direction to the centre is given by the gradient at that point. All it takes is a little trigonometry, and we have an estimate!

So here is a pretty picture of it at work:

It is, granted, imperfect. However I think that is more due to me using bitmaps, and the image when you zoom in being somewhat more square than it should be for a circle. When I get some proper image processing software, I foresee this  method getting better.

Here I have mapped every estimate in blue onto an image of an eye. The paper suggested convolving with the Gaussian functions (Gaussian blur?) so you can see that result here as well:

Not toooo bad, although far from perfect. There is a definite cluster around the eye, but also some clusters around random other bits of skin.

One last note. The paper suggested that the curvature of the pixel is used to determine how much emphasis is put on that estimate. (ie to weight each estimate). The forumla, for Intensity of picture I, is sqrt(Ixx^2 + 2Ixy^2 + Iyy^2) (Ix is the partial derivative with respect to x). This is just larger for smaller circles, smaller for larger circles. so smaller circles would have more effect. I am right now unsure about this. More ideas will follow (lol).

Over and out.

Advertisements