Tuesday, July 8, 2014

Pre Processing- A necessity

Eye Detection Algorithm 

There is a quite innovative eye center detection algorithm which works on a principle that, for all points lying on a circle, the normal from each point on the circle passes through  the center of the circle.
First we need to define a term, i.e. Gradient vector, so here it goes.

Gradient vector: It is a vector which is normal to the curve the pixel lies on. Therefore for a point on a circle[we don't know the circle yet], if we somehow approximate[even badly], the boundaries of the circle as slight edges[done by some algo], then the gradient vector of the pixel[lying on the circle] would  be in direction perpendicular to edge[the curve the pixel lies on.] and thus would most likely be close to the normal of the point[on the circle], which would mean that it passes through the center.

Now, the main algorithm goes something like this:

 First gradients are found at each pixel in the region where the eye lies[rectangle can be generated by some heuristic]. Therefore, if no edge passes through that pixel, then the pixel's gradient is zero.
now randomly choose a center. For that center, for every other pixel, compute the normalized distance vector from the center to that pixel. Now, take the dot product of this distance vector with the gradient of the pixel in question. Do this in  iterative manner for all pixels for this center and keep adding all the values. Repeat this whole process for different center positions. Whichever center in your search space gives this highest cumulative value, is most likely the circle center.
/*Give the link of the paper which introduced this thing*/


Histogram Equilization 

Trivial technqiue don't fully exploit the capability of histogram equilization. They are usually used to smoothen the image of any drastic lighting variations across the image. However a paper discovered a awesome way to apply it to an image. So here it goes:

Divide the image vertically in 2 regions, symmetric about the nose. Now apply histogram equilization on both the regions separately in the following manner.
For the left eye region, make the image go from dark to lighter as we move from the left eye towards the nose.
Similarly for the right eye region, make the image go from dark to lighter as we move from the right toward the nose.

Also apply it on the whole face, starting from darker at the sides and becoming lighter as we move towards the center[nose]