1. Field of the Invention
The present invention relates to a method, an apparatus, and a program for detecting the positions of eyes within images, in which red eye phenomena are present.
2. Description of the Related Art
There are cases in which pupils (or portions of pupils) of people or animals, photographed by flash photography at night or in dark places, are photographed as being red or gold. For this reason, various methods for correcting the color of pupils, which have been photographed as being red or gold (hereinafter, cases in which pupils are photographed as being gold are also referred to as “red eye”), to normal pupil colors by digital image processing have been proposed.
For example, Japanese Unexamined Patent Publication No. 2000-013680 discloses a method and apparatus for automatically discriminating red eyes. This method and apparatus automatically discriminate red eyes based on colors, positions, and sizes of pupils within a region specified by an operator. Japanese Unexamined Patent Publication No. 2001-148780 discloses a method wherein: predetermined characteristic amounts are calculated for each pixel within a region specified by an operator; and portions having characteristics that correspond to pupil portions are selected as targets of correction. However, in discriminating processes which are based solely on characteristics of pupil portions, it is difficult to discriminate targets having local redness, such as red lighting, from red eyes. For this reason, it is difficult for this process to be executed automatically, without operator intervention.
On the other hand, Japanese Unexamined Patent Publication No. 2000-125320 discloses a method wherein: faces are detected first; and red eye detection is performed within regions detected to be faces. In this method, false positives, such as red lights being detected as red eyes, does not occur. However, if errors occur during face detection, red eyes cannot be accurately detected. Therefore, the accuracy of the facial detection becomes an issue.
The simplest method for detecting faces is to detect oval skin colored regions as faces. However, people's faces are not necessarily uniform in color. Therefore, it is necessary to broadly define “skin color”, which is judged to be the color of faces. However, the possibility of false positive detection increases in the case that the range of colors is broadened in a method that judges faces based only on color and shape. For this reason, it is preferable that faces are judged utilizing finer characteristics than just the color and the shapes thereof, in order to improve the accuracy of facial detection. However, if characteristics of faces are extracted in detail, the time required for facial detection processes greatly increases.
That is, the method disclosed in Japanese Unexamined Patent Publication No. 2000-125320 is capable of detecting red eyes with high accuracy, yet gives no consideration to processing time. In the case that the method is applied to an apparatus having comparatively low processing capabilities (such as a low cost digital camera), the apparatus cannot function practically.
A method may be considered, in which red eye candidates are detected with comparatively less stringent conditions, in order to detect red eyes in a short amount of time with a small amount of calculations. Then, faces are detected in the vicinities of the detected red eye candidates. Thereafter, red eyes are confirmed within the detected facial regions, by judging the red eye candidates with conditions more stringent than those employed during detection of the red eye candidates. According to this method, first, the red eye candidates are detected, then the faces are detected in the vicinities thereof. Therefore, faces can be detected in a short amount of time and with high accuracy. Thereafter, red eyes are confirmed within the detected facial regions, by judging the red eye candidates with conditions more stringent than those employed during detection of the red eye candidates. Therefore, red eyes can be detected efficiently.
The purpose of red eye detection is to correct the detected red eyes to the original colors of pupils. Therefore, whether the detected red eyes are true red eyes greatly influences the impression given by an image following correction. A method may be considered, in which an operator confirms whether the detected red eyes are true red eyes. However, this method is time consuming, and would increase the burden on the operator. Accordingly, it is desired for confirmation of the detection results to be performed automatically.
There are cases in which the whites of the eyes are pictured red, as factors that cause false positive detection in red eye detection. That is, there are cases in which the corners of the eyes, which should be pictured white, are pictured red. If the corners of the eyes are erroneously detected as red eyes, correction would fill the whites of the eyes such that they are colored black, which would appear even more unnatural than red eye. That is, there are people, for whom the red portions at the interiors of the corners of the eyes (portions denoted by A and B in
The present invention has been developed in view of the foregoing circumstances. It is an object of the present invention to provide a red eye detecting method, a red eye detecting apparatus, and a red eye detecting program that prevent false positive detection of red eyes.
The red eye detection method of the present invention comprises the steps of:
detecting red eye candidates, by discriminating characteristics inherent to pupils, of which at least a portion is displayed red, from within an image;
detecting faces that include the red eye candidates, by discriminating characteristics inherent to faces, from among characteristics of the image in the vicinities of the red eye candidates;
estimating that the red eye candidates included in the detected faces are red eyes; and
confirming the results of estimation, by judging whether the red eye candidates are the corners of eyes.
The estimation of red eyes from among the red eye candidates may be performed by:
discriminating characteristics inherent to pupils, of which at least a portion is displayed red, from the characteristics of the image in the vicinities of the red eye candidates at a higher accuracy than that employed during the detection of the red eye candidates; and
estimating that the red eye candidates having the characteristics are red eyes.
The red eye candidates may be detected by:
setting judgment target regions within the image;
obtaining characteristic amounts that represent characteristics inherent to pupils having regions displayed red from within the judgment target regions;
calculating scores according to the obtained characteristic amounts; and
judging that the image within the judgment target region represents a red eye candidate when the score is greater than or equal to a first threshold value. In this case, the results of estimation may only be confirmed for red eye candidates, of which the score is less than a second threshold value, which is greater than the first threshold value.
During the judgment, dark pupils may be detected within the detected facial region. In the case that dark pupils are detected, the red eye candidates, which have been estimated to be red eyes, may be judged too be the corners of eyes.
In this case, the detection of dark pupils may be performed by:
defining characteristic amounts that represent likelihood of being a dark pupil, a score table, and a threshold value, by learning sample images of dark pupils and sample images of subjects other than dark pupils, with a machine learning technique;
calculating the characteristic amounts from within the judgment target regions;
calculating scores corresponding to the characteristic amounts according to the score table; and
detecting dark pupils, by judging that the image within the judgment target region represents a dark pupil when the score is greater than or equal to the threshold value.
Alternatively, during judgment, a pixel value profile may be obtained, of pixels along a straight line that connects two red eye candidates, which have been estimated to be red eyes; and
the judgment regarding whether the red eye candidates are the corners of eyes may be performed employing the pixel value profile.
In this case, the judgment may be performed by confirming which profile the pixel value profile is, from among: a profile in the case that the two red eye candidates are true red eyes; a case that the two red eye candidates are the inner corners of eyes; and a case that the two red eye candidates are the outer corners of eyes.
The red eye detecting apparatus of the present invention comprises:
red eye candidate detecting means for detecting red eye candidates, by discriminating characteristics inherent to pupils, of which at least a portion is displayed red, from within an image;
face detecting means for detecting faces that include the red eye candidates, by discriminating characteristics inherent to faces, from among characteristics of the image in the vicinities of the red eye candidates;
red eye estimating means for estimating that the red eye candidates included in the detected faces are red eyes; and
result confirming means for confirming the results of estimation, by judging whether the red eye candidates are the corners of eyes.
A configuration may be adopted, wherein:
the red eye estimating means discriminates characteristics inherent to pupils, of which at least a portion is displayed red, from the characteristics of the image in the vicinities of the red eye candidates at a higher accuracy than that employed during the detection of the red eye candidates; and estimates that the red eye candidates having the characteristics are red eyes.
A configuration may be adopted, wherein the red eye candidate detecting means detects red eye candidates by:
setting judgment target regions within the image;
obtaining characteristic amounts that represent characteristics inherent to pupils having regions displayed red from within the judgment target regions;
calculating scores according to the obtained characteristic amounts; and
judging that the image within the judgment target region represents a red eye candidate when the score is greater than or equal to a first threshold value; and
the result confirming means confirms the results of estimation only for red eye candidates, of which the score is less than a second threshold value, which is greater than the first threshold value.
A configuration may be adopted, wherein:
the result confirming means further comprises dark pupil detecting means for detecting dark pupils within the face region detected by the face detecting means; and
the judgment regarding whether the red eye candidates, which have been estimated to be red eyes, are the corners of eyes is judged in the case that dark pupils are detected.
In this case, the dark pupil detecting means may detect dark pupils by:
defining characteristic amounts that represent likelihood of being a dark pupil, a score table, and a threshold value, by learning sample images of dark pupils and sample images of subjects other than dark pupils, with a machine learning technique;
calculating the characteristic amounts from within the judgment target regions;
calculating scores corresponding to the characteristic amounts according to the score table; and
judging that the image within the judgment target region represents a dark pupil when the score is greater than or equal to the threshold value.
A configuration may be adopted, wherein:
the result confirming means comprises a profile obtaining means for obtaining a pixel value profile of pixels along a straight line between two red eye candidates, which have been estimated to be red eyes by the red eye estimating means; and
the judgment regarding whether the red eye candidates are the corners of eyes is performed employing the pixel value profile obtained by the profile obtaining means.
In this case, the result confirming means may judge whether the red eye candidates are the corners of eyes, by confirming which profile the pixel value profile is, from among: a profile in the case that the two red eye candidates are true red eyes; a case that the two red eye candidates are the inner corners of eyes; and a case that the two red eye candidates are the outer corners of eyes.
Note that the red eye detecting method of the present invention may be provided as a program that causes a computer to execute the method. The program may be provided being recorded on a computer readable medium. Those who are skilled in the art would know that computer readable media are not limited to any specific type of device, and include, but are not limited to: floppy disks; RAM's; ROM's; CD's; magnetic tapes; hard disks; and internet downloads, by which computer instructions may be transmitted. Transmission of the computer instructions through a network or through wireless transmission means is also within the scope of the present invention. In addition, the computer instructions may be in the form of object, source, or executable code, and may be written in any language, including higher level languages, assembly language, and machine language.
According to the present invention, red eye candidates, which have been estimated to be red eyes, are judged to determined whether they are the corners of eyes. Therefore, confirmation of the estimation results is performed, and false positive detection can be prevented.
Hereinafter, preferred embodiments of the present invention will be described with reference to the attached drawings.
[Outline of Red Eye Detecting Procedure]
First, the outline of a red eye detecting process will be described with reference to
The red eye candidate detecting step 1 searches for portions of the image S which may be estimated to be red eyes (red eye candidates). In cases in which red eye candidates are found, the positional coordinates of the red eye candidates are recorded in a recording medium. Because red eyes, of which the sizes and orientations are unknown, are to be detected from the entirety of the image S in the red eye candidate detecting step 1, processing efficiency is prioritized above detection accuracy. In the present embodiment, the red eye candidate detecting step 1 judges that pupils exist, based only on the characteristics thereof. For this reason, in the case that the image of
The face detecting step 2 searches for portions, which are estimated to be faces, from within the image S. However, the search for the faces is performed only in the peripheral regions of the red eye candidates, which have been detected in the red eye candidate detecting step 1. In the case that the red eye candidates are true red eyes, faces necessarily exist in their peripheries. In the case that portions which are likely to be faces are found during the face detecting step 2, information, such as the size of the face and the orientation thereof, are recorded in the recording medium, correlated with the red eye candidates that served as the reference points for the face search. On the other hand, in the case that no portions which are likely to be faces are found, information related to the red eye candidates that served as the reference points for the face search is deleted from the recording medium.
In the case that the image of
The red eye estimating step 3 judges whether the red eye candidates, which have been correlated with faces in the face detecting step 2, can be estimated to be true red eyes. In the case that the candidates can be estimated to be true red eyes, their positions are also accurately confirmed.
The red eye estimating step 3 utilizes the results of the face detecting step 2. Specifically, information regarding detected faces are utilized to estimate sizes and orientations of red eyes, thereby narrowing down regions which are likely to be red eyes. Further, the positions of red eyes are estimated based on information regarding the detected faces. Then, a detection process having higher accuracy than that of the red eye candidate detecting step 1 is executed within limited regions in the peripheries of the positions.
In the case that red eye candidates are judged not to be able of being estimated as true red eyes during the red eye estimating step 3, information related to the red eye candidates is deleted from the recording medium. On the other hand, in the case that red eye candidates are judged to be able of being estimated as true red eyes, the accurate positions thereof are obtained.
The positions of red eye candidates are evaluated utilizing the information regarding the detected faces in the red eye estimating step 3. In the case that the red eye candidates are located at positions which are inappropriate for eyes within faces, information related to the red eye candidates is deleted from the recording medium.
For example, in the case that a rising sun (a red circular mark) is painted on a person's forehead, the red eye candidate detecting step 1 will detect the mark as a red eye candidate, and the face detecting step 2 will detect a face in the periphery of the mark. However, it will be judged that the red eye candidate is located in the forehead, which is an inappropriate position for eyes, during the red eye estimating step 3. Therefore, information related to the red eye candidate is deleted from the recording medium.
In the case of the image of
The result confirming step 4 confirms whether the red eye candidates estimated as being red eyes by the red eye estimating step 3 are true red eyes. Specifically, the result confirming step 4 confirms the results of estimation, by judging whether the red eye candidates are actually the corners of eyes. In the case that the results of estimation by the red eye estimating step 3 are correct, the result confirming step 4 outputs results indicating that red eyes have been detected, and data representing the positions of the red eyes, obtained by the red eye estimating step 3, as detection results K. On the other hand, in the case that the results of estimation by the red eye estimating step 3 are erroneous, the result confirming step 4 outputs results indicating that red eyes have not been detected as detection results K.
An apparatus for detecting red eyes by the above process may be realized by loading a program that causes execution of each of the aforementioned steps into an apparatus comprising: a recording medium, such as a memory unit; a calculating means for executing processes defined by the program; and an input/output interface for controlling data input from external sources and data output to external destinations.
Alternatively, an apparatus for detecting red eyes by the above process may be realized by incorporating a memory/logic device, designed to execute the red eye candidate detecting step 1, the face detecting step 2, and the red eye estimating step 3, into a predetermined apparatus.
In other words, not only general use computers, but any apparatus, in which programs or semiconductor devices can be loaded, even if they are built for other specific uses, may function as an apparatus for detecting red eyes by the above process. Examples of such apparatuses are digital photographic printers and digital cameras.
[Red Eye Candidate Detecting Step 1]
Next, the red eye candidate detecting step 1 will be described in detail. During the red eye candidate detecting step 1, the red eye detecting apparatus first converts the color space of an obtained image. Specifically, the display color system of the image is converted, by replacing the R (red), G (green), and B (blue) values of each pixel in the image with Y (luminance), Cb (color difference between green and blue), Cr (color difference between green and red), and Cr* (color difference between skin color and red) by use of predetermined conversion formulas.
YCbCr is a coordinate system which is commonly utilized in JPEG images. Cr* is a coordinate axis that represents a direction in which red and skin color are best separated within an RGB space. The direction of this coordinate axis is determined in advance, by applying a linear discriminant analysis method to red samples and skin colored samples. By defining this type of coordinate axis, the accuracy of judgment, to be performed later, is improved compared to cases in which judgment is performed within a normal YCbCr space.
The determination regarding how many characteristics of red eye are present within the judgment target region 8 is performed in the following manner. First, characteristic amounts that represent likelihood of being red eyes, scores corresponding to the value of the characteristic amounts, and a threshold value are defined in advance. For example, if pixel values are those that represent red, that would be grounds to judge that red eye exists in the vicinity of the pixels. Accordingly, pixel values may be characteristic amounts that represent likelihood of being red eyes. Here, an example will be described, in which pixel values are defined as the characteristic amounts.
The score is an index that represents how likely red eyes exist. Correlations among scores and characteristic amounts are defined. In the case of the above example, pixel values, which are perceived to be red by all viewers, are assigned high scores, while pixel values, which may be perceived to be red by some viewers and brown by other viewers, are assigned lower scores. Meanwhile, pixel values that represent colors which are clearly not red (for example, yellow) are assigned scores of zero or negative scores.
Whether the image within the judgment target region 8 represents red eyes is judged in the following manner. First, characteristic amounts are calculated for each pixel within the judgment target region 8. Then, the calculated characteristic amounts are converted to scores, based on definitions such as those exemplified in the score table of
As is clear from the above description, the accuracy of judgment in the above process depends greatly on the definitions of the characteristic amounts, the score table, and the threshold value. For this reason, the red eye detecting apparatus of the present embodiment performs learning, employing sample images of red eyes and sample images of other subjects (all of which are 10 pixels×10 pixels). Appropriate characteristic amounts, score tables, and threshold values, which are learned by the learning process, are employed in judgment.
Various known learning methods, such as a neural network method, which is known as a machine learning technique, and a boosting method, may be employed. Images, in which red eyes are difficult to detect, are also included in the sample images utilized in the learning process.
For example, the sample images utilized in the learning process may include: standard sample images, as illustrated in
The sample images are utilized in the learning process, and effective characteristic amounts are selected from among a plurality of characteristic amount candidates. The judgment process described above is repeated, employing the selected characteristic amounts and score tables generated therefor. The threshold value is determined so that a predetermined percentage of correct judgments is maintained during the repeated judgments.
At this time, the red eye detecting apparatus of the present embodiment performs N types of judgment (N is an integer greater than or equal to 2) on individual judgment target regions, utilizing N types of characteristic amounts, score tables, and threshold values. The coordinates of judgment target regions are registered in a red eye candidate list only in cases in which all of the N judgments judge that red eye is present. That is, the accuracy of judgment is improved by combining the plurality of types of characteristic amounts, score tables, and threshold values, and only reliable judgment results are registered in the list. Note that here, “registered in a red eye candidate list” refers to recording positional coordinate data and the like in the recording medium.
In the case that the first red eye judgment process judges that red eye exists, the same judgment target region is subjected to a second judgment, referring to a second type of characteristic amount calculating parameters, score table, and threshold value. In the case that the first red eye judgment process judges that red eye is not present, it is determined at that point that the image within the judgment target region does not represent red eye, and a next judgment target region is set.
Thereafter, in cases that red eye is judged to exist by an (i−1)th judgment process (2≦i≦N), the same judgment target region is subjected to an ith judgment process, referring to an ith type of characteristic amount calculating parameters, score table, and threshold value. In cases that an (i−1)th judgment process judges that red eye is not present, then judgment processes for that judgment target region are ceased at that point.
Note that at each judgment, characteristic amounts are calculated for each pixel (step S101), the characteristic amounts are converted to scores (step S102), and the scores of all of the pixels within the judgment target region are totaled (step S103). If the total value of the scores is greater than or equal to the threshold value, the subject of the image within the judgment target region is judged to be a red eye; and if the total value of the scores is less than the threshold value, it is judged that the image does not represent a red eye (step S104).
The red eye detecting apparatus registers coordinates of judgment target regions in a red eye candidate list, only in cases in which an Nth judgment, which refers to an Nth type of characteristic amount calculating parameter, score table, and threshold value, judges that red eye is present.
In the judgment process described above, it is assumed that red portions included in the image S are of sizes that fit within a 10 pixel×10 pixel region. In actuality, however, there are cases in which a red eye 7d included in the image S is larger than the 10 pixel×10 pixel judgment target region 8, as illustrated in
As illustrated in
Note that judgments may be performed by moving the judgment target region 8 in small increments (for example, increments of 1 pixel each). In these cases, a single red eye may be redundantly detected by judgment processes for different judgment target regions 9 and 10, as illustrated in
For this reason, the red eye detecting apparatus of the present embodiment confirms the coordinate information registered in the red eye candidate list after scanning of the judgment target region is completed for all images having different resolutions. In cases that a plurality of pieces of coordinate information that clearly represent the same red eye are found, only one piece of the coordinate information is kept, and the other pieces are deleted from the list. Specifically, the piece of coordinate information that represents the judgment target region having the highest score total is kept as a red eye candidate, and the other candidates are deleted from the list.
The red eye candidate list, which has been organized as described above, is output as processing results of the red eye candidate detecting step 1, and utilized in the following face detecting step 2.
In the red eye candidate detecting step of the present embodiment, processing time is reduced without decreasing the accuracy of detection. This is accomplished by adjusting the resolution of images employed in the detection, the manner in which the judgment target regions are set, and the order in which the N types of characteristic amount calculating parameters are utilized. Hereinafter, methods for improving the processing efficiency of the red eye candidate detecting step will be described further.
[Methods for Improving Red Eye Candidate Detection Efficiency]
The methods for improving the efficiency of the red eye candidate detecting step described below may be employed either singly or in combinations with each other.
A first method is a method in which characteristic amounts are defined such that the amount of calculations is reduced for judgments which are performed earlier, during the N types of judgment. As has been described with reference to
The definition of the characteristic amounts described above, in which the characteristic amounts are defined as the values of pixels (x, y), is the example that involves the least amount of calculations.
Another example of characteristic amounts which may be obtained with small amounts of calculations is differences between pixel values (x, y) and pixel values (x+dx, y+dy). The differences between pixel values may serve as characteristic amounts that represent likelihood of being red eyes, because colors in the periphery of pupils are specific, such as white (whites of the eyes) or skin color (eyelids). Similarly, combinations of differences between pixel values (x, y) and pixel values (x+dx1, y+dy1) and differences between pixel values (x, y) and pixel values (x+dx2, y+dy2) may also serve as characteristic amounts that represent likelihood of being red eyes. Combinations of differences among four or more pixel values may serve as characteristic amounts. Note that values, such as dx, dx1, dx2, dy, dy1, and dy2, which are necessary to calculate the characteristic amounts, are recorded as characteristic amount calculating parameters.
As an example of characteristic amounts that require more calculations, averages of pixel values within a 3×3 pixel space that includes a pixel (x, y) may be considered. Combinations of differences among pixel values in the vertical direction and the horizontal direction, within a 3×3 pixel space having a pixel (x, y) at its center, may also serve as characteristic amounts. The difference among pixel values in the vertical direction may be obtained by calculating weighted averages of the 3×3 pixels, employing a filter such as that illustrated in
There are characteristic amounts that require even more calculations. Gradient directions of pixels (x, y), that is, the directions in which the pixel value (color density) changes, may be obtained from values calculated by employing the filters of
A second method is based on the same principle as the first method. The second method classifies characteristic amounts in to two groups. One group includes characteristic amounts that require relatively small amounts of calculations, and the other group includes characteristic amounts that require large amounts of calculations. Judgment is performed in steps. That is, the judgment target region is scanned on the image twice.
In the second method, the judgment processes employing the characteristic amounts that require large amounts of calculations are executed on a limited number of judgment target regions. Therefore, the amount of calculations can be reduced as a whole, thereby improving processing efficiency. In addition, in the second method, the judgment results obtained by the first scanning may be output to a screen or the like prior to performing the second detailed judgment. That is, the amount of calculations in the first method and in the second method is substantially the same. However, it is preferable to employ the second method, from the viewpoint of users who observe reaction times of the red eye detecting apparatus.
Note that the number of groups that the characteristic amounts are classified in according to the amount of calculations thereof is not limited to two groups. The characteristic amounts may be classified into three or more groups, and the judgment accuracy may be improved in a stepwise manner (increasing the amount of calculations). In addition, the number of characteristic amounts belonging to a single group may be one type, or a plurality of types.
A third method is a method wherein the judgment target region is moved two or more pixels at a time during scanning thereof, as illustrated in
A fourth method is a method wherein judgment processes are performed on a lower resolution image first. Judgment target regions are relatively larger with respect to lower resolution images as compared to higher resolution images. Therefore, larger portions of the image can be processed at once. Accordingly, judgment is performed on a lower resolution image first, and regions in which red eyes are clearly not included are eliminated. Then, judgment is performed on a higher resolution image only at portions that were not eliminated by the first judgment.
The fourth method is particularly effective for images in which people with red eyes are pictured at the lower halves thereof, and dark nightscapes are pictured at the upper halves thereof.
As is clear from
Next, a fifth method, which is effective if used in combination with the third or the fourth method, will be described with reference to
For example, consider a case in which a red eye candidate having a pixel 14 at its center is detected by the third or fourth method. In this case, a judgment target region 15 is set so that the pixel 14 is at the center thereof. Then, judgment is performed employing the same characteristic amounts, score table, and threshold value as the previous judgment, or by employing characteristic amounts, score table, and threshold value having higher accuracy. Further, a highly accurate judgment is also performed within a judgment target region 17, having a pixel 16, which is adjacent to the pixel 14, at the center thereof.
In a similar manner, judgment target regions are set having the other 7 pixels adjacent to the pixel 14 at the centers thereof, and judgments regarding whether red eye exists therein are performed. Alternatively, judgment may be performed on the 16 pixels that are arranged so as to surround the 8 pixels adjacent to the pixel 14. As a further alternative, a plurality of judgment target regions that overlap at least a portion of the judgment target region 15 may be set, and judgment performed thereon.
In the case that a different red eye candidate is detected during the search of the peripheral region of the red eye candidate, the coordinates of the different red eye candidate (for example, the coordinates of the pixel 16) are added to the list. By searching the peripheral region of the red eye candidate in detail, the accurate position of the red eye candidate may be obtained.
Note that in this case, a single redeye is redundantly detected. Therefore, the aforementioned organization is performed after searching is complete. Specifically, coordinates of the judgment target region having the highest score total, from among the coordinates which have been judged to be red eyes and added to the list, is kept as a red eye candidate, and the other coordinates are deleted from the list.
Note that in the fifth method, the accuracy of judgment is increased over the previous judgment when searching for red eye candidates within the narrowed down regions. Thereby, the positional accuracy of the detected red eye candidates is improved. A sixth method, to be described below, is applicable to cases in which the judgment accuracy of the second and following judgments is desired to be improved over that of previous judgments.
In the sixth method, characteristic amounts are classified into two groups, in the same manner as in the second method. One group includes characteristic amounts that require relatively small amounts of calculations, and the other group includes characteristic amounts that require large amounts of calculations.
During the second scanning, judgment target regions are set in the peripheries of the red eye candidates, which have been detected by the first scanning, as described in the fifth method (step S204). Then, judgments are performed (step S206) until there are no more red eye candidates left to process (step S207). Both characteristic amounts that require small-amounts of calculations and those that require large amounts of calculations are employed during the judgments of step S206. However, during the judgment of step S206 employing the characteristic amounts that require small amounts of calculations, the threshold values are set higher than during the judgment of step S202. Specifically, the threshold value is set low during the judgment of step S202, to enable detection of red eyes which are located at positions off center within the judgment target regions. On the other hand, the judgment of step 206 sets the threshold value high, so that only red eyes, which are positioned at the centers of the judgment target regions, are detected. Thereby, the positional accuracy of the red eyes detected in step S206 is improved.
Note that the number of groups that the characteristic amounts are classified in according to the amount of calculations thereof is not limited to two groups. The characteristic amounts may be classified into three or more groups, and the judgment accuracy may be improved in a stepwise manner (increasing the amount of calculations). In addition, the number of characteristic amounts belonging to a single group may be one type, or a plurality of types.
The red eye detecting apparatus of the present embodiment employs the above methods either singly or in combination during detection of red eye candidates. Therefore, red eye candidates may be detected efficiently.
[Face Detecting Step 2]
Next, the face detecting step 2 will be described. The face detecting step 2 sets judgment target regions within the image, and searches to investigate how many characteristics inherent to faces are present in the images within the judgment target regions, in a manner similar to the red eye candidate detecting step 1. The face detecting step 2 is basically the same as the eye detecting algorithm of the red eye candidate detecting step 1. Specifically, the two steps are similar in that: learning employing sample images is performed in advance, to select appropriate characteristic amounts, score tables and the like; optimal threshold values are set based on the learning; characteristic amounts are calculated for each pixel within judgment target regions, converted to scores, the scores are totaled and compared against the threshold values; and searching is performed while varying the resolution of the image.
The face detecting step 2 does not search for faces within the entirety of the image. Instead, the face detecting step 2 employs the red eye candidates, detected by the red eye candidate detecting step 1, as reference points. That is, faces are searched for only in the peripheries of the red eye candidates.
In addition, in the face detecting step 2, scanning of the judgment target region 20 is not limited to horizontal movement in the vicinities of the red eye candidates, as illustrated in
The face detecting step 2 judges whether faces exist within the judgment target region based on characteristic amounts, which are extracted by wavelet conversion.
The red eye detecting apparatus first administers wavelet conversion on Y (luminance) components of the image within the judgment target region (step S301). Thereby, a ¼ size sub band image, an LL0 image, an LH0 image, an HL0 image, and an HH0 image (hereinafter, these will be collectively be referred to as “level 0 images”) are generated. In addition, a 1/16 size sub band image, an LL1 image, an LH1 image, an HL1 image, and an HH1 image (hereinafter, these will be collectively be referred to as “level 1 images”) are generated. Further, a 1/64 size sub band image, an LL2 image, an LH2 image, an HL2 image, and an HH2 image (hereinafter, these will be collectively referred to as “level 2 images”) are generated.
Thereafter, the red eye detecting apparatus employs local scattering to normalize and quantize the sub band images, which have been obtained by wavelet conversion (step S302).
In the case that images are analyzed by wavelet conversion, LH images are obtained, in which the edges in the horizontal direction are emphasized. Further, HL images are obtained, in which the edges in the vertical direction are emphasized. For this reason, characteristic amounts are calculated from within level 0, level 1, and level 2 LH and HL images (step S303) during a face judging process, as illustrated in
In the case that a face is detected by the aforementioned search, the red eye detecting apparatus registers the face in a face list, correlated with the red eye candidate that served as the reference point for the search. In the example illustrated in
In the case that the same face is redundantly detected, the registered information is organized. In the aforementioned example, information regarding the face 21, the red eye candidates 18 and 19 are consolidated into one piece of information. The consolidated information is reregistered in the face list. The face list is referred to in the red eye estimating step 3, to be described below.
[Red Eye Estimating Step 3]
Next, the red eye estimating step 3 will be described. The red eye estimating step 3 judges whether the red eye candidates, which have been correlated with faces and recorded in the face detecting step 2, can be estimated to be true red eyes. In other words, the red eye estimating step 3 investigates the detection results of the red eye candidate detecting step 1. Therefore, it is necessary that the judgment of red eye to be performed more accurately than that performed in the red eye candidate detecting step 1. Hereinafter, the red eye judgment process performed by the red eye estimating step 3 will be described.
During the red eye estimating step 3, the red eye detecting apparatus refers to information regarding the size and orientation of faces, obtained in the face detecting step 2. Thereby, the orientations of the red eye candidates are estimated, and the search regions are set according to the sizes and orientations of the red eye candidates. That is, the search regions are set so that the vertical directions of the pupils match the vertical directions of the search regions. In the example illustrated in
Next, the red eye judgment process performed within the search regions 22 will be described.
Thereafter, characteristic amounts are calculated for each pixel within the judgment target region 23, and the calculated characteristic amounts are converted to scores that represent likelihood of being red eyes by employing a score table, in the same manner as in the red eye candidate detecting step. Then, the red eye candidates are judged to be red eyes if the total value of the scores corresponding to each pixel within the judgment target region exceeds a threshold value. The red eye candidates are judged not to be red eyes if the total value of the scores is less than the threshold value.
The judgment target region 23 is scanned within the search region 22, and the judgment described above is performed repeatedly. In the case of the red eye estimating step 3, red eye candidates are necessarily present within the search region 22, as opposed to the red eye candidate detecting step 1. Accordingly, in the case that judgments are performed by scanning the judgment target region 23 within the search region 22, many judgment results indicating red eye should be obtained. There are cases in which the number of positive judgments indicating red eye is small, regardless of the fact that the judgments were performed by scanning the judgment target region 23 within the search region 22. In these cases, there is a possibility that the red eye candidate 18 is not a true red eye. This means that the number of times that red eye is judged to exist, during scanning of the judgment target region 23, is an effective index that represents the reliability of the detection results of the red eye candidate detecting step 1.
A plurality of images having different resolutions are employed during judgment of red eye in the red eye estimating step 3, in the same manner as in the red eye candidate detecting step 1.
The resolutions of images are finely varied in the red eye estimating step 3, unlike in the red eye candidate detecting step 1. Specifically, the resolution is changed so that the image 24 of
In the examples illustrated in
In the red eye estimating step 3 of the present embodiment, the number of times that red eye was judged to exist within each search region and the number of times that red eye was judged to exist in the images having different resolutions are totaled. This total number is set to be the number of times that the red eye candidate, which served as the reference point for the search regions, was judged to be red eye. If this total number is greater than a predetermined number, it is judged that the red eye candidate is highly likely to be a true red eye, and the red eye candidate is estimated to be a red eye. On the other hand, if the total number is the predetermined number or less, it is judged that the red eye candidate was a false positive detection, and that it is not a true red eye. In this case, the red eye detecting apparatus deletes information regarding the red eye candidate from every list that it is registered in.
In the case that red eye candidates are estimated to be red eyes, the red eye estimating step 3 then confirms the positions of the red eyes. As described above, if judgments are performed by scanning the judgment target region within the search regions, positive judgments are obtained at many judgment target regions. Therefore, the red eye detecting apparatus of the present invention defines a weighted average of the center coordinates of the judgment target regions, in which positive judgments were obtained, as the value that represents the position of the red eye. The weighting is performed corresponding to the total score, which was obtained during judgment, of the judgment target regions.
wherein (xi, yi) are the center coordinates of an i-th judgment target region (0≦i<M), and Si is the total score obtained by the red eye judgment processes in the i-th judgment target region.
Note that the characteristic amounts, the score tables, and the threshold values, which are employed in the red eye estimating step 3 may be the same as those which are employed in the red eye candidate detecting step 1. Alternatively, different characteristic amounts, score tables, and threshold values may be prepared for the red eye estimating step 3.
In the case that different characteristic amounts, score tables, and threshold values are defined for the red eye estimating step 3, only images that represent standard red eyes are employed as sample images during learning. That is, learning is performed using only sample images of red eyes having similar sizes and orientations. Thereby, detection is limited to true red eyes, and the accuracy of judgment is improved.
In the red eye candidate detecting step 1, it is preferable that the variation among sample images, which are employed during learning, is not decreased, because a decrease in variation would lead to red eye candidates not being detected. However, the red eye estimating step 3 is a process that verifies the detection results of the red eye candidate detecting step 1, and employs search regions in the vicinities of the detected red eye candidates. Therefore, the variation among sample images, which are employed during learning, may be comparatively small. In the red eye estimating step 3, the smaller the variation in sample images, which are employed during learning, the stricter the judgment standards become. Therefore, the accuracy of judgment is improved over that of the red eye candidate detecting step 1.
The method of the present embodiment requires the three steps of: red eye candidate detection; face detection; and red eye estimation. Therefore, it may appear that the number of processes is increased compared to conventional methods. However, the amount of calculations involved in the red eye estimating step 3 is far less than that involved in characteristic extraction processes administered on faces. In addition, because the search regions are limited to the vicinities of red eye candidates, neither the amount of processing nor the complexity of the apparatus are greatly increased compared to conventional methods and apparatuses.
[Result Confirming Step 4]
Next, the result confirming step 4 will be described. The foregoing three step process comprising the red eye candidate detecting step 1, the face detecting step 2, and the red eye estimating step 3 yields results that indicate that there are no red eyes in the image S, or that there are red eye candidates, which are highly likely to be red eyes and which have been estimated to be red eyes, in the image S. The result confirming step 4 confirms whether the red eye candidates, which have been estimated to be red eyes, are true red eyes. Specifically, the result confirming step 4 judges whether the red eye candidates which have been estimated to be red eyes are the corners of eyes, and confirms the results based on the results of this judgment. Hereinafter, two examples of methods, by which it is judged whether the red eye candidates estimated to be red eyes are the corners of eyes, will be described.
Meanwhile, in photographic images in which pupils are not pictured as red eyes, dark pupils, which are pictured as their original colors, should be present. The first method pays attention to this fact, and performs the dark pupil detecting step 41a within the face detected by the face detecting step 2. Various known methods may be employed in the dark pupil detecting step. For example, the method employed in the aforementioned red eye candidate detecting step 1 or the method employed in the red eye estimating step 3 may be applied. Here, it is preferable for the method employed in the red eye estimating step 3 to be applied, in order to increase the accuracy of the dark pupil detecting step 41a. Note that in the dark pupil detecting step 41a, the procedures are the same as those employed in the red eye candidate detecting step 1 and the red eye estimating step 3, except that the sample images utilized for learning are sample images of dark pupils instead of red eyes. Therefore, a detailed description of the specific procedures will be omitted.
The confirmation executing step 41b confirms the results of estimation by the red eye estimating step 3, based on the detection results of the dark pupil detecting step 41a. Specifically, if dark pupils are detected in the dark pupil detecting step 41a, the confirmation executing step 41b judges that the red eye candidates estimated to be red eyes in the red eye estimating step 3 are the corners of eyes (more accurately, the red portions at the corners of the eyes), and that the estimation results are erroneous. On the other hand, if dark pupils are not detected in the dark pupil detecting step 41a, the confirmation executing step 41b judges that the red eye candidates estimated to be red eyes in the red eye estimating step 3 are not the corners of eyes, but true red eyes. In the case that it is judged that the results of estimation are erroneous, the confirmation executing step 41b outputs data indicating that red eyes have not been detected as the detection results K. In the case that it is judged that the results of estimation are correct, the confirmation executing step 41b outputs the positional coordinate data of the red eyes, which have been estimated as being red eyes by the red eye estimating step 3, as the detection results K.
The profile generating step 42a generates a pixel value profile of pixels along a straight line that connects two red eye candidates, which have been estimated to be red eyes by the red eye estimating step 3. Here, the length of the straight line is not the length between the left and right ends of the two red eye candidates. The straight line extends to the edges of the contour of the face detected by the face detecting step 2. In addition, luminance values Y are employed as the pixel values.
The confirmation executing step 42b employs the pixel value profile generated in the profile generating step 42a, to confirm whether the red eye candidates, which have been estimated to be red eyes in the red eye estimating step 3, are the corners of eyes.
The confirmation executing step 42b performs confirmation employing the pixel value profiles. However, prior to performing the confirmation, the confirmation executing step 42b removes continuous valleys that include the center position E0, as a preliminary process. In the case that a person pictured in an image is wearing dark colored glasses, a continuous valley is generated having the center position E0 as its center, as illustrated in
The confirmation executing step 42b confirms whether the generated pixel value profile is one of the three profiles illustrated in
The red eye detecting apparatus of the present embodiment may employ either of the two methods described above to confirm the results of estimation by the red eye estimating step 3.
[Utilization of the Detection Results]
The red eye detection results are utilized to correct red eye, for example.
Note that other known methods for correcting red eyes within images may be applied as well. Examples of such methods are disclosed in Japanese Unexamined Patent Publication Nos. 2000-013680 and 2001-148780.
An alternative embodiment may be considered in which red eye is not corrected, but a warning is issued indicating that a red eye phenomenon has occurred. For example, a red eye detecting function may be incorporated into a digital camera. The red eye detecting process may be executed on an image immediately following photography thereof, and an alarm that suggests that photography be performed again may be output from a speaker in the case that red eyes are detected.
According to the present invention, false positive detection of red eyes can be prevented, by judging whether the detected red eye candidates are the corners of eyes.
The purpose of red eye detection in the present invention is to correct red eye. Generally, images in which dark pupils are pictured (that is, normal images) outnumber images in which red eye occurs. Therefore, dark pupils are detected after red eye candidates are estimated to be red eyes, and whether the red eye candidates are the corners of eyes is judged, in order to detect red eyes efficiently. Alternatively, dark pupils may be detected prior to detecting red eye candidates, and images in which dark pupils are detected may be judged to not have red eye, while the red eye candidate detection step may be administered only on images in which dark pupils are not detected.
The red eye detecting apparatus of the present invention is not limited to the embodiments described above. Various changes and modifications are possible, as long as they do not depart from the spirit of the present invention. For example, red eye detection in human faces was described in the above embodiments. However, the present invention is applicable to abnormally pictured eyes of animals other than humans. That is, faces of animals can be detected instead of human faces, and green eyes or silver eyes of the animals may be detected instead of the red eyes of humans.
Number | Date | Country | Kind |
---|---|---|---|
069529/2005 | Mar 2005 | JP | national |