Abstract:
The face detection device detects a human face image in an image. The face detection device includes a face determining unit, a control unit, a display unit, and a receiving unit. The face determining unit performs a face determination process in which the face determining unit determines whether the image includes a human face image indicative of at least a part of a human face. The control unit performs a base process by controlling the face determining unit to perform the face determination process at least one time. The display unit displays a result of the base process. When the receiving unit receives an instruction, the control unit performs an additional process by controlling the face determining unit to perform the face determination process at least one time on the same image with a higher accuracy than the face determination process in the base process.

Description:
CROSS REFERENCE TO RELATED APPLICATION 
       [0001]    This application claims priority from Japanese Patent Application No. 2007-022401 filed Jan. 31, 2007. The entire content of this priority application is incorporated herein by reference. 
       TECHNICAL FIELD 
       [0002]    The present invention relates to a face detection device capable of detecting a human face image in an image, with a satisfactorily high accuracy, in a satisfactorily short time. 
       BACKGROUND 
       [0003]    There has been known a face detection device for detecting a human face image in an image. Japanese Unexamined Patent Application Publication No. 2001-175869 (see paragraphs and) discloses a technique for determining whether or not given image data has a human face, by performing a plurality of processes on the image data such as edge extraction to detect the positions of the eyes, and to compare the image of the region surrounding the detected eyes, with a plurality of patterns preliminary registered. Each of the patterns typifies the region surrounding eyes. 
       SUMMARY 
       [0004]    However, the technique disclosed in Japanese Unexamined Patent Application Publication No. 2001-175869 has a problem that a large number of patterns have to be registered to determine various types of human faces. The large number of registered patterns require a long time for comparing the images. 
         [0005]    Both the detection accuracy on a human face image and the detection time thereon vary depending on the user. Even the same user may make various requests in terms of detection accuracy and time, according to time and circumstances. Although a human face image is detected with a high accuracy, the user is sometimes unsatisfied if a long time is required for the detection. On the other hand, although a human face image is detected within a short time, the user is sometimes unsatisfied if the accuracy is lower than the user&#39;s request. 
         [0006]    The present invention is made in order to reduce the above problems, and it is an object of the present invention to provide a face detection device and a method capable of detecting a human face image in an image, with a satisfactorily high accuracy, in a satisfactorily short time. 
         [0007]    In order to attain the above and other objects, the invention provides a face detection device. The face detection device detects a human face image in an image. The face detection device includes a face determining unit, a control unit, a display unit, and a receiving unit. The face determining unit performs a face determination process. In the face determination process the face determining unit determines whether the image includes a human face image indicative of at least a part of a human face. The control unit performs a base process by controlling the face determining unit to perform the face determination process at least one time. The display unit displays a result of the base process. The receiving unit is configured to receive an instruction indicating that an additional process is instructed by a user. When the receiving unit receives the instruction, the control unit performs the additional process by controlling the face determining unit to perform the face determination process at least one time on the same image with a higher accuracy than the face determination process in the base process. 
         [0008]    According to another aspects, the invention provides a face detection method. The face detection method detects a human face image in an image. The face detection method includes performing a base process by performing the face determination process at least one time, the face determination process comprising determining whether the image includes a human face image indicative of at least a part of a human face, displaying a result of the performing of the base process, and receiving an instruction indicating an additional process is instructed by a user, after the receiving of the instruction, performing the additional process by performing the face determination process at least one time on the same image with a higher accuracy than the performing in the base process. 
         [0009]    According to still another aspects, the invention provides a computer-readable storage medium. The computer-readable storage medium stores a set of program instructions executable on a face detection device. The program instructions includes performing a base process by performing the face determination process at least one time, the face determination process comprising determining whether the image includes a human face image indicative of at least a part of a human face, displaying a result of the performing of the base process, and receiving an instruction indicating an additional process is instructed by a user, after the receiving of the instruction, performing the additional process by performing the face determination process at least one time on the same image with a higher accuracy than the performing in the base process. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS  
         [0010]    In the drawings: 
           [0011]      FIG. 1  is an external view showing the appearance of a multifunction peripheral; 
           [0012]      FIG. 2  is a block diagram showing the electrical configuration of the multifunction peripheral; 
           [0013]      FIG. 3  is a flowchart showing a face correction process; 
           [0014]      FIG. 4  is a flowchart showing a skin-color region extraction process; 
           [0015]      FIG. 5  is a flowchart showing a skin-color region determination process; 
           [0016]      FIGS. 6(   a )- 6 ( c ) illustrate the skin-color region extraction process; 
           [0017]      FIG. 7  is a flowchart showing an n-th face determination process; 
           [0018]      FIG. 8  is a flowchart showing a block information extraction process; 
           [0019]      FIG. 9(   a ) is a table showing a predetermined skin-color value range used in S 14  of  FIG. 4 ; 
           [0020]      FIG. 9(   b ) conceptually illustrates a rectangular region, which is divided into a plurality of blocks, defined by a skin-color region pointer; 
           [0021]      FIG. 10  is a flowchart showing a part of a determination process; 
           [0022]      FIG. 11  is flowchart showing the other remaining part of the determination process; 
           [0023]      FIG. 12(   a ) briefly illustrates the determination process (S 5 ); and 
           [0024]      FIG. 12(   b ) shows a region divided into a plurality of blocks. 
       
    
    
     DETAILED DESCRIPTION  
       [0025]    The embodiment of the present invention is described with reference to the accompanying drawings.  FIG. 1  is an external view showing the appearance of a multifunction peripheral (hereinafter, referred to as an “MFP”)  1 . The MFP  1  has various functions such as a printer function, a scanner function, and a copy function. 
         [0026]    The MFP  1  has a main body  1   a . The main body has an original document cover  5  on a top thereof and an opening  2  at the front thereof. The inside of the opening  2  is sectioned into upper and lower chambers. The lower chamber of the opening  2  encloses a sheet cassette  3  for holding a plurality of recording sheets in a stack manner. The upper chamber of the opening  2  has an output tray  4  for ejecting a printed recording sheet in a direction indicated by an arrow A. 
         [0027]    Above the opening  2 , an image reading apparatus (not shown) is provided to read an original document for scanning and copying. Below the original document cover  5 , a glass table is provided to place an original document thereon. The document cover  5  includes operation keys  15  and an LCD  16  for displaying a menu, an operational procedure, or the progress of processing at the front side thereof. In order to read an original document, the original document cover  5  is opened in an upward direction, the original document is placed on the glass table, and then the original document cover  5  is closed to fix the original document. As an original document reading button of operation keys  15  is depressed, a scanner provided below the glass table, for reading the original document (for example, CIS. Contact Image Sensor)  20  (see  FIG. 2 ), reads an image on the original document. The obtained image data is stored in a predetermined storage area of a RAM  13  to be described later (see  FIG. 2 ). 
         [0028]    The operation keys  15  include an input key group  15   a  for inputting a numeric value, a character, or the like, and a command input key group  15   b  for inputting various commands. The user depresses these operation keys  15  for turning on/off the power and switching between the functions. Since the LCD  16  displays the information corresponding to the depressed one of the operation keys  15 , the user can check image data to be printed out, as well as various kinds of information on a printer  21  (see  FIG. 2 ). 
         [0029]    At the front of the opening  2 , below the input key group  15   a , a memory card slot  22  is provided to plug a portable flash memory card thereinto. The image data stored in the flash memory card can be printed by the printer function. 
         [0030]    Referring next to  FIG. 2 , the electrical configuration of the MFP  1  is described.  FIG. 2  is a block diagram showing the electrical configuration of the MFP  1 . The MFP  1  includes a CPU  11 , a ROM  12 , the RAM  13 , the operation keys  15 , the LCD  16 , a speaker  17 , a USB interface  18 , the scanner  20 , the printer  21 , and the memory card slot  22 . The CPU  11 , the ROM  12 , and the RAM  13  are connected to each other via a bus line  26 . Furthermore, the operation keys  15 , the LCD  16 , the speaker  17 , the USB interface  18 , the scanner  20 , the printer  21 , the memory card slot  22 , and the bus line  26  are connected to each other via an input/output port. 
         [0031]    The CPU  11  controls each of the components connected to the input/output port  27 , according to the fixed value or the program stored in the ROM  12  or the RAM  13 , the control instructions provided by the MFP for each function, or the various signals communicated via the USB interface  18 . The ROM  12  is an unrewritable memory. The ROM  12  includes a control program region  12   a  for storing various control programs to be executed in the MFP  1 , and a block size memory  12   b.    
         [0032]    The control program region  12   a  stores, for example, programs for performing the processes shown in the flowcharts of  FIGS. 3-5 ,  7 ,  8 ,  10 , and  11 . The control program region  12   a  further stores correction programs, such as a red-eye correction program and skin-color correction program, by which the CPU  11  corrects a face image. 
         [0033]    The block size memory  12   b  stores a table showing the size of one block. The block size varies according to the value on a face determination counter n to be described later. In a block information extraction process shown in the flowchart of  FIG. 8 , a skin-color region is extracted from an image which presumably contains a human face. The skin-color region is divided into the blocks, the block size is set based on the table of the block size memory  12   b . When the block information extraction process is performed repeatedly, the face determination counter n is increased. The block size becomes smaller as the value on the face determination counter n becomes larger. 
         [0034]    The RAM  13  is a rewritable memory for temporarily storing various kinds of data. The RAM  13  includes an image memory  13   a , a skin-color image memory  13   b , a skin-color region pointer  13   c , a block information memory  13   d,  a block determination flag memory  13   e , a previous block data memory  13   f,  a subsequent block data memory  13   g,  and a face determination counter memory  13   h.    
         [0035]    The image memory  13   a  is a region for inputting RGB bitmap image data (hereinafter, referred to as “bitmap data”) loaded from a personal computer or a memory card. The bitmap data is stored in the known bitmap format for forming an image by arranging pixels in a grid pattern. In the bitmap format, the values representing each color are stored for each pixel. The inputted bitmap data is converted from the RGB system to the L*C*h system, and then stored in the skin-color image memory  13   b.    
         [0036]    A description is now given for the L*C*h system. The L*C*h system is the color system employed in the embodiment. In this system, “L*” indicates lightness; “C*” indicates chroma; and “h” indicates hue. 
         [0037]    The skin-color image memory  13   b  is for storing L*C*h bitmap data for pixels having human skin characteristics extracted from the inputted image data. 
         [0038]    The skin-color region pointer  13   c  has an X-direction minimum value  13   c   1 , an X-direction maximum value  13   c   2 , a Y-direction minimum value  13   c   3 , and a Y-direction maximum value  13   c   4 . The skin-color region pointer  13   c  is for storing position information of a rectangular region which encloses the periphery of pixels having the human skin characteristics (see  FIG. 6(   c )) in the image data stored in the skin-color image memory  13   b.    
         [0039]    The block information memory  13   d  stores average values (hereinafter, referred to as “block values”) of values stored in the image data stored in the skin-color image memory  13   b  for those pixels contained in each of a plurality of blocks into which the rectangular region defined by the skin-color region pointer  13   c  is divided. Here, the block has a predetermined size (see  FIG. 9(   b )). 
         [0040]    The block determination flag memory  13   e  stores a block determination flag corresponding to each block whose block information is stored in the block information memory  13   d . The block determination flag is set to “1” when the block value has the human skin characteristics. The block determination flag is set to “0” when the block value has no human skin characteristics. 
         [0041]    The previous block data memory  13   f  stores one of the block values stored in the block information memory  13   d . The subsequent block data memory  13   g  stores one of the block values stored in the block information memory  13   d . The previous block data memory  13   f  and the subsequent block data memory  13   g  are used to obtain difference values. In this case, the previous block data memory  13   f  and the subsequent block data memory  13   g  are described with reference to  FIG. 12(   b ).  FIG. 12(   b ) shows a region which is divided into eight blocks in a vertical direction and four blocks in a horizontal direction. Each block has block value. The blocks with “0” are scanned on a column basis. That is, the block with “0” on the first column are scanned from the first to eighth rows in a scanning direction (column direction). Next, the blocks with “0” on the second column are scanned from the first to eighth rows in the column direction. Other blocks on subsequent columns are scanned in the same manner. 
         [0042]    While scanning from the first row in a scanning direction, a block value detected first is stored in the previous block data memory  13   f  and a block value detected next is stored in the subsequent block data memory  13   g . The value of the previous block data memory  13   f  is subtracted from the value of the subsequent block data memory  13   g  to obtain a difference value between the block values. As the difference value is obtained, the value of the subsequent block data memory  13   g  is stored in the previous block data memory  13   f . As scanning is then continued in the scanning direction, the block value detected next is stored in the subsequent block data memory  13   g  and a difference value is similarly obtained. 
         [0043]    The face determination counter memory  13   h  stores the face image counter n. The face determination counter n is a counter that counts number of the n-th face determination process (S 3 ) shown in the flowchart of  FIG. 3 . The face determination counter  13   n  therefore indicates the number of times the face determination process (S 3 ) has been executed. The, user decides whether or not to perform the next face determination process. If the user decides to perform the next face determination process, one is added to a current value of the face determination counter n. 
         [0044]    The speaker  17  makes an operation sound when each of the operation keys  15  is depressed. The speaker  17  makes an alarm sound when an error occurs. The printer  21 , although not shown, is composed of an inkjet printer. For color printing, the printer  21  includes a print head which uses the four color inks of C (cyan), M (magenta), Y (yellow), and K (black), a sheet feeder, and a recovery apparatus. 
         [0045]      FIG. 3  is a flowchart showing a face correction process. In the face correction process, a human face image is detected in an image specified by the user and a correction requested by the user is then performed on the detected face image. The face correction process is performed by the CPU  11 . 
         [0046]    In the face correction process, first, in S 301 , the CPU  11  determines whether or not the memory card has been plugged into the memory card slot  22 . If the memory card has been plugged (S 301 : Yes), in S 302  the CPU  11  controls the LCD  16  to display a digital camera print menu. In S 303  the CPU  11  determines whether or not the user selects a face correction from the digital camera print menu. If the face correction is selected (S 303 : Yes), in S 304  the CPU  11  loads the image data stored in the memory card. In S 305  the CPU  11  controls the LCD  16  to display the thumbnails of the loaded images. Here, the image data loaded from the memory card is stored in the image memory  13   a.    
         [0047]    In S 306  the CPU  11  determines whether or not the user selects one of the thumbnails displayed on the LCD  16  as an image to perform the face correction process. If the user selects one of the thumbnails as an image to perform the face correction process (S 306 : Yes), the CPU  11  controls the LCD  16  to display a face correction menu (S 307 ). The face correction menu displays menu items such as a red-eye correction menu item and a skin-color correction menu item which indicates names of the correction program, a red-eye correction program and skin-color correction program respectively, stored in the control program region  12   a.    
         [0048]    Next, in S 308  the CPU  11  determines whether or not the user selects a menu item for a prescribed correction method from the face correction menu. If the prescribed menu item is selected (S 308 : Yes), in S 309  the CPU  11  sets the face determination counter n to “1”. 
         [0049]    If a memory card is not plugged into the memory card slot  22  (S 301 : No), if the user does not select the face correction (S 303 : No), if the user does not selects a thumbnail to perform the face correction process (S 306 : No), or if the prescribed menu item is not selected (S 308 ; No), the CPU  11  ends the process. 
         [0050]    When in S 309  the CPU  11  sets the face determination counter n to “1”, in Si the CPU  11  proceeds to a skin-color region extraction process. 
         [0051]    The skin-color region extraction process (S 1 ) is described with reference to a flowchart of  FIG. 4 . In the skin-color region extraction process, in S 11 , the CPU  11  initializes the skin-color image memory  13   b . That is, in this initialization, the CPU  11  sets the values of all the pixels (L*value, C*value, h value) to white (100, 0, 0). 
         [0052]    Next, in S 12  the CPU  11  converts the image data stored in the image memory  13   a  from the RGB system to the L*C*h system, and then copies the converted image data in the skin-color image memory  13   b . In S 13  the CPU  11  reads the values (L* value, C* value, h value) of one pixel from the skin-color image memory  13   b . In S 14  the CPU  11  determines whether or not each of the pixel values (the read L* value, C* value, and h value) for one pixel is included in a corresponding predetermined skin-color value range. As shown in  FIG. 9(   a ), in the embodiment, the predetermined skin-color value ranges are defined as follows: 32≦L*≦92; 10≦C*≦40; and 25≦h≦64. 
         [0053]    If all the read pixel values (L* value, C* value, and h value) for the subject pixel are included in the predetermined skin-color value range (S 14 : Yes), the CPU  11  proceeds to S 16  without changing the pixel values for the pixel. On the other hand, if any of the read pixel values (L*, C*, h) for the pixel are not included in the predetermined skin-color value range (S 14 : No), in S 15  the CPU  11  sets the pixel values read from the skin-color image memory  13   b  to values indicating white. In S 16  the CPU  11  determines whether or not pixel values for all pixels are read from the skin-color image memory  13   b . If the pixel values for all pixels are read from the skin-color image memory  13   b  (S 16 : Yes), the CPU  11  ends the process. On the other hand, if pixel values for all pixels are not read from the skin-color image memory  13   b  (S 16 : No), the CPU  11  returns to S 13  for repeating the processes S 13  to S 15 . 
         [0054]    In the process shown in the flowchart of  FIG. 4 , the pixels having values included in the predetermined skin-color value ranges are extracted from the image data stored in the image memory  13   a  and stored in the skin-color image memory  13   b . Referring to  FIGS. 6(   a )- 6 ( c ), a description is given for the image data extracted from the image memory  13   a  and stored in the skin-color image memory  13   b , in the process shown in the flowchart of  FIG. 4 . 
         [0055]      FIGS. 6(   a )- 6 ( c ) conceptually illustrate the contents stored in the image memory  13   a  or the skin-color image memory  13   b .  FIG. 6(   a ) shows the case in which the image memory  13   a  stores image data. The image data stored in the image memory  13   a  is converted from the RGB system to the L*C*h system, and then stored in the skin-color image memory  13   b . Next, as shown in  FIG. 6(   b ), the skin-color image memory  13   b  maintains only the pixel values included in the predetermined skin-color value ranges. The other remaining pixel values are set to white. In  FIGS. 6(   b ) and  6 ( c ), though the border line defining the face is shown in black line for explanation, pixel values corresponding to the border line are actually set to white.  FIG. 9(   b ) and  FIG. 12(   b ) are shown in the same manner. 
         [0056]    Referring back again to  FIG. 3 , after the CPU  11  ends the skin-color region extraction process (S 1 ), in S 2  the CPU  11  proceeds to a skin-color region determination process. 
         [0057]    The skin-color region determination process (S 2 ) is described with reference to  FIG. 5 . In the skin-color region determination process (S 2 ), first, in S 21  the CPU  11  initializes the skin-color region pointer  13   c.    
         [0058]    In S 22  the CPU  11  reads values (L* value, C* value, h value) of one pixel from the skin-color image memory  13   b . In S 23  the CPU  11  determines whether or not the read pixel is white (100, 0, 0). If the read pixel is white (100, 0, 0) (S 23 : Yes);, the CPU  11  proceeds to S 26 . On the other hand, if the read pixel is not white (S 23 : No), in S 24  the CPU  11  determines whether or not the position of the read pixel (x, y) is included in the rectangular region defined by the skin-color region pointer  13   c.    
         [0059]    If the position of the read pixel (x, y) is not included in the rectangular region defined by the skin-color region pointer  13   c  in S 24  (S 24 : No), in S 25  the CPU  11  changes the values of the skin-color region pointer  13   c  so that the position of the read pixel defined by the x-value and the y-value is included in the rectangular region defined by the skin-color region pointer  13   c , and the CPU  11  proceeds to S 26 . That is, in S 25  the CPU  11  changes at least one of the X-direction minimum value  13   c   1 , the X-direction maximum value  13   c   2 , the Y-direction minimum value  13   c   3 , and the Y-direction maximum value  13   c   4  to include the pixel (x, y) within the rectangular region defined thereby. On the other hand, if the read pixel is positioned within the rectangular region defined by the skin-color region pointer  13   c  (S 24 : Yes), the CPU  11  proceeds to S 26  without changing the values of the skin-color region pointer  13   c.    
         [0060]    Because the skin-color region pointer  13   c  is initialized in S 21 , when the process of S 24  is executed for the first time, the process of S 24  makes a negative judgment, and the process of S 25  is executed to set the X-direction minimum and maximum values  13   c   1  and  13   c   2  to the value of the X-coordinate of the read pixel (x, y) and to set the Y-direction minimum and maximum values  13   c   3  and  13   c   4  to the value of the Y-coordinate of the read pixel (x, y). 
         [0061]    In S 26  the CPU  11  determines whether or not all the pixel values are read from the skin-color image memory  13   b . If all the pixel values are read (S 26 : Yes), the CPU  11  ends the process. On the other hand, if all the pixel values are not read from the skin-color image memory  13   b  (S 26 : No), the CPU  11  returns to S 22  for repeating the process S 22  to S 25 . In the process shown in the flowchart of  FIG. 5 , the CPU  11  can determine the rectangular region which encloses the image as shown in  FIG. 6(   c ) (region defined by the dotted line) from the image ( FIG. 6(   b )) which is stored in the skin-color image memory  13   b . The CPU  11  also can store the position information of the rectangular region in the skin-color region pointer  13   c.    
         [0062]    As shown in  FIG. 3 , after the CPU  11  ends the skin-color region determination process (S 2 ), in S 3  the CPU  11  proceeds to the n-th face determination process. 
         [0063]    As shown in  FIG. 7 , in the n-th face determination process (S 3 ), the CPU  11  performs a block information extraction process (S 4 ), and a subsequent determination process (S 5 ) in this order and ends the n-th face determination process. 
         [0064]      FIG. 8  is a flowchart showing the block information extraction process (S 4 ). In the block information extraction process (S 4 ), first, in S 31   a  the CPU  11  sets a block size by which the CPU  11  divides the rectangular region defined by the skin-color region pointer  13   c  (region defined by the dotted line of  FIG. 6(   c )) by referring to the table stored in the block size memory  12   b. Specifically, the larger the value on the face determination counter n becomes, that is, the larger number of times the face determination processes (S 3 ) are performed, the smaller the CPU  11  sets the block size. Thus, a larger number of times the face determination processes (S 3 ) is performed, the higher accuracy a face determination can be performed, while a longer time is required. In other words, a smaller number of times the face determination process (S 3 ) is performed, the shorter time a face determination can be performed, while the face determination is performed with a lower accuracy. In other word, if the face determination counter n is larger than “ 1”, the CPU  11  sets a current block size smaller than the block size of the previous n-th face determination process. 
         [0065]    Next, in S 31  the CPU  11  divides the rectangular region defined by the skin-color region pointer  13   c  (region defined by the dotted line of  FIG. 6(   c )) into M-number of blocks in the vertical direction and N-number of blocks in the horizontal direction, as shown in  FIG. 9(   b ), so that each block has the set size. Then, in S 32  the CPU  11  initializes the block information memory  13   d  and the block determination flag memory  13   e.    
         [0066]    In S 33 , for one of the divided blocks, the CPU  11  obtains an average value of the pixels included in the block for each of L* value, C* value, and h value and stores each of the obtained values in the block information memory  13   d . In S 34 , the CPU  11  determines whether or not each of the obtained average values (L* value, C* value, and h value) is included in the predetermined skin-color value range. If all the obtained average values are included in the predetermined skin-color value range (S 34 : Yes), in S 35  the CPU  11  sets the determination flag of the block for which the average values have been obtained to “1(valid)”. On the other hand, if any of the obtained average values are not included in the predetermined skin-color value range (S 34 : No), in S 36  the CPU  11  sets the determination flag of the block for which the average values have been obtained to “0(invalid)”. 
         [0067]    In S 37  the CPU  11  determines whether or not the average values are obtained for all the blocks. If the average values are obtained for all the blocks (S 37 : Yes), the CPU  11  ends the process. On the other hand, the average values are not obtained for all the blocks (S 37 : No), the CPU  11  returns to S 33  for repeating the processes S 33  to S 36 . 
         [0068]    Thus, in the block information extraction process (S 4 ), the rectangular region defined by the skin-color region pointer  13   c  (see  FIG. 6(   c )) is divided into the plurality of blocks as shown in  FIG. 9(   b ). The values of each block are stored in the block information memory  13   d . Thus, the CPU  11  can set the block determination flag which indicates whether or not the values of each block are included in the predetermined skin-color value range in the block determination flag memory  13   e.    
         [0069]      FIG. 9(   b ) conceptually illustrates the case in which the rectangular region defined by the skin-color region pointer  13   c  (see  FIG. 6(   c )) is divided into eight blocks in the vertical direction and four blocks in the horizontal direction, each of which has the same size. The vertical direction from top to bottom in  FIG. 9(   b ) is referred to as a column direction, and the horizontal direction from left to right is referred to as a row direction. In  FIG. 9(   b ), a reference point R is set at a top left position of the image. In the following description, a block (N, M) indicates a block that is located on N-th column and M-th row from the reference point R. That is, a number (N) is assigned to each column in an order from the reference point R in the row direction. Here, a first column from the reference point is assigned with 1. A number (M) is assigned to each row in an order from the reference point R in the column direction. Here, a first row from the reference point R is assigned with 1. For example, the block positioned at the top left is denoted as a block ( 1 ,  1 ). The block positioned at the bottom left is denoted as a block ( 1 ,  8 ). 
         [0070]    As shown in  FIG. 9(   b ), the marks “O” and “X” put in each block indicate whether or not the block has block values within the predetermined skin-color value range. If a block has “O” in  FIG. 9(   b ), the block determination flag for this block is set to “1 (valid)”. If a block has “X” in  FIG. 9(   b ), the block determination flag for this block is set to “0 (invalid)”. Hereinafter, the block whose block determination flag is set to “1 (valid)” is referred to as a “valid block”, and the block whose block determination flag is set to “0 (invalid)” is referred to as an “invalid block”. 
         [0071]    Next, a description is given for the determination process (S 5 ) to be performed after the block information extraction process (S 4 ), as a part of the n-th face determination process (S 3 ).  FIG. 12(   a ) briefly illustrates the determination process (S 5 ). 
         [0072]      FIG. 12(   a ) shows the lightness-hue relation for each part on a human face skin. The horizontal axis shows hue h between red and yellow. When the hue h increases, the image becomes more yellowish. When the hue h decreases, the image becomes red. In other words, the horizontal axis indicates a part of hue circle from red to yellow. The vertical axis shows lightness L* between black and white. When the lightness L* increases, the image becomes white. When the lightness L* decreases, the image becomes black. As shown in  FIG. 12(   a ), a human face skin is divided into the four parts “forehead”, “undereye”, “cheek”, and “neck”. Although the respective parts partly overlap one another in hue or lightness, specific characteristics are found when one part is compared with another part. 
         [0073]    For example, the “undereye” skin is relatively high (white) in lightness and red in hue compared with the “forehead” skin. That is, the “undereye” skin is higher in lightness and more reddish in hue than the “forehead” skin. In other words, when difference value ΔL* is obtained by subtracting a lightness L* at “forehead” pixel from a lightness L* “undereye” pixel, ΔL* has a positive value. When difference value Δh is obtained by subtracting a hue h at “forehead” pixel from a hue h “undereye” pixel, Δh has a negative value. 
         [0074]    The “cheek” skin is relatively high (white) in lightness and yellow in hue compared with the “undereye” skin. That is, the “cheek” skin is higher in lightness and more yellowish in hue than the “undereye” skin. In other words, when difference value ΔL* is obtained by subtracting a lightness L* at “undereye” pixel from a lightness L* “cheek” pixel, ΔL* has a positive value. When difference value Δh is obtained by subtracting a hue h at “undereye” pixel from a hue h “cheek” pixel, Δh has a positive value. 
         [0075]    In addition, the “neck” skin is relatively low (black) in lightness and yellow in hue compared with the “cheek” skin. That is, the “neck” skin is lower in lightness and more yellowish in hue than “cheek” skin. In other words, when difference value ΔL* is obtained by subtracting a lightness L* at “cheek” pixel from a lightness at “neck” pixel, ΔL* has a negative value. When difference value Δh is obtained by subtracting a hue h at “cheek” pixel from a hue h “neck” pixel, Δh has a positive value. 
         [0076]    In the face determination process, the CPU  11  checks relative change in hue and lightness of respective skin parts “forehead”, “undereye”, “undereye”, “cheek” in this order. Since the relative change in hue and lightness is checked, a human face can be determined regardless of its skin color. 
         [0077]    Referring to flowcharts of  FIG. 10  and  FIG. 11 , the determination process (S 5 ) is described. In the determination process, first, in S 41  the CPU  11  sets a variable “i” to “1”. 
         [0078]    In S 42  the CPU  11  scans the i-th column from the first row to the n-th row in the column direction and determines whether two blocks (valid blocks) having “1(valid)” are detected in their block determination flags. If the two valid blocks are detected (S 42 : Yes), in S 43  the CPU  11  stores the block values (the L* value and the h value) of the firstly detected valid block in the previous block data memory  13   f  and the block values (the L* value and the h value) of the secondly detected valid block in the subsequent block data memory  13   g.    
         [0079]    In S 44  the CPU  11  obtains difference values (ΔL* block value, Δh block value) by subtracting the values of the previous block data memory  13   f  from the values of the subsequent block data memory  13   g . In S 45 , the CPU  11  determines whether or not the absolute values of the obtained difference values (ΔL* block value, Δh block value) are equal to or smaller than prescribed values. If any of the absolute values are not equal to or smaller than the prescribed values (S 45 : No), the CPU  11  proceeds to S 49 . 
         [0080]    If the absolute values of the obtained difference values are equal to or smaller than the prescribed values (S 45 : Yes), it is known that the block values stored in the previous block data memory  13   f  belong to the same skin part of the subsequent block data memory  13   g . For example, it is known that the block values stored in the previous block data memory  13   f , and the block values stored in the subsequent block data memory  13   g  both belong to “forehead”. In such a case, the CPU  11  does not proceeds to the detection process (S 49 ) on the blocks belonging to same. As described below, in S 54  and S 60 , the CPU  11  performs determination processes same as S 45 . 
         [0081]    If all the absolute values of the obtained difference values are equal to or smaller than the predetermined values in S 45  (S 45 : Yes), in S 46  the CPU  11  stores the block values of the subsequent block data memory  13   g  in the previous block data memory  13   f . Successively, in S 47  the CPU  11  further scans the i-th column in the column direction and determines whether another valid block is detected. If another valid block is detected (S 47 : Yes), in S 48  the CPU  11  stores the block values (the L* value and the h value) for the detected block in the subsequent block data memory  13   g , and returns to S 44 . On the other hand, no other valid block is detected (S 47 : No), the CPU  11  proceeds to S 63 . 
         [0082]    In S 49  the CPU  11  determines whether or not the ΔL* value is a positive value, and whether or not the Δh value is a negative value. That is, the CPU  11  determines whether the difference (block) values ΔL* and Δh indicate the characteristics that the skin changes from “forehead” to “undereye”. If the ΔL* value is positive and the Δh value is negative (S 49 : Yes), in S 50  the CPU  11  stores the values of the subsequent block data memory  13   g  in the previous block data memory  13   f . On the other hand, in any other case than the case where the ΔL* value is positive and the Δh value is negative (S 49 : No), the CPU  11  proceeds to S 63 . 
         [0083]    Next, in S 51  the CPU  11  further scans the i-th column in column direction and determines whether another valid block is detected. If the another valid block is detected (S 51 : Yes), in S 52  the CPU  11  stores the L* value and the h value of the detected valid block in the subsequent block data memory  13   g . On the other hand, if another valid block is not detected (S 51 : No), the CPU  11  proceeds to S 63 . 
         [0084]    In S 53  the CPU  11  obtains difference (block) values (ΔL* value and Δh value) by subtracting values of the previous block data memory  13   f  from the values of the subsequent block data memory  13   g . In S 54  the CPU  11  determines whether or not the absolute values of the obtained difference values are equal to or smaller than the prescribed value. If all the absolute values of the obtained difference values are equal to or smaller than the prescribed value (S 54 : Yes), the CPU  11  returns to S 50  for repeating S 50  to S 53 . On the other hand, if any of the absolute values of the obtained difference values are neither equal to nor smaller than (larger than) the prescribed value (S 54 : No), in S 55  the CPU  11  determines whether both the ΔL* value and the Δh value are positive. That is, the CPU  11  determines whether the difference (block) value ΔL* and Δh indicate the characteristics that the skin changes from “undereye” to “cheek”. 
         [0085]    If both the ΔL* block value and the ah block value are positive (S 55 : Yes), the CPU  11  stores the values of the subsequent block data memory  13   g  in the previous block data memory  13   f . On the other hand, in any case other than the case where both the ΔL* value and the Δh value are positive (S 55 : No), the CPU  11  proceeds to S 63 . 
         [0086]    Successively, in S 57  the CPU  11  further scans in i-th column in the column direction and determines whether another valid block is detected. If another valid block is detected (S 57 : Yes), in S 58  the CPU  11  stores the L* value and the h value of the detected valid block in the subsequent block data memory  13   g . On the other hand, if another valid block is not detected (S 57 ; No), the CPU  11  proceeds to S 63 . 
         [0087]    In S 59  the CPU  11  obtains difference values (ΔL* block value and Δh block value) by subtracting values of the previous block data memory  13   f  from the values of the subsequent block data memory  13   g . In S 60  the CPU  11  determines whether or not the absolute values of the obtained difference (block) values are equal to or smaller than the prescribed value. If all the absolute values of the obtained difference values are equal to or smaller than the prescribed value (S 60 : Yes), the CPU  11  returns to S 56  for repeating S 56  to S 59 . On the other hand, if any one of the absolute values of the obtained difference values is neither equal to nor smaller than (longer than) the prescribed value (S 60 : No), in S 61  the CPU  11  determines whether the ΔL* block value is negative and the Δh block value is positive. That is, the CPU  11  determines whether the difference (block) values ΔL* and Δh indicates the characteristics that the skin changes from “cheek” to “neck”. 
         [0088]    In S 61 , if the ΔL* value is negative and the Δh value is positive (S 61 : Yes), it is determined that the image data stored in the image memory  13   a  includes a human face image (S 62 ). The CPU  11  ends the process. On the other hand, in any other case than the case where the ΔL* value is negative and the Δh value is positive (S 61 :No), the process skips to S 63 . 
         [0089]    In S 63  the CPU  11  determines whether or not a variable “i” is equal to N (column number of block). If the variable “i” is equal to the number N (S 63 : Yes), the CPU  11  ends the process. On the other hand, if the variable “i” is not equal to the number N (S 63 : No), in S 64  the CPU  11  adds one to the variable “i”. The CPU  11  returns to S 42 . 
         [0090]    In the process S 49 -S 61 , the CPU  11  determines whether the block hue value changes in a from-yellow-to-red direction and then changes in a from-red-to-yellow direction in a hue circle according to shift in position of the block in the scanning direction (column direction), and whether the block lightness value increases and then decreases according to shift in position of the block in the scanning direction (column direction). 
         [0091]    In the determination process (S 5 ), the valid block values stored in the block information memory  13   d  are scanned in the scanning direction (column direction) on a column basis, so as to obtain the block difference values in succession. It is determined whether the obtained difference values have the characteristics indicating the change from the “forehead” part to the “undereye” part, the characteristics indicating the change from the “undereye” part to the “cheek” part, and the characteristics indicating the change from the “cheek” part to the “neck” part. Thus, the CPU  11  can determine whether a face image is included. 
         [0092]    Referring next to  FIG. 12(   b ), a description is given for how the block values of valid blocks are compared, as an example.  FIG. 12(   b ) conceptually illustrates valid blocks and the scanning direction. 
         [0093]    As shown in  FIG. 12(   b ), valid blocks are scanned from the first row (“i”=1) in the scanning direction (column direction) toward eighth row (“i”=8). For example, as the third column is scanned in the scanning direction, a block ( 3 ,  2 ) and a block ( 3 ,  4 ) are detected. The difference values between the detected blocks have the characteristics indicating the change from the “forehead” part to the “undereye” part. Scanning is performed on the following blocks. Then, a block ( 3 ,  5 ) is detected. The difference values between the values of the block ( 3 ,  4 ) and the block ( 3 ,  5 ) are obtained by comparison. The difference values have the characteristics indicating the change from the “undereye” part to the “cheek” part. Scanning is performed on the following blocks. Then, a block ( 3 ,  6 ) is detected. The difference values between the values of the block ( 3 ,  5 ) and the block ( 3 ,  6 ) are obtained by comparison. Although the block ( 3 ,  6 ) includes both the skin types “cheek” and “neck”, the difference values between the block ( 3 ,  5 ) and the block ( 3 ,  6 ) have the characteristics indicating the change from the “cheek” part to the “neck” part. Thus, it is determined that the image includes a human face image. 
         [0094]    As shown in  FIG. 3 , after the CPU  11  ends the n-th face determination process (S 3 ) described above, in S 311  the CPU  11  determines whether or not any face image is detected in the n-th face determination process (S 3 ). If a face image is detected (S 311 . Yes), in S 312  the CPU  11  performs correction on the detected face image according to the instruction given by the user in S 308  based on the corresponding correction program stored in the control program region  12   a.    
         [0095]    In S 313  the CPU  11  controls the LCD  16  to display the corrected face image, with a message asking whether or not the next face determination process is to be performed. The user checks the corrected face image displayed in S 313 . If the user is satisfied with the corrected face image, the user determines that the next face determination process is not to be performed. If the user is not satisfied with the corrected face image, the user determines that the next face determination process is to be performed. 
         [0096]    On the other hand, if face image is not detected in the n-th face determination process (S 3 ) (S 311 : No), in S 314  the CPU  11  controls the LCD  16  to display a message saying that no face image has been detected, and asking whether or not the next face determination process is to be performed. If the user is satisfied with the message displayed in S 311 , the user determines that the next face determination process is not to be performed. If the user is not satisfied with the massage, the user determines that the next face determination process is to be performed. 
         [0097]    The user determines whether or not the next face determination process is to be performed, and then inputs the determination. In S 315  the CPU  11  determines whether the user decides to perform the next face determination process. If the next face determination process is not to be performed (S 315 : No), the CPU  11  ends the process. On the other hand, if the next face determination process is to be performed (S 315 ; Yes), in S 316  the CPU  11  adds one to the face determination counter n. The new n-th face determination process (S 3 ) is then performed again. 
         [0098]    In the subsequent n-th face determination process (S 3 ) to be performed at this time, the block size in which the rectangular region defined by the skin-color region pointer is to be divided, is set to be smaller, compared with the case where the n-th face determination process (S 3 ) which has been previously performed. Specifically, the rectangular region defined by the skin-color region pointer is divided into a larger number of blocks in the subsequent n-th face determination process (S 3 ), compared with the previous n-th face determination process (S 3 ). 
         [0099]    The subsequent n-th face determination process (S 3 ) requires a longer time but completes the face determination process with a higher accuracy, compared with the previous n-th face determination process (S 3 ). The face image which has not been detected in the previous n-th face determination process (S 3 ), can possibly be detected in the subsequent n-th face determination process (S 3 ). Accordingly the subsequent face determination process have an advantage for the user who wants a face image detection with a higher accuracy even with a longer time. On the other hand, if the user is satisfied with the result determined in the previous n-th face determination process (S 3 ), that is the user does not need the face image detection with a higher accuracy, a face image detection is thus performed, within the accuracy range requested by the user and within a shorter time. 
         [0100]    While the invention has been described in detail with reference to the above embodiment thereof, it would be apparent to those skilled in the art that various changes and modifications may be made therein without departing from the spirit of the invention. 
         [0101]    In the above embodiment, in order to detect a face image with a higher accuracy in a longer time as the number of determination processes increases a face image is detected with a higher accuracy in a longer time by making the block size smaller as the number of determination processes increases. However, the invention is not limited to the above-described method. For example, an image may be pattern-matched with templates, with the number of templates increasing as the number of determination processes increases. Also in this case, a face image can be detected with a higher accuracy in a longer time, as the number of determination processes increases. 
         [0102]    In the above embodiment, the block size, which becomes smaller as the number of determination processes increases, is stored in the block size memory of the ROM  12  as a prescribed value in advance. However, the user may arbitrarily set a rate, at which the block size is reduced as the number of determination processes increases. 
         [0103]    In the above embodiment, blocks are scanned in the vertical direction (column direction). However, blocks may be scanned horizontally or obliquely if the image is tilted. The difference values between the valid block values can be obtained even when scanning is obliquely performed. That is, the rectangular region defined by the skin-color region pointer  13   c  is scanned along a straight line and the blocks in the rectangular region are compared. This straight line may be a vertical line, a horizontal line, or a tilted line. Therefore, even when an image is tilted, a human face image can be detected therein. 
         [0104]    In the above embodiment, the description is given for the face image which includes all whole face. However, the CPU  11  can detect a part of face image that includes “forehead”, “undereye”, “cheek”, and “neck” parts according to the process described above. 
         [0105]    In the above embodiment, every time the n-th face determination process is performed, in S 313  or S 314  the CPU  11  controls the LCD  16  to display a result of the n-th face determination process and asking whether or not the next face determination process is to be performed. However, after the plurality of n-th face determination process is performed, the CPU  11  may control the LCD  16  to display a result of the n-th face determination processes and asking whether or not the next face determination process is to be performed. 
         [0106]    In the above embodiment, in  31   a  the CPU  11  sets a block size smaller than the previously set block size every time when the n-th face determination process is repeated. However, the CPU  11  may set a block size smaller than the previously set block size after the plurality of n-th face determination process is performed. That is, the CPU  11  performs the plurality of n-th face determination by the same block size. The detection rate of the face image is improved by repeating the n-th face determination process in the same block size of the previous n-th face determination process. 
         [0107]    In the above embodiment, the MFP  1  performs image processing on image data. However, a PC hard disk may store a program for performing the image processing according to the above embodiment, and the PC may perform image processing on image data.