It's not a problem in digital images. For us, red-eyed automatic rule is true key. The author is a beginner of pattern recognition. This article is in the throwing brick, I hope that the masters will be enlightened and propose better.
Before explaining the red eye, I will spend a small amount of red eye knowledge I know.
The red eye is now generally considered to be caused by sudden contraction of the pupil after the vital object is illuminated by the flash, and it is to be noted that the generation of red-eye phenomena is related to the individual itself. Therefore, the current digital camera generally uses the prevail method, which can more effectively prevent the generation of red-eye phenomena.
Once the red-eye phenomenon is now produced, the method generally adopted is to replace the red in color, which is very obvious, and it is possible to avoid the imaginary phenomenon of darkness in the eyes caused by red eye reflective.
However, this way to remove red-eye is obviously defective, a large part of the reason is that such a method is not linked around, so it seems not natural. Here, the method and common methods I have differ, using a deformation of the grayscale operation to the red channel: (g * 59 b * 11) Div 70. Such an operation can basically find the correct red channel. However, such an operation completely ignores the role of the wrong red channel, it is obviously not perfect enough, so I joined the red channel: R (R - Max (G, B)) / 112 * ((g * 59 B * 11) DIV 70 - R). Such an operation uses constants 112, 59, 11, 70, but the effect is very clear, and the error is lowered after using the red passage.
The above is some basic knowledge about red eyes. Below, we will enter the topic, how to automatically remove red eyes.
Here is a red eye picture, we will explain this red eye picture as an example of explanation.
Through the analysis example, it is easy to know: red eye is red, so you can first extract the red area to roughly get the red eye area and avoid discussing additional overhead caused by other parts. Of course, this choice is also unexpected, that is, the red eye is very Absolute picture will be ignored.
How to extract the red area? There are several ways to take the difference between grayscale and red, one is poor in red and other two colors, and I am using the maximum value in red and other two colors. Due to the difference, so that the outline of the extracted is not obvious, so you can take a constant to increase the brightness of the red. In this way, the example can be converted to the red mask area below.
Extract your eyes in the red mask area.
Now we analyze the characteristics of your eyes. It can be found that an important feature of the eye is that there is dark eyeball in the middle of the eyes, and there is white eye. Now, this feature is used to perform the first step of the eye. Cyclic search for each color biaden point (insert: eyes can be known according to common sense, bottom, left, right there is white eyes, in order to judge correct, as long as there is any side of the left and right). Judging whether the method I use is to first determine whether the gradation is greater than 128, then determines whether other colors and the difference between the grayscale are within a constant, if there is a white eye. This can be determined approximately the eye, then enter the next step to determine the eye boundary. Because the red eye generally only appears in the middle part of the black eyeball, the determination of the eye boundary here is actually determined to remove the boundary of the red eye. This determination method is simple, still looping to search for no color is not too red, this point is the edge.
Next, it is more important to determine if this is red eye. The previous process is reached, but it is just a screening, which will be possible to screen it. Try to use a circularity to judge because the very important feature of the eye is that the black eye bead is round. But unfortunately, I tried that the effect of this method is not good, so I use the original approach to perform mode comparison. Simple words only, in this rectangular space with the edge of the search for the edge and the red eye, see if it matches, this is very abstract, see the picture below. If the statistical difference is within a certain constant range, we approximate this image as a circular, so that the method is more than the circularity here is a large part of the eye round portion in red. The area is connected to other parts, so it is easy to judge, and the words that use such a method will have such concerns.
It is easy to use the R (R-Max (G, B)) / 112 * described above, which can be used, can be used to use the R (((G * 59 B * 11) Div 70 - R) formula described above. operating.
In order to improve the recognition rate, the picture should be preprocessed in principle. Analysis can be found that there is no red eye in the red eye of some red eye pictures, which has a certain amount of trouble on the later treatment, and the solution is achieved by a convolved blur deformation, this convolution formula is: [1, 2, 1] [2, 0, 2] [1, 2, 1]
This formula ignores a point in the middle of the convolution, and can effectively avoid the above problems.
In addition, the difference in red areas and other regions can be provided with a method of saturation adjustment.
What's more, I have tried to use image color balanced images to make red eye identification, and it has improved the identification rate to a certain extent. The automatic image color balance is interested in readers can explore themselves.
In fact, the above method can reach more than 80% of the recognition rate, and below is some comparison pictures, which can be explained.
->
->
The fact that the method described above is still useful to a certain extent, of course, I hope that everyone can study more complete automatic anti-eye method.