••• Science P1.11 Cameras today can correct “red eye” problems caused when the p
ID: 3875564 • Letter: #
Question
••• Science P1.11Cameras today can correct “red eye” problems caused when the photo flash makes eyes look red. Write pseudocode for an algorithm that can detect red eyes. Your input is a pattern of colors, such as that below.
You are given the number of rows and columns. For any row or column number, you can query the color, which will be red, black, or something else. If you find that the center of the black pixels coincides with the center of the red pixels, you have found a red eye, and your output should be “yes”. Otherwise, your output is “no”. Please answer this question with an algorithm and brief explanation.
Explanation / Answer
RED EYE EFFECT
This section explain the cause of red-eye effect first and describe the methods of handling red-eye effect
Cause of Red-eye Effect
Red-eye effect results from flash light of a camera. When it is dark, pupils of eyes are enlarged. Through the enlarged pupils, flash light from a camera passes the eye lens and is reflected back. This reflected light is blood-color since it is reflected from the blood vessels inside an eye. Fig. 1 describes the geometric situation in which red-eye effect occurs. The light reflected from the eye composes the red-eye beacon. If a camera lens which receives the light is located inside the red-eye beacon, pupils in the picture look red. In other words, red-eye effect occurs if
x<rc/2
Where x is the distance between a camera lens and flash light, and rc is the radius of the red-eye beacon at the camera position is shown in figure
where lp, lc, and rp denote the diameter of eye sphere, the distance between an eye and a camera, and radius of pupil, respectively. From equation (1) and (2), it is noted that red-eye effect can occur more frequently when x is small and lc and rp are large.
Methods for Red-Eye Removal
First one is to prevent the red-eye by avoiding the situation physically that satisfies the inequality in (1). We can increase the distance between flash and lens (x) so that the lens is located outside the red-eye beacon. However, the size of a camera should be large enough. Or we can also make the size of pupil (rp) small by using pre-exposure flash. Camera will consume much power and people feel annoyed when seeing the pre-exposure flash. Second, red-eye effect can be removed by software algorithms.
PROPOSED RED-EYE DETECTION
This section describes a proposed red-eye detection algorithm. The proposed red-eye detection algorithm is composed of three modules: face detection, redeye detection, and region-growing. When an image, Iin, is given as input, faces are detected and eye regions, Rf are defined. Then, red-eye regions, Rr, are searched inside Rf. Red-eye regions are expanded to Rr by a regiongrowing method for the next step of red-eye correction.
Red-Eye Detection
Red-eyes are detected by using features of redeye extracted from the eye region Figure 3 shows an example of the red-eye detection process. B
Redness detection
Redness is the primary feature for red-eye detection. Redness is defined as
Where R, G, and B denote red, green, and blue components, respectively, and kr is a constant to avoid zero denominator. The pixel at (x, y) is considered red if
redness(x, y) > r1
Where the value of redness threshold, r1 is adjusted experimentally. Figure 3(b) shows the result of redness detection from an eye region in
Algorithm for red eye removel
Resultant of Red Eye Detection
In STOIK, the detection rate of red eye is 92.22% and false alarm rate is 24.44%.But in the proposed System the detection of red eye rate is increased as 93.33% and false alarm rate is decreased to 13.3%.The comparison results for Red Eye Detection are shown in the Table II.The performance is evaluated by Detection rate and number of false alarms.Detection rate is determined by the ratio of the number of correctly found red-eyes to the total number of eyes. Red eye images are used to determine the detection rate.Non red eye imaged are used to test the false alarms.
PROPOSED RED-EYE CORRECTION
The proposed correction algorithm uses a in painting algorithm to correct the red-eye region while other algorithm simply desaturates the red color components.
Iris Detection
Size of iris depends on person and scale of an input image. Since it is difficult to detect iris directly. It is determined by following steps.
Canny edge detection
Canny edge detector is applied to the red-eye region mask in order to detect the boundary of the red-eye region. Since the mask is binary, clear boundary can be obtained.
Hough Transformation
Detected red-eye regions often do not have circular shape. We cannot get the accurate center position and radius of the iris from the crooked shape of detected region. Thus, we detect the most similar circle with the red-eye region by using Hough transformation. Figure 11 shows the result of Hough transformation.
Inpainting
Inpainting is a restoring process of damaged parts of an image. Here, red-eye regions can be thought of as damaged regions or missing regions. The regions lost their own color and texture in part by red-eye effect and expanded pupil in dark environment. However, since we deal with the special case of red-eye regions, the filling order is to be decided differently. Sides of iris and pupil are in touch with sclera while top and bottom of them are covered in part. Rr denotes the red-eye region with the center at xc. u is the candidate pixel to be inpainted while v is one of neighbor pixels of u. And u and v are the patches, of which u and v are the center pixels, respectively. The pixel to be inpainted is chosen among the boundary of red-eye region, Rr , and the priority of the pixel, P(u) is decided by the horizontal and vertical distances between u and xc as
Where, is multiplied by the horizontal distance to give more weight and set to 1000 in our experiment.The most similar patch is searched in the neighbourhood of u.u’ is
The resultant after applying the inpainting is shown in the figure 15
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.