Eye Detection Project Report. 7/19/2005 Project Description: 1. Edge Detection - Canny Edge Detector
Eye Detection Project Report. 7/19/2005 Project Description: 1. Edge Detection - Canny Edge Detector
Eye Detection Project Report. 7/19/2005 Project Description: 1. Edge Detection - Canny Edge Detector
7/19/2005
Written By : Itai Bechor Id: 034933564
Project Description:
Eye Detection has many Applications; it can be used for Face Tracking, Recognition,
Personal Identication ,
The Main Goal was to find An Easy Way To detect Eyes In Images , Using the
Following Simple Methods:
1. Edge Detection
2. Hough Circle
3. Label Eyes Circles.
The Canny edge detection algorithm is known to many as the optimal edge detector.
Canny's intentions were to enhance the many edge detectors already out at the time he
started his work. He was very successful in achieving his goal and his ideas and
methods can be found in his paper, "A Computational Approach to Edge Detection".
In his paper, he followed a list of criteria to improve current methods of edge
detection. The first and most obvious is low error rate. It is important that edges
occuring in images should not be missed and that there be NO responses to non-
edges. The second criterion is that the edge points be well localized. In other words,
the distance between the edge pixels as found by the detector and the actual edge is to
be at a minimum. A third criterion is to have only one response to a single edge. This
was implemented because the first 2 were not substantial enough to completely
eliminate the possibility of multiple responses to an edge.
Based on these criteria, the canny edge detector first smoothes the image to eliminate
and noise. It then finds the image gradient to highlight regions with high spatial
derivatives. The algorithm then tracks along these regions and suppresses any pixel
that is not at the maximum (nonmaximum suppression). The gradient array is now
further reduced by hysteresis. Hysteresis is used to track along the remaining pixels
that have not been suppressed. Hysteresis uses two thresholds and if the magnitude is
below the first threshold, it is set to zero (made a nonedge). If the magnitude is above
the high threshold, it is made an edge. And if the magnitude is between the 2
thresholds, then it is set to zero unless there is a path from this pixel to a pixel with a
gradient above T2.
2. The Hough Transform
The Hough transform is a method that, in theory, can be used to find features of any
shape in an image. In practice it is only generally used for finding straight lines or
circles. The computational complexity of the method grows rapidly with more
complex shapes.
Assume we have some data points in an image which are perhaps the result of an edge
detection process, or boundary points of a binary blob. We wish to recognise the
points that form a straight line.
Consider a point (xi, yi) in the image. The general equation of a line is
y = ax + b.
There are infinitely many lines that pass through this point, but they all satisfy the
condition
yi = axi + b
b = -xia + yi,
However, we have a problem with using y = ax + b to represent lines when the line is
vertical. In that case and our parameter space is unbounded (we would need a
very large computer to store our parameter accumulator array!)
where r is the distance of the line from the origin and theta is the angle between this
perpendicular and the x-axis. Our parameter space is now in and r, where
As before, peaks in the accumulator array mark the equations of significant lines.
In theory any kind of curve can be detected if you can express it as a function of the
form
(x - a)2 + (y - b)2 - r2 = 0.
One then has to work in n dimensional parameter space (three dimensional space for a
circle).
This model has three parameters: two parameters for the centre of the circle and one
parameter for the radius of the circle. If the gradient angle for the edges is available,
then this provides a constraint that reduces the number of degrees of freedom and
hence the required size of the parameter space. The direction of the vector from the
centre of the circle to each edge point is determined by the gradient angle, leaving the
value of the radius as the only unknown parameter.
x = a + r cos
and
y = b + r sin.
Solving for the parameters of the circle we obtain the equations
a = x - r cos
and
b = y - r sin.
Now given the gradient angle at an edge point (x,y), we can compute cos and sin.
Note that these quantities may already be available as a by-product of edge detection.
We can eliminate the radius from the pair of equations above to yield
b = a tan- x tan+ y.
Then the Hough Transform algorithm for circle fitting can be described as follows.
Because I'm using a portrait images I'm Assuming the Head (and Though the eyes)
are having a slope of less than 45 degrees. I check For Each Circle If he got a
Friend Circle with that slope , if no I'm filtering him.
I check That Distance is not Two Close Or not Too Far in Each 2 Circles, if I
found a isolated circle that have friend too far ( width /2 ) , because I'm assuming
all the Face Is inside The image , I'll Filter him, Good distance will give points to
the Circles.
I notice in my testing with the hough circle that the area of the eyes gives a lot of
circles in the same place or very close, So I give Points To circles that are
congruent Depending on the number of circles.
The Last Method is checking the Circle Radius ,if The Radius size is closer or
even compatible You get more points . the reason is obvious the eyes are in the
same size and probably the circles of the eyes are pretty much the same size.
The Code :
Since I used the Java Programming language I had a lot of work, because as you
know it's much easier to do it on matlab.
I build An User Friendly Interface ,That allow you to load, and save image results,
and also in the options bar u can see all the 3 stages I talked about earlier in the
project description, Edge detection , hough circle and label eyes circles.
Here is a screenshot:
The Classes are divided to :
Edge_detector.java – that I took the code from the internet ,The canny Edge
Detector.
Results:
Quite good result , Reason : Hough Circle detect eyes , but not so good.
Good result .
Good result .
Good result .
Good result .
Quite good result , Reason : Hough Circle detect eyes , but not so good.
.
Face17.jpg , Resulotion : 224x274
Quite good , Reason : The Circle are very close to the eyes.
Bad result , Reason : Hough Circle doesn't detect eyes so good , and the label also
don't work very good.
Conclusions :
From 20 images : 4 gives good results , 13 gives a bad result , and 3 are quite
good .
That's mean that approximately the success is 30%.
Therefore The Program is not good enough to detect eyes, and need to be
improve :
The Following Methods need to be taken in order to make it work better:
1. using An eye Templates and check the correlation of The pixels to the
template. This could solve the Cases that Label Eyes Circles was unable To
detect the eyes.
Template example:
2 . As you all know there is an effect of red eyes in images , this effect can be used
in order to improve the detection of the circles of the eyes in images using the
hough circle method . But this improvement have to be Hardware improvement.