WO2015070723A1 - 眼部图像处理方法和装置 - Google Patents

眼部图像处理方法和装置 Download PDF

Info

Publication number
WO2015070723A1
WO2015070723A1 PCT/CN2014/090454 CN2014090454W WO2015070723A1 WO 2015070723 A1 WO2015070723 A1 WO 2015070723A1 CN 2014090454 W CN2014090454 W CN 2014090454W WO 2015070723 A1 WO2015070723 A1 WO 2015070723A1
Authority
WO
WIPO (PCT)
Prior art keywords
region
abnormal eye
value
eyelid
candidate
Prior art date
Application number
PCT/CN2014/090454
Other languages
English (en)
French (fr)
Inventor
张幸
陈敏
张熙
魏代玉
Original Assignee
华为终端有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为终端有限公司 filed Critical 华为终端有限公司
Publication of WO2015070723A1 publication Critical patent/WO2015070723A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • G06T5/94Dynamic range modification of images or parts thereof based on local image properties, e.g. for local contrast enhancement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/18Eye characteristics, e.g. of the iris
    • G06V40/193Preprocessing; Feature extraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/18Eye characteristics, e.g. of the iris
    • G06V40/197Matching; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30216Redeye defect

Definitions

  • Embodiments of the present invention relate to the field of image processing, and in particular, to an eye image processing method and apparatus.
  • the pupil of the human eye zooms in to allow more light to pass through. If the flash is turned on during shooting, the capillaries on the retina of the fundus will be photographed. According to different lenses and shooting scenes, the photos will appear in different colors (usually red, gold, white, etc.), called red eye/ Golden eye phenomenon.
  • the red-eye/gold-eye is mostly photographed in low-light scenes, the red-eye/gold-eye conditions of the shooting are very different. For example, due to makeup and other reasons, the eyelids are red, and glasses may cause golden reflection of the glasses, and the eyes are white-like. In other cases, the use of simple threshold elimination methods cannot completely eliminate non-red-eye/golden eye regions, and may cause false elimination.
  • Embodiments of the present invention provide an eye image processing method and apparatus, which can more accurately locate an abnormal eye region of an eye image.
  • an eye image processing method comprising: determining an eyelid region of an input image; acquiring a first mask image of the eyelid region, wherein the first mask image is gold An eye mask image or a red eye mask image, the first mask image being a binary mask image; determining at least one first abnormal region of the eyelid region according to the first mask image; corresponding to the first mask image
  • the abnormal eye region determining condition determines a first candidate abnormal eye region in the at least one first abnormal region, wherein the first candidate abnormal eye region satisfies an abnormal eye region determining condition corresponding to the first mask image
  • the abnormal eye region determination condition corresponding to the first mask image includes at least one condition that the number of pixels of the first candidate abnormal eye region is greater than a first predetermined value, the first candidate abnormal eye portion
  • the circularity of the region is greater than a second predetermined value and the circularity of the first candidate abnormal eye region is smaller than a third predetermined value, and the original radius of the first candidate abnormal eye region is greater than
  • the method further includes: acquiring a second mask image of the eyelid region when the abnormal eye region is not found, the second mask image being gold An eye mask image or a red eye mask image, the second mask image being a binary mask image, the second mask image being different from the first mask image; determining the eyelid region according to the second mask image At least one second abnormal region; determining a second candidate abnormal eye region in the at least one second abnormal region according to the abnormal eye region determining condition corresponding to the second mask image, wherein the second candidate abnormal eye region satisfies All the determination conditions in the abnormal eye region determination condition corresponding to the second mask image, and the abnormal eye region determination condition corresponding to the second mask image includes at least one of the following conditions: the pixel of the second candidate abnormal eye region The number is greater than an eighth predetermined value, the circularity of the second candidate abnormal eye region is greater than a ninth predetermined value and the circularity of the second candidate abnormal eye region is less than a tenth predetermined a value, the
  • gray2 represents an average brightness of a region within a predetermined pixel range outside the first candidate abnormal eye region, or gray2 represents a plurality of reference points within a predetermined pixel range outside the first candidate abnormal eye region
  • the average brightness, sp represents the number of pixels of the first candidate abnormal eye region
  • radius represents the original radius of the first candidate abnormal eye region.
  • acquiring the first mask image of the eyelid region is specific The method is: acquiring brightness information of the eyelid region; acquiring an edge intensity image of the eyelid region according to brightness information of the eyelid region; and performing binary clustering segmentation on the edge intensity image to obtain a first mask image of the eyelid region.
  • acquiring an edge intensity image of the eyelid region according to the brightness information of the eyelid region is implemented by performing Gaussian blur processing on the eyelid region And performing soble edge intensity extraction on the eyelid region after Gaussian blurring according to the same-sex sobel operator to obtain an edge intensity image of the eyelid region;
  • the edge intensity image is subjected to binary clustering to obtain the first mask image of the eyelid region, and the first threshold value of the edge intensity image of the eyelid region is divided into two categories according to a threshold value, and the first threshold is the largest, which is smaller than
  • the edge intensity of the first threshold is set as a first threshold, and a second threshold value is obtained, which is obtained by dividing the edge intensity image of the eyelid region into two types according to a threshold value, and the edge intensity of the eyelid region is determined according to the second threshold value.
  • the image is binarized to obtain a first mask image of the eyelid region, wherein the mask image information of the pixel whose edge intensity is less than the second threshold takes a value of 0, and the mask image of the pixel whose edge intensity is greater than or equal to the second threshold The value of the information is 1.
  • the method further includes: if the original radii of the abnormal eye region And a value greater than a minimum empirical radius of the abnormal eye region in the eyelid region multiplied by a first predetermined coefficient, selecting at least one candidate reference point from outside the abnormal eye region; according to a portion of the at least one candidate reference point or The YUV data of all candidate reference points determines the YUV reference value of the reference point of the abnormal eye region; if the pixel corresponding to the YUV reference value of the reference point is not a red pixel, the abnormal eye is adjusted according to the YUV reference value of the reference point An outer bright spot area of the area, wherein an inner bright spot area of the abnormal eye area is adjusted according to a brightness average value of the inner bright spot area of the abnormal eye area, wherein the inner bright spot area is centered on a center point of the abnormal eye area,
  • the optimal bright spot radius of the abnormal eye region is a radius
  • the first predetermined coefficient is 1.25.
  • acquiring the first mask of the eyelid region The image is specifically implemented by: acquiring RGB information of the eyelid region; and performing binary segmentation on the eyelid region according to the RGB information of the eyelid region to obtain a first mask image of the eyelid region.
  • a ninth possible implementation manner performing the binary segmentation on the eyelid region according to the RGB information of the eyelid region to obtain the first mask image of the eyelid region
  • the mask image information corresponding to the red pixel in the eyelid region is set to 1
  • the mask image information corresponding to the pixel other than the red pixel in the eyelid region is set to 0, thereby forming the first mask image.
  • the method further includes: selecting at least one from outside the abnormal eye region a candidate reference point; determining a YUV reference value of the reference point of the abnormal eye region according to YUV data of some or all of the at least one candidate reference point; if the YUV reference value of the reference point meets a predetermined condition, according to The YUV reference value of the reference point adjusts the outer bright spot area of the abnormal eye area, and adjusts the inner bright spot area of the abnormal eye area according to the brightness average value of the inner bright spot area of the abnormal eye area, or if the reference point is YUV If the reference value does not meet the predetermined condition, the outer bright spot area of the abnormal eye area is converted from the YUV space to the HSV space, and the brightness H value of the pixel of the outer bright point area in the HSV space is lowered according to the gradation factor, and then according to the The average value of the brightness of the pixels
  • the second predetermined coefficient is 0.9, and the predetermined luminance value is 115.
  • Determining, by the YUV data, the YUV reference value of the reference point of the abnormal eye region is: obtaining an average value of YUV data of some or all of the candidate reference points of the at least one candidate reference point; if the average value corresponding to the brightness value is greater than
  • the predetermined threshold is used to determine a predetermined reference value as a reference value of the reference point of the abnormal eye region, and otherwise the average value is used as a reference value of the reference point of the abnormal eye region.
  • the RGB of the red pixel satisfies the following condition: max(r, g, b)>th1, and max (r, g, b) - g > th2, and max(r, g, b) / g > th3, where r represents a red component among three color components of RGB, and g represents three color components of RGB
  • the green component, b represents the blue component of the three color components of RGB, and th1, th2, and th3 respectively represent three predetermined values of the red pixel; or RGB of the red pixel satisfies the following condition: r 2 /(g 2 +b 2 + th4) > th5, and r > th6, where r represents the red component of the three color components of RGB, g represents the green component of the three color components of RGB, and b represents the blue of the three color components of RGB
  • the color components, th4, th5, and th6 represent three predetermined
  • a graphics processing apparatus comprising: a determining unit, configured to determine an eyelid region of the input image; and an acquiring unit, configured to acquire a first mask image of the eyelid region, and according to the first mask
  • the film image determines at least one first abnormal region of the eyelid region, wherein the first mask image is a golden eye mask image or a red eye mask image, and the first mask image is a binary mask image; the determining unit further Determining, by the abnormal eye region determination condition corresponding to the first mask image, a first candidate abnormal eye region in the at least one first abnormal region, wherein the first candidate abnormal eye region satisfies the first mask All the determination conditions in the abnormal eye region determination condition corresponding to the image, the abnormal eye region determination condition corresponding to the first mask image includes at least one condition that the number of pixels of the first candidate abnormal eye region is greater than the first a predetermined value, the circularity of the first candidate abnormal eye region is greater than a second predetermined value, and the circularity of the first candidate
  • the specific implementation is: the acquiring unit And configured to acquire a second mask image of the eyelid region when the abnormal eye region is not found, and determine at least one second abnormal region of the eyelid region according to the second mask image, wherein the second mask The film image is a golden eye mask image or a red eye mask image, the second mask image is a binary mask image, the second mask image is different from the first mask image; the determining unit is further configured to The abnormal eye region determining condition corresponding to the second mask determines a second candidate abnormal eye region in the at least one second abnormal region, wherein the second candidate abnormal eye region satisfies an abnormal eye corresponding to the second mask image All the determination conditions in the partial region determination condition, the abnormal eye region determination condition corresponding to the second mask image includes at least one condition that the number of pixels of the second candidate abnormal eye region is greater than an eighth predetermined value, the first The circularity of the second candidate abnormal eye region is greater than a ninth predetermined value and the circularity of the second candidate abnormal eye
  • gray2 represents an average brightness of a region within a predetermined pixel range outside the first candidate abnormal eye region, or gray2 represents a plurality of reference points within a predetermined pixel range outside the first candidate abnormal eye region
  • Average brightness, sp represents the first candidate abnormal eye area
  • radius represents the original radius of the first candidate abnormal eye region.
  • the specific implementation is as follows: The brightness information of the eyelid region is obtained; the edge intensity image of the eyelid region is obtained according to the brightness information of the eyelid region; and the edge intensity image is subjected to binary clustering to obtain the first mask image of the eyelid region.
  • the method further includes: acquiring an edge intensity image of the eyelid region according to the brightness information of the eyelid region, where the acquiring unit is specific The method uses Gaussian blurring processing on the eyelid region, and performs soble edge intensity extraction on the eyelid region after Gaussian blurring according to the same-sex sobel operator to obtain an edge intensity image of the eyelid region; Binary clustering segmentation to obtain a first mask image of the eyelid region, the acquiring unit is specifically configured to acquire a first threshold value that causes the edge intensity image of the eyelid region to be divided into two categories according to a threshold value, and the variance between the classes is the largest, which is smaller than the first threshold An edge intensity of a threshold is set as a first threshold, and a second threshold value is obtained, which is obtained by dividing the edge intensity image of the eyelid region into two types according to a threshold, and the edge intensity image of the eyelid region is obtained according to the second threshold.
  • the mask image information takes a value of 0, and the mask image information of the pixel whose edge intensity is greater than or equal to the second threshold takes a value of 1.
  • the apparatus further includes a selecting unit and a graphics processing unit, wherein the selecting The unit is configured to select at least one candidate reference point from outside the abnormal eye region if the value of the original radius of the abnormal eye region is greater than a minimum empirical radius of the eye region in the eyelid region multiplied by a value of the first predetermined coefficient
  • the determining unit is further configured to determine a YUV reference value of the reference point of the abnormal eye region according to YUV data of some or all of the at least one candidate reference point;
  • the graphics processing unit is configured to: if the reference point is YUV If the pixel corresponding to the reference value is not a red pixel, the outer bright spot area of the abnormal eye area is adjusted according to the YUV reference value of the reference point.
  • the radius of the bright spot is a radius
  • the outer bright spot area is an area other than the inner bright spot area in the abnormal eye area; the graphic processing unit is further configured to perform smoothing on the abnormal eye area.
  • the first predetermined coefficient is 1.25.
  • the specific implementation is as follows: The RGB information of the eyelid region; the eyelid region is binarized according to the RGB information of the eyelid region to obtain a first mask image of the eyelid region.
  • the method is specifically: performing bi-level segmentation on the eyelid region according to the RGB information of the eyelid region to obtain the eyelid region a first mask image, wherein the acquiring unit is configured to set the mask image information corresponding to the red pixel in the eyelid region to 1, and the mask image information corresponding to the pixel other than the red pixel in the eyelid region is set to 0, thereby The first mask image is formed.
  • the apparatus further includes a selecting unit and a graphics processing unit, wherein the selecting The unit is configured to select at least one candidate reference point from outside the abnormal eye region; the determining unit is further configured to determine a reference point of the abnormal eye region according to YUV data of some or all of the at least one candidate reference point a YUV reference value; the graphics processing unit is configured to adjust an outer bright spot area of the abnormal eye area according to the YUV reference value of the reference point if the YUV reference value of the reference point meets a predetermined condition, according to the abnormal eye area Brightness of the inner bright spot area The average value adjusts the inner bright spot area of the abnormal eye area, or the graphic processing unit is configured to convert the outer bright spot area of the abnormal eye area from YUV space to if the YUV reference value of the reference point does not meet the predetermined condition HSV space, and according to the gradation factor, the brightness H value of the
  • the second predetermined coefficient is 0.9, and the predetermined luminance value is 115.
  • maxR represents the estimated maximum value of the optimal bright spot radius of the abnormal eye region
  • minR represents the estimation.
  • the minimum value of the optimal spot radius of the abnormal eye region, and the eyedistance indicates the distance between the centers of the two eyes in the input image.
  • the specific implementation is: used according to the at least one candidate reference point
  • the YUV data of the partial or all candidate reference points determines the YUV reference value of the reference point of the abnormal eye region
  • the determining unit is specifically configured to: obtain an average of the YUV data of some or all of the candidate reference points of the at least one candidate reference point a value; if the brightness value corresponding to the average value is greater than a predetermined threshold value, determining a predetermined reference value as a reference value of the reference point of the abnormal eye region, otherwise using the average value as a reference point of the reference point of the abnormal eye region value.
  • the RGB of the red pixel satisfies the following condition: max(r, g, b)>th1, and max (r, g, b) - g > th2, and max(r, g, b) / g > th3, where r represents a red component among three color components of RGB, and g represents three color components of RGB
  • the green component, b represents the blue component of the three color components of RGB, and th1, th2, and th3 respectively represent three predetermined values of the red pixel; or RGB of the red pixel satisfies the following condition: r 2 /(g 2 +b 2 + th4) > th5, and r > th6, where r represents the red component of the three color components of RGB, g represents the green component of the three color components of RGB, and b represents the blue of the three color components of RGB
  • the color components, th4, th5, and th6 represent three predetermined
  • the eye image processing method and apparatus acquires a candidate abnormal eye region by analyzing a mask image of the eyelid region, and passes the filling degree of the candidate abnormal eye region and the brightness of the eyelid region.
  • the feature determines the confidence of the candidate abnormal eye region, thereby enabling more accurate positioning of the abnormal eye region of the eye image, providing accurate location information for the processing of the abnormal eye.
  • FIG. 1 is a flow chart of an image processing method according to an embodiment of the present invention.
  • FIG. 2a is an exemplary view of an eyelid region of an embodiment of the present invention.
  • FIG. 2b is a schematic diagram of a face area according to an embodiment of the present invention.
  • FIG. 3 is another flow chart of an image processing method according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a graphics processing apparatus according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of another graphics processing apparatus according to an embodiment of the present invention.
  • the average value means an arithmetic mean value unless otherwise specified.
  • FIG. 1 is a flow chart of an eye image processing method according to an embodiment of the present invention, and the method of FIG. 1 is executed by a graphics processing device.
  • FIG. 2a is a view showing an example of an eyelid region of an embodiment of the present invention.
  • Figure 2a shows the eyelid area of the golden and red eyes.
  • the eyelid area includes the eye and a portion of the area around the eye, which in turn includes the eyeball and Two parts of the eye white.
  • the golden eyelid and the red eyelid appear in the area where the eyeball is located in the eye.
  • FIG. 2b is a schematic diagram of a face face area according to an embodiment of the present invention. A specific implementation is shown in Figure 2b. If the coordinates of the upper left corner of the face frame (0,0), width w, and height h, you can choose the coordinates of the upper left corner (0, h/7), width w, height h/ The area of 4 serves as the eyelid area.
  • any parameter relating to the length is in units of pixels unless otherwise specified.
  • a radius of 70 indicates that the length of the radius is 70 pixels, or the length of the radius is equal to the length of 70 pixels.
  • the mask image of the eyelid region can be obtained in various ways.
  • the first mask image may be a golden eye mask image of the eyelid region or a red eye mask image of the eyelid region.
  • the first mask image can also be other types of mask images.
  • the first mask image may be a binary mask image, represented by 0 and 1, 0 means the pixel is normal, 1 means the pixel is abnormal, and the binary mask image formed according to the state of all the pixels can be judged in the eyelid region. Areas such as golden eyes, red eyes, etc. Of course, 0 is also used to indicate a pixel abnormality, and 1 is a normal pixel. The present invention is not limited thereto. In the embodiment of the present invention, the mask image indicates that the pixel is abnormal.
  • the first abnormal region is a region corresponding to the connected region of the pixel in the first mask image in the eyelid region.
  • the first candidate abnormal eye region satisfies the condition that the image of the first candidate abnormal eye region
  • the prime number is greater than the first predetermined value
  • the circularity of the first candidate abnormal eye region is greater than a second predetermined value
  • the circularity of the first candidate abnormal eye region is less than a third predetermined value
  • the first candidate abnormal eye The original radius of the region is greater than a fourth predetermined value
  • the degree of filling of the first candidate abnormal eye region is greater than a fifth predetermined value
  • the pixel ratio of the first candidate abnormal eye region to the eyelid region is greater than a sixth predetermined value
  • a predetermined value is a positive integer
  • a second predetermined value is a positive number less than 1
  • a third predetermined value is a positive number greater than 1
  • the fourth predetermined value is a positive number
  • the fifth predetermined value is a positive number
  • the sixth predetermined value is a positive number.
  • the first predetermined value takes a value of 60
  • the second predetermined value takes a value of 0.6
  • the third predetermined value takes a value of 1.6
  • the fourth predetermined value takes a value of 30
  • the fifth predetermined value takes a value of 0.65.
  • the value is 0.08, and so on.
  • the confidence of the first candidate abnormal eye region is determined by the degree of filling of the first candidate abnormal eye region and the brightness feature of the eyelid region.
  • the confidence level of the first candidate abnormal eye region is used to indicate the degree of trust of the first candidate abnormal eye region as the abnormal eye region of the eyelid region.
  • the candidate abnormal eye region is obtained by analyzing the mask image of the eyelid region, and the confidence of the candidate abnormal eye region is determined by the filling degree of the candidate abnormal eye region and the brightness feature of the eyelid region, thereby
  • the abnormal eye area that can more accurately locate the eye image provides accurate position information for the treatment of the abnormal eye.
  • the method further includes: acquiring a second mask image of the eyelid region when the abnormal eye region is not found, where the second mask image is a golden eye mask image or a red eye mask image,
  • the second mask image may be a binary mask image, the second mask image being different from the first mask image; acquiring at least one second abnormal region of the eyelid region according to the second mask image;
  • the abnormal eye region determining condition corresponding to the second mask image determines a second candidate abnormal eye region in the at least one second abnormal region, wherein the second candidate abnormal eye region satisfies an abnormal eye corresponding to the second mask image
  • All the determination conditions in the partial region determination condition, the abnormal eye region determination condition corresponding to the second mask image includes at least one of the following conditions: the pixel of the second candidate abnormal eye region The number of the second candidate abnormal eye region is greater than a ninth predetermined value, and the circularity of the second candidate abnormal eye region is less than a tenth predetermined value, the second candidate abnormal eye region The original radius of the second candidate is smaller than the
  • the eighth predetermined value is a positive integer
  • the ninth predetermined value is a positive number less than 1
  • the tenth predetermined value is a positive number greater than 1
  • the eleventh predetermined value is a positive number
  • the twelfth predetermined The value is a positive number
  • the thirteenth predetermined value is a positive number
  • a confidence level of the second candidate abnormal eye region is determined by a degree of filling of the second candidate abnormal eye region and a brightness characteristic of the eyelid region.
  • the second mask image can also be represented by 0, 1.
  • the second abnormal region is a region corresponding to the connected region of the pixel abnormality in the second mask image in the eyelid region.
  • the second abnormal region and the first abnormal region are only abnormal regions for distinguishing two mask image determinations, and there is no substantial difference.
  • a mask image fails to locate an abnormal eye region
  • another mask image of the eyelid region is acquired, thereby determining an abnormal eye region, and the accuracy of the abnormal eye region positioning can be improved.
  • a morphological operation may be performed on the first mask image to remove an isolated point of the first mask image.
  • the confidence s of the first candidate abnormal eye region is expressed by a formula (1.1):
  • c represents the degree of filling of the first candidate abnormal eye region
  • gray represents the brightness characteristic of the eyelid region
  • represents a scale factor of the brightness characteristic of the eyelid region in the confidence level
  • the filling degree c of the first candidate abnormal eye region is expressed by the formula (1.2):
  • sp represents the number of pixels of the first candidate abnormal eye region, and radius represents the original radius of the first candidate abnormal eye region;
  • the brightness characteristic gray of the eyelid region is expressed by the formula (1.3):
  • gray4 indicates the average brightness of the eyelid region
  • gray2 indicates the average brightness of the region within a predetermined pixel range outside the first candidate abnormal eye region
  • gray2 indicates the predetermined pixel range outside the first candidate abnormal eye region.
  • the average brightness of several reference points, a represents the scale factor of the brightness characteristics of the eyelid region's average brightness in the eyelid region.
  • step 102 is specifically implemented to: obtain brightness information of the eyelid region; obtain an edge intensity image of the eyelid region according to brightness information of the eyelid region; and perform binary clustering on the edge intensity image To obtain a first mask image of the eyelid region.
  • acquiring the edge intensity image of the eyelid region according to the brightness information of the eyelid region may be implemented by performing Gaussian blur processing on the eyelid region, and performing soble on the eyelid region after the Gaussian blur processing according to the same (sobel) operator.
  • the method further includes: if the value of the original radius of the abnormal eye region is greater than a value of the minimum empirical radius of the abnormal eye region in the eyelid region multiplied by the first predetermined coefficient, then from the abnormal eye region Determining at least one candidate reference point; determining a YUV reference value of the reference point of the abnormal eye region according to YUV data of some or all of the at least one candidate reference point; if the YUV reference value of the reference point corresponds to the pixel Not a red pixel, then according to the reference Adjusting the outer bright spot area of the abnormal eye area according to the YUV reference value of the point, and adjusting the inner bright spot area of the abnormal eye area according to the brightness average value of the inner bright spot area of the abnormal eye area, wherein the inner bright spot area is the abnormal eye area
  • the center point of the part region is a center
  • the radius of the best bright spot of the abnormal eye region is a radius
  • the outer bright spot region is an area other than the inner bright spot region in the abnormal eye region; the
  • the first predetermined coefficient takes a value of 1.25.
  • maxR represents the estimated maximum value of the optimal bright spot radius of the abnormal eye region
  • minR represents the minimum value of the estimated optimal bright spot radius of the abnormal eye region
  • eyedistance represents the center of the two eyes in the input image. distance.
  • determining a YUV reference value of the reference point of the abnormal eye region according to YUV data of some or all of the at least one candidate reference point may be implemented as: acquiring some or all candidate references in the at least one candidate reference point An average value of the YUV data of the point; if the brightness value corresponding to the average value is greater than a predetermined threshold value, determining a predetermined reference value as a reference value of the reference point of the abnormal eye region, otherwise using the average value as the abnormal eye portion The reference value of the reference point of the area.
  • step 102 is specifically implemented to: obtain RGB information of the eyelid region; perform binary segmentation on the eyelid region according to RGB information of the eyelid region to obtain a first mask image of the eyelid region.
  • performing the binary segmentation on the eyelid region according to the RGB information of the eyelid region to obtain the first mask image of the eyelid region may be implemented as: setting the mask image information corresponding to the red pixel in the eyelid region to 1 The mask image information corresponding to the pixels other than the red pixels in the eyelid region is set to 0, thereby forming the first mask image.
  • the method further includes: selecting at least one candidate reference point from outside the abnormal eye region; determining YUV of the reference point of the abnormal eye region according to YUV data of some or all of the candidate reference points of the at least one candidate reference point a reference value; if the YUV reference value of the reference point meets a predetermined condition, the outer bright spot area of the abnormal eye area is adjusted according to the YUV reference value of the reference point, and the brightness average value of the inner bright spot area according to the abnormal eye area is adjusted according to the YUV reference value of the reference point Adjusting the inner bright spot area of the abnormal eye area, or if the YUV reference value of the reference point does not meet the predetermined condition, converting the outer bright spot area of the abnormal eye area from the YUV space to the HSV space, and adjusting according to the gradation factor Lowering the brightness H value of the pixel of the outer bright spot area in the HSV space, and then adjusting the inner bright spot area of the abnormal eye area according to the brightness average value of the inner bright spot area
  • the predetermined condition is that the pixel corresponding to the YUV reference value of the reference point is a red pixel, and the value of the YUV luminance value of the reference point multiplied by the second predetermined coefficient is smaller than the intermediate brightness value of the abnormal eye region, and the The average brightness of the abnormal eye area is smaller than the predetermined brightness value.
  • the second predetermined coefficient takes a value of 0.9, and the predetermined brightness value takes a value of 115.
  • determining a YUV reference value of the reference point of the abnormal eye region according to YUV data of some or all of the at least one candidate reference point may be implemented as: acquiring some or all candidate references in the at least one candidate reference point An average value of the YUV data of the point; if the brightness value corresponding to the average value is greater than a predetermined threshold value, determining a predetermined reference value as a reference value of the reference point of the abnormal eye region, otherwise using the average value as the abnormal eye portion The reference value of the reference point of the area.
  • the RGB of the red pixel satisfies the following condition: max(r, g, b)>th1, and max(r, g, b)-g>th2, and max(r, g, b) / g > th3, where r represents the red component of the three color components of RGB, g represents the green component of the three color components of RGB, and b represents the blue component of the three color components of RGB, Th1, th2, and th3 respectively represent three predetermined values of the red pixel.
  • RGB of the red pixel satisfies the following condition: r 2 /(g 2 +b 2 +th4)>th5, and r>th6, where r represents three colors of RGB
  • the red component in the component g represents the green component of the three color components of RGB
  • b represents the blue component of the three color components of RGB
  • th4, th5, and th6 respectively represent three predetermined values of the red pixel determination.
  • the manner of obtaining the first mask image and the manner of processing the input image according to the first mask image are also applicable to the second mask image, except that the corresponding parameter or determination condition needs to be according to the type of the mask image (golden mask)
  • the image or the red-eye mask image is adjusted accordingly, and details are not described herein again.
  • FIG. 3 is a specific flowchart of an image processing method according to an embodiment of the present invention.
  • the image is a rectangular area of the eyelid, it can be processed directly on the image.
  • the eyelid rectangular area is estimated.
  • a specific example is shown in Figure 2b. If the coordinates of the upper left corner of the face frame (0,0), width w, and height h, then the coordinates of the upper left corner of the eye frame (0, h/7), width w, height h can be selected. The area of /4 is used as the eyelid area.
  • Mask images of the eyelid area can be extracted in a variety of ways.
  • a mask image extraction method can extract a golden eye mask image of an eyelid region.
  • a Gaussian blurring process can be performed on the eyelid region, and then the Sobel edge intensity is extracted from the image subjected to Gaussian blurring to obtain an edge intensity image of the eyelid region.
  • the sobel operator is as follows:
  • golden eye Since the golden eye is very strong, if there is a golden eye, it is extracted by a threshold.
  • Gold eye mask images can be extracted by cluster analysis.
  • the threshold is calculated according to the edge intensity graph, and then the edge intensity image is binarized by 0 and 1 according to the threshold, and 1 represents a pixel abnormality corresponding to the eyelid region. Specific steps are as follows:
  • the histogram of the edge intensity of the eyelid region is counted, and then a threshold is given.
  • the histogram is divided into two segments (corresponding to the two types of edge intensity of the edge intensity image), the probability value and the mean value of each segment are counted, and the variance formula is constructed. Traversing each threshold (0 to 255), the threshold t0 that satisfies the largest variance between classes is the first threshold sought.
  • the data smaller than the threshold t0 is set to t0, the above operation is repeated again, the second threshold t1 is regenerated, and the edge intensity image of the eyelid region is binary-divided according to the second threshold t1, and the pixel whose edge intensity is smaller than t1 is set to 0. Pixels with edge strength greater than t1 are set to 1, thereby generating a mask image of the eyelid region. If the edge strength is equal to t1, it can be uniformly set to 0, or uniformly set to 1.
  • the inter-class variance algorithm is as follows:
  • the edge intensity image has an edge intensity level of L and a histogram of Pi, which is divided into two categories by a threshold value t.
  • ⁇ 0 (t) represents the probability of C0
  • ⁇ 1 (t) represents the probability of C1
  • ⁇ 0 (t) represents the mean of C0
  • ⁇ 1 (t) represents the mean of C1.
  • ⁇ 2 represents the inter-class variance of C0 and C1.
  • the mask image after the binary separation is a mask image of the eyelid region, and the mask image is a golden eye mask image.
  • Another mask image extraction method can extract a red eye mask image of an eyelid region.
  • the eyelid region is binarized according to the type of the pixel. If the pixel in the eyelid area is a red pixel, the information of the corresponding mask image is set to 1, otherwise it is set to 0.
  • whether the pixel is a red pixel can be determined according to the formula (3.3), and the pixel is a red pixel when the RGB information of the pixel satisfies the formula (3.3).
  • r denotes a red component in the RGB information of the pixel
  • g denotes a green component in the RGB information of the pixel
  • b denotes a blue component in the RGB information of the pixel
  • R denotes a maximum value of three color components of the RGB of the pixel
  • Th1, th2, and th3 are predetermined thresholds.
  • the value of th1 ranges from 60 to 80
  • the range of th2 ranges from 45 to 65
  • the range of th3 ranges from 1.8 to 2.0. A more accurate judgment can be obtained.
  • th1, th2, and th3 may fall into other value ranges, and the embodiments of the present invention are not limited herein.
  • whether the pixel is a red pixel can be determined according to the formula (3.4), and the pixel is a red pixel when the RGB information of the pixel satisfies the formula (3.4).
  • ratio represents the red coefficient of the pixel
  • r represents the red component of the pixel
  • g represents the green component of the pixel
  • b represents the blue component of the pixel.
  • the value of th4 ranges from 10 to 18, the range of th5 ranges from 3.2 to 3.4, and the range of th6 ranges from 60 to 80. A more accurate judgment result can be obtained.
  • th4 can take a value of 14, and th5 takes a value of 3.3, and th6 takes a value of 70.
  • the values of th4, th5, and th6 may also fall within other value ranges, and the embodiments of the present invention are not limited herein.
  • the mask image after binarization according to the red pixel is a mask image of the eyelid region, and the mask image is a red eye mask image.
  • the golden eye mask image and the red eye mask image of the eyelid region can be obtained by other methods, and the mask images of other eye defects can be obtained by other methods, and the embodiment of the present invention does not limit.
  • the candidate abnormal eye region in the eyelid region is marked.
  • the binary mask can be processed by morphological operation to obtain a better masking effect.
  • Morphological operations can include corrosion, expansion operations, and the like.
  • an isolated point removal operation may be employed.
  • the point is considered to be an isolated point and removed, for example, if the pixel periphery 8
  • the number of neighborhood points is less than three, and the point can be regarded as an isolated point and removed. This method can be used to remove some relatively isolated noise.
  • the connected region is analyzed for the mask image to determine whether a point is connected to the surrounding point.
  • the connected types are four connected (upper, right down, right left, right) and eight connected (upper, down, right, right, top left, bottom left, top right, bottom right).
  • Commonly used algorithms include two scanning methods and a recursive method.
  • the embodiment of the present invention describes a recursive method as an example, but does not exclude the possibility of using other algorithms.
  • the recursive method is as follows: scan each pixel in the mask image once, when an unmarked target pixel is found, push it onto the stack and repeatedly mark its neighborhood from that point until the stack is empty.
  • a processed mask image is obtained, wherein the aggregated region corresponding to the mask image information of the pixel is the candidate abnormal eye region. Based on the processed mask image, several candidate abnormal eye regions of the eyelid region can be determined.
  • Whether the candidate abnormal eye region is an abnormal eye region can be determined by a plurality of parameters. Commonly used parameters are roundness, area, and fill level. Its definition is as follows:
  • Roundness width (w) of the candidate abnormal eye region / height (h) of the candidate abnormal eye region.
  • Area number of pixels of the candidate abnormal eye area (sumPixels).
  • the degree of complement the number of pixels of the candidate abnormal eye region (sumPixels) / ( ⁇ * radius * radius), where radius represents the original radius of the candidate abnormal eye region.
  • the first step it is possible to initially determine whether the candidate abnormal eye region is an abnormal eye region according to the threshold of the plurality of parameters.
  • one or more of the above parameters may be selected for threshold determination. Any condition that does not meet the conditions of judgment can be excluded from the abnormal eye area. Therefore, the more the judgment condition, the less the misjudgment that the normal area is misjudged as the abnormal eye area.
  • the area of the candidate abnormal eye region is larger than the first predetermined value.
  • the number of pixels of the candidate abnormal eye region is greater than the first predetermined value, wherein the first predetermined value is a positive integer.
  • the first predetermined value may be a fixed value or may be obtained by calculation.
  • the first predetermined value (0.001 * the number of pixels in the eyelid region).
  • the first predetermined value (0.001 * the number of pixels in the eyelid region).
  • the first predetermined value is a fixed value
  • the first predetermined value is between 20 and 40, and a better judgment effect can be obtained.
  • the first predetermined value may take values of 20, 30, 40, and the like.
  • the first predetermined value is a fixed value
  • the first predetermined value is between 50 and 70, and a better judgment effect can be obtained.
  • the first predetermined value may take a value of 60.
  • the candidate abnormal eye region When the area of the candidate abnormal eye region is greater than the first predetermined value, it may be preliminarily determined that the candidate abnormal eye region may be an abnormal eye region; otherwise, the candidate abnormal eye region is excluded.
  • the circularity of the candidate abnormal eye region is greater than a second predetermined value, and the circularity of the candidate abnormal eye region is less than a third predetermined value.
  • the roundness of the abnormal eye region is between the two values of the second predetermined value and the third predetermined value.
  • the second predetermined value is a positive number less than 1
  • the third predetermined value is a positive number greater than 1.
  • the roundness of the abnormal eye region may range from 0.6 to 1.6, 0.65 to 1.55, 0.7 to 1.5, and the like.
  • the roundness of the abnormal eye region ranges from 0.6 to 1.6, and the second predetermined value is 0.6 and the third predetermined value is 1.6.
  • the candidate abnormal eye region may be excluded; when the circularity of the candidate abnormal eye region is between 0.6 and 1.6, the candidate abnormal eye may be initially identified.
  • the area may be an abnormal eye area.
  • the second predetermined value is between 0.6 and 0.7
  • the third predetermined value is between 1.5 and 1.6, and a good judgment effect can be obtained.
  • the second predetermined value is between 0.6 and 0.7
  • the third predetermined value is between 1.5 and 1.6, and a good judgment effect can be obtained.
  • the original radius of the candidate abnormal eye region is greater than a fourth predetermined value.
  • the candidate abnormal eye region When the original radius of the candidate abnormal eye region is less than the fourth predetermined value, the candidate abnormal eye region may be excluded; when the original radius of the candidate abnormal eye region is greater than or equal to the fourth predetermined value, the candidate abnormal eye may be initially identified.
  • the area may be an abnormal eye area.
  • the fourth predetermined value is a positive number.
  • the fourth predetermined value is between 3 and 5, and a good judgment effect can be obtained.
  • the fourth predetermined value is between 4 and 6, and a good judgment effect can be obtained.
  • the threshold for this radius is generally different.
  • a calculation method of the original radius of the abnormal eye region can be expressed by the following formula:
  • the original radius (locationR) max (the abnormal eye area is wide, the abnormal eye area is high) / 2.
  • the degree of filling of the candidate abnormal eye region is greater than a fifth predetermined value.
  • the candidate abnormal eye region When the degree of filling of the candidate abnormal eye region is less than the fifth predetermined value, the candidate abnormal eye region may be excluded; when the filling degree of the candidate abnormal eye region is greater than or equal to the fifth predetermined value, the candidate abnormal eye may be initially identified.
  • the area may be an abnormal eye area.
  • the threshold for the fill level is generally different.
  • the fifth predetermined value is between 0.6 and 0.7, and a good judgment effect can be obtained.
  • the fifth predetermined value is between 0.5 and 0.6, and a good judgment effect can be obtained.
  • the fifth predetermined value of the golden eye mask image may have a value of 0.65
  • the fifth predetermined value of the red eye mask image may have a value of 0.5.
  • the possibility of selecting other values is not excluded.
  • the pixel ratio of the candidate abnormal eye region to the eyelid region is greater than a sixth predetermined value.
  • the candidate abnormal eye region and the eyelid region pixel ratio (ratio) ( ⁇ * radius * radius) / (eyelid width * eyelid height), where radius represents the original radius of the candidate abnormal eye region.
  • the sixth predetermined value generally takes between 0.009 and 0.011, and a good judgment effect can be obtained. Of course, the possibility of taking other values is not excluded.
  • the range of values of the first predetermined value to the sixth predetermined value is only a range in which a better determination effect may be obtained.
  • the possibility that the first predetermined value to the sixth predetermined value fall into other value intervals is not excluded.
  • the above several conditions can be separately selected as the judgment conditions of the abnormal eye region.
  • 1, 2, 4, and 5 can be selected as the determination conditions
  • 1, 2, 3, and 4 can be selected as the determination conditions.
  • the candidate abnormal eye region may be an abnormal eye region when all the selected conditions are satisfied. If the selected condition If any of the conditions is not satisfied, the candidate abnormal eye region is excluded.
  • the second step it is determined whether the confidence level of the candidate abnormal eye region is greater than a seventh predetermined value.
  • Luminance feature (gray) ( ⁇ * gray 4 - gray 2) / ( ⁇ * gray 4).
  • gray4 indicates the average brightness of the eyelid region
  • gray2 indicates the average brightness of the region within a predetermined pixel range outside the first candidate abnormal eye region
  • gray2 indicates the predetermined pixel range outside the first candidate abnormal eye region.
  • the average luminance of several reference points ⁇ represents the scale factor of the luminance characteristics of the eyelid region in the eyelid region
  • represents the scale factor of the luminance feature in the confidence level.
  • the value of ⁇ ranges from 0.9 to 1.1
  • the range of ⁇ ranges from 1.4 to 1.8
  • the value of score ranges from 1.0 to 1.2.
  • the confidence level is judged more accurately.
  • the possibility that the values of ⁇ , ⁇ and score fall into other value ranges is not excluded.
  • gray2 An example of calculating gray2 is as follows: In addition to the candidate abnormal eye region, within the three pixel ranges, the left and right regions take a plurality of reference points to obtain an average value of the brightness, which is gray2.
  • the candidate abnormal eye region may be regarded as an abnormal eye region, otherwise the candidate abnormal eye region is considered to be a non-abnormal eye region.
  • takes a value of 0.95
  • takes a value of 1.6
  • a seventh predetermined value takes a value of 1.0, and so on.
  • step 307 is performed; if it is a red eye mask image, step 312 is performed.
  • step 306 is performed.
  • step 302 is performed.
  • the type of eye sputum is golden eyelid
  • the mask image is a golden eye mask image.
  • the empirical radius of the abnormal eye region can be estimated by the minimum empirical radius formula of the abnormal eye region.
  • the empirical radius formula for an abnormal eye area is as follows:
  • Minimum experience radius (minRad) eyelid width (width) / 50 + 2.
  • step 319 is performed.
  • step 309 is performed.
  • the predetermined coefficient may take a value of 1.25.
  • the processing may be selected, or may be selected not to be processed.
  • information of several candidate reference points may be selected.
  • the information of the candidate reference point may be information related to the brightness of the candidate reference point.
  • the information of the three channels of the YUV of the candidate reference point is described.
  • Y means “brightness” (Luminance or Luma), which is the grayscale value; and "U” and “V” indicate “chrominance” (Chrominance or Chroma), the effect is Describes the color and saturation of the image, which is used to specify the color of the pixel.
  • “Brightness” is established by RGB input signals by superimposing specific parts of the RGB signal together.
  • "Chroma” defines two aspects of color - hue and saturation, represented by Cr and Cb, respectively. Among them, Cr reflects the difference between the red part of the RGB input signal and the brightness value of the RGB signal.
  • Cb reflects the difference between the blue portion of the RGB input signal and the luminance value of the RGB signal.
  • each target of the abnormal area is usually divided into left and right sides, which are the left side of the left eye, the right side of the left eye, the left side of the right eye, and the right side of the right eye. Get an average reference point.
  • candidate reference points When selecting a candidate reference point, it can be centered on the center coordinate of the abnormal eye area, locationR +n pixels are in the radius range, and several points outside the abnormal eye region are selected as candidate reference points, and n generally takes values of 2, 3, 4, and 5, and of course, the possibility of n taking other values is not excluded.
  • candidate reference points can be selected from four orientations (up, down, left, and right) of the abnormal eye region, or eight orientations from the abnormal eye region (top left, right left, bottom left, top right, positive) Next, upper right, right right, bottom right) select candidate reference points.
  • candidate reference points can be randomly selected, or candidate reference points can be performed according to certain rules. Obviously, selecting candidate reference points according to certain rules can achieve predictable effects compared to random selection. Moreover, under some specific selection rules, the selection of candidate reference points can achieve relatively good results.
  • FIG. 4 is a schematic diagram of selection of candidate reference points in an embodiment of the present invention.
  • the figure shows the candidate reference point selection for the left eye, and the box area is the left side of the left eye.
  • the locationR in the figure represents the original radius of the abnormal eye area.
  • a candidate reference point selection rule is as shown in FIG. 4, and for the left eye left side, a candidate reference of five directions of the upper left, the upper left, the right left, the lower left, and the lower left of the left eye may be selected. Point, where the right reference point is selected the most, right up and next time, left upper and lower left again.
  • a total of 25 candidate reference points are selected on the left side of the left eye, of which 17 are on the left side; 3 on the top and bottom sides; and one on the top left and the bottom left.
  • the right side of the left eye can select the candidate reference points of the five directions of the upper right, the upper right, the right right, the lower right, and the lower left of the left eye, wherein the right reference point is the most, the upper and the right Next time, right upper and lower right again.
  • the selection of the candidate reference point of the right eye is similar to that of the left eye, and details are not described herein again.
  • the reference value of the reference point may be determined according to the candidate reference point.
  • the reference value of the reference point including the reference values of the Y, U, and V components of the YUV, is respectively calculated by the corresponding component of the candidate reference point.
  • the average of all candidate reference points can be used as a reference value for the reference point.
  • the average of the first few candidate reference points with the darkest brightness may be selected from the candidate reference points as the reference value of the reference point.
  • an average of several candidate reference points centered on the luminance may be selected from the candidate reference points.
  • the reference value of the reference point can also be determined by other means.
  • the above average value is changed to a square average value, a harmonic average value, or a weighted average value.
  • the weighted average may be weighted according to the orientation of the candidate reference point, and so on.
  • the average value of YUV of each of the left and right sides of the abnormal eye region can be obtained.
  • the abnormal eye region can also be regarded as a whole, and a reference point is obtained as a reference point of the abnormal eye region according to the candidate reference point.
  • the abnormal eye region may be divided into three or more sub-regions, the candidate reference points are respectively selected according to the sub-regions of the abnormal eye region, and the reference points of the sub-regions are obtained according to the candidate reference points of the sub-regions.
  • step 311 is performed, otherwise step 319 is performed.
  • the pixel corresponding to the average value of the YUV is a red pixel.
  • a YUV value (including three components of Y, U, and V) corresponds to one RGB information (including three components of r, g, and b). If the RGB information corresponding to the YUV value meets the judgment condition of the red pixel, it can be said that The pixel corresponding to the average value of YUV is a red pixel.
  • the criterion of the red pixel refer to the formula (3.3) and the formula (3.4) in the step 302, which are not described herein again.
  • step 319 is performed.
  • the luminance values in the respective YUV average values of all the reference points are judged. If the brightness value in the YUV average is greater than the predetermined threshold, the YUV average is not suitable as the reference value of the reference point. In this case, a default reference value may be taken as the reference value corresponding to the reference point; if the YUV average is When the brightness value is less than a predetermined threshold, the YUV average value is used as a reference value of the reference point.
  • the predetermined threshold value is between 80 and 115, a good reference point can be obtained.
  • a good reference point can be obtained.
  • the predetermined threshold is 100 and the luminance value in the YUV average is 110, a default reference value can be used as the reference value of the reference point.
  • the possibility that the predetermined threshold value falls within other value ranges is not excluded.
  • the outer bright spot area of the abnormal eye area is filled according to the reference value of the obtained reference point.
  • the abnormal eye region can be divided into an inner bright spot area and an outer bright point area, wherein an area within the abnormal eye area of the abnormal eye area is an inner bright spot area, and an area other than the optimal bright spot radius in the abnormal eye area is outer Highlight area.
  • An optimal spot radius calculation for an abnormal eye area is as follows:
  • the optimum spot radius (optR) of the abnormal eye area (maximum reference width (maxR) - minimum reference width (minR)) * ((eyedistance - 100) / 400 + minimum reference width (minR)).
  • the maximum reference width and the minimum reference width are the maximum reference width and the minimum reference width of the inner bright spot area estimated empirically.
  • the reference point value of the reference point is filled with the reference point from the light to the dark.
  • the brightness value of the fill is to be linearly decremented by the outer to center point of the abnormal eye area. For example, suppose the brightness of the reference point is Y, the brightness of the point fill from the center point from the original radius (locationR) is Y*1, and the brightness of the center point fill is Y*0.85, so that the outer bright spot area is filled. It should be noted that although the brightness of the center point filling is indicated here as Y*0.85, the inner bright point area including the center point is not actually filled.
  • the boundary area can be smoothed by Gaussian blurring.
  • the type of eye sputum is red eye sputum
  • the mask image is a red eye mask image.
  • the original radius of an abnormal eye area can be expressed by the following formula:
  • the original radius (locationR) max (the abnormal eye area is wide, the abnormal eye area is high) / 2.
  • n generally takes values 2, 3, 4, and 5, and of course does not exclude the possibility that n takes other values.
  • four directions from the abnormal eye area (up, down, left, Right) Select a candidate reference point, or select a candidate reference point from eight directions (upper left, right left, lower left, upper right, lower right, upper right, right right, lower right) of the abnormal eye region.
  • the candidate reference point is usually selected only on the left and right sides of the abnormal eye region. Taking FIG. 4 as an example, the point on the left side only takes the positive left region as the candidate reference point, and up to the upper left. And the lower left area, the right side only takes the point of the right area as the candidate reference point, up to the upper right and lower right areas.
  • the reference value of the reference point may be determined according to the candidate reference point.
  • the reference value of the reference point including the reference values of the Y, U, and V components of the YUV, is respectively calculated by the corresponding component of the candidate reference point.
  • the average of all candidate reference points can be used as a reference value for the reference point.
  • the average of the first few candidate reference points with the darkest brightness may be selected from the candidate reference points as the reference value of the reference point.
  • an average of several candidate reference points centered on the luminance may be selected from the candidate reference points.
  • the reference value of the reference point can also be determined by other means, for example, the above average value is changed to a square average value, a harmonic average value, or a weighted average value.
  • the weighted average may be weighted according to the orientation of the candidate reference point, and so on.
  • the average YUV of each of the left and right sides of the abnormal eye region can be obtained, that is, the respective reference points on both sides of the abnormal eye region are determined.
  • the abnormal eye region can also be regarded as a whole, and a reference point is obtained as a reference point of the abnormal eye region according to the candidate reference point.
  • the abnormal eye region may be divided into three or more sub-regions, the candidate reference points are respectively selected according to the sub-regions of the abnormal eye region, and the reference points of the sub-regions are obtained according to the candidate reference points of the sub-regions.
  • step 314 It is judged whether the acquired reference point is a suitable reference point according to a predetermined condition. If all the reference points of the abnormal eye region meet the predetermined condition, it means that there is a suitable reference point, and step 314 can be performed; if at least one reference point does not meet the predetermined condition, it means that there is no suitable reference point. At this point, step 315 can be performed.
  • the predetermined condition includes: the pixel corresponding to the YUV reference value of the reference point is a red pixel, and The value obtained by multiplying the YUV luminance value of the reference point by the second predetermined coefficient is smaller than the intermediate luminance value of the abnormal eye region, and the luminance average value of the abnormal eye region is smaller than the predetermined luminance value.
  • the second predetermined coefficient ranges from 0.8 to 1.0, and the predetermined brightness value ranges from 105 to 125, a suitable reference point can be obtained. Of course, the possibility that the value range falls within other value ranges is not excluded.
  • the predetermined condition can be expressed by the following formula:
  • yMean represents the brightness value in the reference point YUV
  • yMedian represents the intermediate value of the brightness of the abnormal eye area.
  • the formula indicates that the pixel corresponding to the reference point is a red pixel, and the luminance value of the reference point is multiplied by 0.9 is less than or equal to the luminance average value of the abnormal eye region, and the luminance average of the abnormal eye region is less than 115, and && represents a logical AND.
  • step 302 When the pixel corresponding to the YUV value of the reference point is determined to be a red pixel, refer to the method in step 302, which is not described herein again.
  • the abnormal eye region can be divided into an inner bright spot area and an outer bright point area, wherein the inner bright spot area in the abnormal eye area is the inner bright spot area, and the optimal bright spot radius in the abnormal eye area.
  • the area other than the area is the outer highlight area.
  • An optimal spot radius calculation for an abnormal eye area is as follows:
  • Optimal spot radius (optR) for abnormal eye area (maximum reference width (maxR) - minimum reference width (minR)) * ((eyedistance - 100) / 400 + minimum reference width (minR))
  • the maximum reference width and the minimum reference width are the maximum reference width and the minimum reference width of the inner bright spot area estimated empirically.
  • the brightness value of the replacement is to be linearly decremented by the outer to center point of the abnormal eye region.
  • the distance center The point where the point is replaced by the original radius (locationR) is Y*1
  • the brightness of the center point replacement is Y*0.85
  • the inner bright point area including the center point is not actually filled.
  • the Gaussian blurring process can be used to smooth the boundary area.
  • the YUV space of the area to be adjusted is converted into the HSV space.
  • the area to be adjusted is an outer bright spot area.
  • the center of the abnormal eye region is centered, the region with the radius of the best spot radius is the inner bright spot region, and the region outside the bright spot region of the abnormal eye region is the outer bright spot region.
  • HSV is a color space based on the intuitive characteristics of color, where the parameters of the color are: Hue, H, Saturation, S, and V.
  • Hue H indicates the color information, that is, the position of the spectral color in which it is located, measured by angle, ranging from 0° to 360°, calculated from the red counterclockwise direction, red is 0°, green is 120°, blue The color is 240°.
  • Their complementary colors are: 60° for yellow, 180° for cyan, and 300° for magenta.
  • Brightness V Indicates the brightness of the color, ranging from 0.0 (black) to 1.0 (white). One thing to note: there is no direct connection between it and the light intensity.
  • the H value of the adjustment area is pulled down.
  • the H value of the adjustment area can be multiplied by a gradation factor to be pulled down.
  • the design's grading factor is related to the distance, that is, the distance from the current point to the center of the red eye is obtained. The lower the value of the distance, the smaller the gradation factor, and the linear relationship between the two is linear. .
  • the gradient factor formula is as follows:
  • factor represents the gradient attenuation factor
  • radius represents the original radius of the abnormal eye region
  • distance represents the distance from the pixel of the outer bright region to the center of the abnormal eye region
  • fMax represents the maximum value of factor
  • fMin represents the minimum value of factor. That is, the final value of the factor decrement
  • a represents the distance coefficient of the gradation factor.
  • the HSV space is inversely transformed into the YUV space.
  • the brightness factor factor is expressed as follows:
  • the outer bright spot area is inversely transformed from the HSV space to the YUV space.
  • the inner bright spot area is decolored.
  • the brightness reference value of the inner bright spot area is obtained, and the inner bright spot area is decolored by the brightness reference value, and the brightness value of the inner bright spot area is adjusted.
  • the intermediate value of the luminance Y value of all the pixels in the inner bright spot region can be obtained, and the intermediate value of the luminance is used as the luminance reference value of the inner bright spot region.
  • a plurality of pixels in the inner bright spot area may be selected, and the intermediate value of the brightness is selected, and the intermediate value of the brightness is used as the brightness reference value of the inner bright spot area.
  • the average value of the luminance Y value of all the pixels of the region, or the average value of the luminance Y values of the pixels of the inner bright spot region, and the like, are not limited herein.
  • step 317 is performed.
  • the boundary of the abnormal eye region is smoothed by Gaussian blurring.
  • the processed image is output.
  • the abnormal eye region is positioned and processed in a plurality of manners to avoid false detection of the abnormal eye region.
  • the abnormal eye removal method in the embodiment of the present invention can be obtained to a certain extent. Good elimination effect.
  • FIG. 5 is a schematic structural diagram of a graphics processing apparatus 500 according to an embodiment of the present invention.
  • the graphics processing apparatus 500 may include a determining unit 501 and an obtaining unit 502.
  • the determining unit 501 is configured to determine an eyelid region of the input image.
  • the input image is an eyelid rectangular area, it is processed directly on the image.
  • the determination unit 501 estimates the eyelid area in the face frame area.
  • the selected eyelid area is a rectangular area, and of course, the possibility of selecting other shapes of the eyelid area is not excluded.
  • the acquiring unit 502 is configured to acquire a first mask image of the eyelid region, and determine at least one first abnormal region of the eyelid region according to the first mask image.
  • the first mask image may be a golden eye mask image of the eyelid region, or may be a red eye mask image of the eyelid region, and the first mask image is a binary mask image.
  • the determining unit 501 is further configured to determine the at least one first according to the first mask image of the eyelid region The first candidate abnormal eye region in an abnormal region.
  • the first candidate abnormal eye region satisfies all the determination conditions in the abnormal eye region determination condition corresponding to the first mask image, and the abnormal eye region determination condition corresponding to the first mask image includes at least one of the following conditions:
  • the number of pixels of the first candidate abnormal eye region is greater than a first predetermined value
  • the circularity of the first candidate abnormal eye region is greater than a second predetermined value
  • the circularity of the first candidate abnormal eye region is less than a third predetermined value
  • the original candidate radius of the first candidate abnormal eye region is greater than a fourth predetermined value
  • the degree of filling of the first candidate abnormal eye region is greater than a fifth predetermined value
  • the pixel ratio of the first candidate abnormal eye region to the eyelid region More than a sixth predetermined value, wherein the first predetermined value is a positive integer, the second predetermined value is a positive number less than 1, the third predetermined value is a positive number greater than 1, and the fourth predetermined value is a positive number,
  • the fifth predetermined value is a positive number and the
  • the first predetermined value takes a value of 60
  • the second predetermined value takes a value of 0.6
  • the third predetermined value takes a value of 1.6
  • the fourth predetermined value takes a value of 30
  • the fifth predetermined value takes a value of 0.65.
  • the value is 0.08, and so on.
  • the determining unit 501 is further configured to determine that the first candidate abnormal eye region is an abnormal eye region in the eyelid region when a confidence level of the first candidate abnormal eye region is greater than a seventh predetermined value.
  • the confidence of the first candidate abnormal eye region is determined by the filling degree of the first candidate abnormal eye region and the brightness feature of the eyelid region, and the confidence of the first candidate abnormal eye region is used to indicate the first
  • the candidate abnormal eye area is the degree of confidence of the abnormal eye area of the eyelid area.
  • the graphics processing device 500 obtains a candidate abnormal eye region by analyzing a mask image of the eyelid region, and determines a candidate abnormal eye region by using the filling degree of the candidate abnormal eye region and the brightness feature of the eyelid region. Confidence, which enables more accurate positioning of the abnormal eye area of the eye image, providing accurate position information for the treatment of abnormal eyes.
  • the acquiring unit 502 is further configured to: when the abnormal eye region is not found, acquire a second mask image of the eyelid region, and determine at least one second abnormality of the eyelid region according to the second mask image. a region, wherein the second mask image is a golden eye mask image or a red eye mask image, the second mask image is a binary mask image, the second mask image is different from the first mask image;
  • the unit 501 is further configured to determine, according to the abnormal eye region determination condition corresponding to the second mask image, a second candidate abnormal eye region in the at least one second abnormal region, and when the second candidate abnormal eye region is trusted When the degree is greater than the fourteenth predetermined value, determining that the second candidate abnormal eye region is an abnormal eye region of the eyelid region, wherein the second candidate abnormal eye region satisfies an abnormal eye region corresponding to the second mask image And determining, in the determination condition, the abnormal eye region determination condition corresponding to the second mask image includes at least one condition that the number of pixels of the second candidate abnormal eye region is greater than an
  • a mask image fails to locate an abnormal eye region
  • another mask image of the eyelid region is extracted, thereby determining an abnormal eye region, and the accuracy of the abnormal eye region positioning can be improved.
  • the obtaining unit 502 may also perform a morphological operation on the first mask image to remove an isolated point of the first mask image.
  • the confidence s of the first candidate abnormal eye region is represented by a formula (5.1):
  • c represents the degree of filling of the first candidate abnormal eye region
  • gray represents the brightness characteristic of the eyelid region
  • represents a scale factor of the brightness characteristic of the eyelid region in the confidence level
  • the filling degree c of the first candidate abnormal eye region is expressed by the formula (5.2):
  • sp represents the number of pixels of the first candidate abnormal eye region, and radius represents the first candidate Select the original radius of the abnormal eye area;
  • the brightness characteristic gray of the eyelid region is expressed by the formula (5.3):
  • gray4 represents the average brightness of the eyelid region
  • gray2 represents the average brightness of the area within a predetermined pixel range outside the first candidate abnormal eye area
  • gray2 represents a predetermined pixel range outside the first candidate abnormal eye area.
  • the average brightness of the reference point, ⁇ represents the scale factor of the brightness characteristics of the eyelid region in the eyelid region.
  • the acquiring unit 502 is specifically configured to acquire the brightness information of the eyelid region, obtain an edge intensity image of the eyelid region according to the brightness information of the eyelid region, and perform binary clustering on the edge intensity image. To obtain a first mask image of the eyelid region.
  • the acquiring unit 502 is specifically configured to perform Gaussian blur processing on the eyelid region, and the eyelid after the Gaussian blur processing is performed according to the sobel operator.
  • the region performs a soble edge intensity extraction to obtain an edge intensity image of the eyelid region; and a second mask image for performing binary clustering segmentation on the edge intensity image to obtain the eyelid region, the obtaining unit 502 is specifically configured to acquire
  • the edge intensity image of the eyelid region is divided into two thresholds with the largest variance between the two types according to the threshold, and the edge intensity smaller than the first threshold is set as the first threshold, and the edge intensity image of the eyelid region is obtained and divided into two according to the threshold value.
  • the mask image information of the mask image information takes a value of 0, and the edge intensity is greater than or equal to the second threshold. It is 1.
  • the graphics processing apparatus 500 further includes a selection unit 503 and a graphics processing unit 504.
  • the selecting unit 503 is configured to: if the value of the original radius of the abnormal eye region is greater than a value of the minimum empirical radius of the abnormal eye region in the eyelid region multiplied by the first predetermined coefficient, from outside the abnormal eye region Select at least one candidate reference point.
  • the determining unit 501 is further configured to determine, according to the YUV data of some or all of the candidate reference points of the at least one candidate reference point, the parameter of the abnormal eye region.
  • the graphics processing unit 504 is configured to adjust an outer bright spot region of the abnormal eye region according to the YUV reference value of the reference point, according to the abnormality
  • the brightness average value of the inner bright spot area of the eye area adjusts the inner bright spot area of the abnormal eye area, wherein the inner bright spot area is centered on the center point of the abnormal eye area, and the optimal bright spot radius of the abnormal eye area For the radius, the outer bright spot area is an area other than the inner bright spot area in the abnormal eye area.
  • the graphics processing unit 504 is further configured to perform smoothing processing on the abnormal eye region. Specifically, the graphics processing unit 504 may perform smoothing processing on the abnormal eye region by Gaussian blur processing.
  • the first predetermined coefficient is 1.25.
  • maxR represents the estimated maximum value of the optimal bright spot radius of the abnormal eye region
  • minR represents the minimum value of the estimated optimal bright spot radius of the abnormal eye region
  • eyedistance represents the center of the two eyes in the input image. distance.
  • the determining unit 501 is specifically implemented to: acquire the at least one candidate, by determining a YUV reference value of the reference point of the abnormal eye region according to the YUV data of the part or all of the at least one candidate reference point. An average value of YUV data of some or all of the candidate reference points in the reference point; if the brightness value corresponding to the average value is greater than a predetermined threshold, determining a predetermined reference value as a reference value of the reference point of the abnormal eye region, otherwise This average value serves as a reference value for the reference point of the abnormal eye region.
  • the acquiring unit 502 is specifically configured to: obtain RGB information of the eyelid region; perform binary segmentation on the eyelid region according to the RGB information of the eyelid region to obtain a first mask of the eyelid region. image.
  • the acquiring unit 502 is specifically implemented as: corresponding to the red pixel in the eyelid region.
  • the mask image information is set to 1, and the mask image information corresponding to the pixels other than the red pixels in the eyelid region is set to 0, thereby forming the first mask image.
  • the graphics processing apparatus 500 further includes a selection unit 503 and a graphics processing unit 504, wherein the selection unit 503 is configured to select at least one candidate reference point from outside the abnormal eye region.
  • the determining unit 501 is further configured to determine a YUV reference value of the reference point of the abnormal eye region according to YUV data of some or all of the at least one candidate reference point. If the YUV reference value of the reference point meets the predetermined condition, the graphics processing unit 504 adjusts the outer bright spot region of the abnormal eye region according to the YUV reference value of the reference point, according to the brightness of the inner bright spot region of the abnormal eye region.
  • the average value adjusts the inner bright spot area of the abnormal eye area, or if the YUV reference value of the reference point does not meet the predetermined condition, the graphic processing unit 504 converts the outer bright spot area of the abnormal eye area from the YUV space to the HSV space. And lowering the H value of the pixel of the outer bright spot area in the HSV space according to the gradation factor, and then adjusting the inner bright spot area of the abnormal eye area according to the brightness average value of the inner bright spot area of the abnormal eye area.
  • the gradation factor decreases as the pixel of the outer bright spot region decreases from the center of the eye region, wherein the inner bright spot region is centered on a center point of the abnormal eye region, and the abnormal eye region is the most
  • the radius of the bright spot is a radius
  • the outer bright spot area is an area other than the inner bright spot area in the abnormal eye area.
  • the graphics processing unit 504 is further configured to perform smoothing processing on the abnormal eye region.
  • the predetermined condition is that the YUV reference value of the reference point corresponds to a red pixel, and the YUV luminance value of the reference point is multiplied by a second predetermined coefficient smaller than an intermediate luminance value of the abnormal eye region, and the abnormal eye region is The average brightness value is less than the predetermined brightness value.
  • the graphics processing unit 504 may perform smoothing processing on the abnormal eye region by Gaussian blurring processing.
  • the second predetermined coefficient takes a value of 0.9
  • the predetermined brightness value takes a value of 115.
  • maxR represents the estimated maximum value of the optimal bright spot radius of the abnormal eye region
  • minR represents the minimum value of the estimated optimal bright spot radius of the abnormal eye region
  • eyedistance represents the distance between the centers of the two eyes in the image. .
  • the determining unit 501 is specifically implemented to: acquire the at least one candidate, by determining a YUV reference value of the reference point of the abnormal eye region according to the YUV data of the part or all of the at least one candidate reference point. An average value of YUV data of some or all of the candidate reference points in the reference point; if the brightness value corresponding to the average value is greater than a predetermined threshold, determining a predetermined reference value as a reference value of the reference point of the abnormal eye region, otherwise This average value serves as a reference value for the reference point of the abnormal eye region.
  • the RGB of the red pixel satisfies the following condition: max(r, g, b)>th1, and max(r, g, b)-g>th2, and max(r, g, b) / g > th3, where r represents the red component of the three color components of RGB, g represents the green component of the three color components of RGB, and b represents the blue component of the three color components of RGB, Th1, th2, and th3 respectively represent three predetermined values of the red pixel.
  • RGB of the red pixel satisfies the following condition: r 2 /(g 2 +b 2 +th4)>th5, and r>th6, where r represents three colors of RGB
  • the red component in the component g represents the green component of the three color components of RGB
  • b represents the blue component of the three color components of RGB
  • th4, th5, and th6 respectively represent three predetermined values of the red pixel determination.
  • the manner of extracting the first mask image is also applicable to extracting the second mask image, which is implemented by the present invention.
  • the examples are not described here.
  • the graphics processing device 500 can also perform the method of FIG. 1 and have the functions of the graphics processing device in the embodiments shown in FIG. 1 and FIG. 3 .
  • FIG. 1 and FIG. 3 For specific implementation, reference may be made to the specific embodiments shown in FIG. 1 and FIG. 3 , and the implementation of the present invention is implemented. The examples are not described here.
  • FIG. 6 is a schematic structural diagram of a graphics processing apparatus 600 according to an embodiment of the present invention.
  • the graphics processing apparatus 600 can include an IO interface 601, a processor 602, and a memory 603.
  • the IO interface 601, the processor 602, and the memory 603 are interconnected by a bus 604 system.
  • the bus 604 can be an ISA bus, a PCI bus, or an EISA bus.
  • the bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one double-headed arrow is shown in Figure 6, but it does not mean that there is only one bus or one type of bus.
  • the memory 603 is configured to store a program.
  • the program can include program code, the program code including computer operating instructions.
  • Memory 603 can include read only memory and random access memory and provides instructions and data to processor 602.
  • the memory 603 may include a high speed RAM memory and may also include a non-volatile memory such as at least one disk memory.
  • the IO interface 601 is configured to receive an input image and output the processed image output.
  • the processor 602 is configured to execute a program stored in the memory 603, to determine an eyelid region of the input image received by the IO interface 601, obtain a first mask image of the eyelid region, and determine at least the eyelid region according to the first mask image. a first abnormal region, the first candidate abnormal eye region in the at least one first abnormal region is determined according to the first mask image of the eyelid region, and the confidence in the first candidate abnormal eye region is greater than the seventh When the value is predetermined, the first candidate abnormal eye region is determined to be an abnormal eye region in the eyelid region.
  • the first candidate abnormal eye region satisfies all the determination conditions in the abnormal eye region determination condition corresponding to the first mask image, and the abnormal eye region determination condition corresponding to the first mask image includes at least one of the following conditions
  • the number of pixels of the first candidate abnormal eye region is greater than a first predetermined value
  • the circularity of the first candidate abnormal eye region is greater than a second predetermined value and the first candidate abnormal eye
  • the circularity of the partial region is smaller than a third predetermined value
  • the original radius of the first candidate abnormal eye region is greater than a fourth predetermined value
  • the degree of filling of the first candidate abnormal eye region is greater than a fifth predetermined value
  • the pixel ratio of the eye region to the eyelid region is greater than a sixth predetermined value, wherein the first predetermined value is a positive integer, the second predetermined value is a positive number less than 1, and the third predetermined value is a positive number greater than one,
  • the fourth predetermined value is a positive number
  • the fifth predetermined value
  • the first predetermined value takes a value of 60
  • the second predetermined value takes a value of 0.6
  • the third predetermined value takes a value of 1.6
  • the fourth predetermined value takes a value of 30
  • the fifth predetermined value takes a value of 0.65.
  • the value is 0.08, and so on.
  • the confidence of the first candidate abnormal eye region is determined by the degree of filling of the first candidate abnormal eye region and the brightness feature of the eyelid region, and the confidence of the first candidate abnormal eye region is used to represent the first candidate.
  • the abnormal eye area is the degree of confidence of the abnormal eye area of the eyelid area.
  • Processor 602 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the foregoing method may be completed by an integrated logic circuit of hardware in the processor 602 or an instruction in a form of software.
  • the processor 602 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP processor, etc.), or a digital signal processor (DSP), an application specific integrated circuit. (ASIC), off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the steps of the method disclosed in the embodiments of the present invention may be directly implemented by the hardware decoding processor, or may be performed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a conventional storage medium such as random access memory, flash memory, read only memory, programmable read only memory or electrically erasable programmable memory, registers, and the like.
  • the storage medium is located in the memory 603, and the processor 602 reads the information in the memory 603 and completes the steps of the above method in combination with its hardware.
  • the graphics processing device 600 obtains the candidate abnormal eye region by analyzing the mask image of the eyelid region, and determines the candidate abnormal eye region by the filling degree of the candidate abnormal eye region and the brightness feature of the eyelid region. Confidence, which enables more accurate positioning of the abnormal eye area of the eye image, providing accurate position information for the treatment of abnormal eyes.
  • the processor 602 is further configured to: when the abnormal eye region is not found, acquire a second mask image of the eyelid region, and determine at least one second abnormality of the eyelid region according to the second mask image. a region, wherein the second mask image is a golden eye mask image or a red eye mask image, the second mask image is a binary mask image, the second mask image is different from the first mask image;
  • the controller 602 is further configured to determine, according to the abnormal eye region determination condition corresponding to the second mask image, a second candidate abnormal eye region in the at least one second abnormal region, and when the second candidate abnormal eye region is trusted When the degree is greater than the fourteenth predetermined value, determining that the second candidate abnormal eye region is an abnormal eye region of the eyelid region, wherein the second candidate abnormal eye region satisfies an abnormal eye region corresponding to the second mask image Judging all the judgment conditions in the condition, the abnormal eye region determination condition corresponding to the second mask image includes at least one condition that the number of pixels of the second candidate abnormal eye region is greater than the eighth
  • a mask image fails to locate an abnormal eye region
  • another mask image of the eye region is extracted, thereby determining an abnormal eye region, and the accuracy of the abnormal eye region positioning can be improved.
  • the processor 602 may also perform a morphological operation on the first mask image to remove the first An isolated point of a mask image.
  • the confidence s of the first candidate abnormal eye region is represented by a formula (6.1):
  • c represents the degree of filling of the first candidate abnormal eye region
  • gray represents the brightness characteristic of the eyelid region
  • represents a scale factor of the brightness characteristic of the eyelid region in the confidence level
  • the filling degree c of the first candidate abnormal eye region is expressed by a formula (6.2):
  • sp represents the number of pixels of the first candidate abnormal eye region, and radius represents the original radius of the first candidate abnormal eye region;
  • the brightness characteristic gray of the eyelid region is expressed by the formula (6.3):
  • gray4 represents the average brightness of the eyelid region
  • gray2 represents the average brightness of the area within a predetermined pixel range outside the first candidate abnormal eye area
  • gray2 represents a predetermined pixel range outside the first candidate abnormal eye area.
  • the average brightness of the reference point, ⁇ represents the scale factor of the brightness characteristics of the eyelid region in the eyelid region.
  • the processor 602 is specifically configured to acquire brightness information of the eyelid region; and obtain an edge of the eyelid region according to the brightness information of the eyelid region.
  • An intensity image; the edge intensity image is subjected to binary clustering to obtain a first mask image of the eyelid region.
  • the processor 602 is configured to perform Gaussian blur processing on the eyelid region according to the brightness information of the eyelid region, and perform Gaussian blurring on the eyelid region according to the Sobel operator.
  • the region performs the soble edge intensity extraction to obtain the edge intensity image of the eyelid region; the processor 602 is specifically configured to acquire the edge mask image for performing the binary clustering segmentation on the edge intensity image to obtain the first mask image
  • the edge intensity image of the eyelid region is divided into two thresholds with the largest variance between the two types according to the threshold, and the edge intensity smaller than the first threshold is set as the first threshold, and the edge intensity image of the eyelid region is obtained and divided into two according to the threshold value.
  • the value of the edge intensity image of the eyelid region is binarized to obtain a first mask image of the eyelid region, wherein the mask image information of the pixel whose edge intensity is less than the second threshold value is 0, and the edge intensity is greater than or equal to the first
  • the mask image information of the pixels of the two thresholds takes a value of 1.
  • the processor 602 is further configured to: if the value of the original radius of the abnormal eye region is greater than a value of the minimum empirical radius of the abnormal eye region in the eyelid region multiplied by the first predetermined coefficient, from the abnormal eye region At least one candidate reference point is selected in addition, and a YUV reference value of the reference point of the abnormal eye region is determined according to YUV data of some or all of the candidate reference points of the at least one candidate reference point. If the pixel corresponding to the YUV reference value of the reference point is not a red pixel, the processor 602 is further configured to adjust an outer bright spot area of the abnormal eye area according to the YUV reference value of the reference point, according to the inside of the abnormal eye area.
  • the average value of the brightness of the highlight area adjusts the inner bright spot area of the abnormal eye area, and smoothes the abnormal eye area.
  • the inner bright spot area is centered on the center point of the abnormal eye area, and the optimal bright spot radius of the abnormal eye area is a radius, and the outer bright spot area is an area other than the inner bright spot area in the abnormal eye area.
  • the processor 602 may perform smoothing processing on the abnormal eye region by Gaussian blurring processing.
  • the first predetermined coefficient is 1.25.
  • the processor 602 may be implemented to: acquire the at least one candidate YUV data for some or all of the candidate reference points in the reference point An average value; if the brightness value corresponding to the average value is greater than a predetermined threshold value, determining a predetermined reference value as a reference value of a reference point of the abnormal eye region, otherwise using the average value as a reference point of the abnormal eye region Reference.
  • the processor 602 is specifically configured to: obtain RGB information of the eyelid region; and select the eyelid region according to the RGB information of the eyelid region. Binary segmentation is performed to obtain a first mask image of the eyelid region.
  • the processor 602 is specifically implemented to: corresponding to the red pixel in the eyelid region, by performing binary segmentation on the eyelid region according to the RGB information of the eyelid region to obtain the first mask image of the eyelid region.
  • the mask image information is set to 1, and the mask image information corresponding to the pixels other than the red pixels in the eyelid region is set to 0, thereby forming the first mask image.
  • the processor 602 is further configured to select at least one candidate reference point from outside the abnormal eye region, and determine a reference point of the abnormal eye region according to YUV data of some or all of the candidate reference points of the at least one candidate reference point. YUV reference value.
  • the processor 602 is further configured to adjust an outer bright spot area of the abnormal eye area according to the YUV reference value of the reference point, and according to the inner bright point of the abnormal eye area The average value of the brightness of the area adjusts the inner bright spot area of the abnormal eye area; or if the YUV reference value of the reference point does not meet the predetermined condition, the processor 602 is further configured to use the outer bright spot area of the abnormal eye area from the YUV The space is converted into an HSV space, and the H value of the pixel of the outer bright spot region in the HSV space is lowered according to the gradation factor, and then the inner bright spot of the abnormal eye region is adjusted according to the brightness average value of the inner bright spot region of the abnormal eye region The area is smoothed by the abnormal eye area.
  • the gradation factor decreases as the pixel of the outer bright spot region decreases from the center of the eye region, wherein the inner bright spot region is centered on a center point of the abnormal eye region, and the abnormal eye region is the most
  • the radius of the bright spot is a radius
  • the outer bright spot area is an area other than the inner bright spot area in the abnormal eye area.
  • the predetermined condition is that the YUV reference value of the reference point corresponds to a red pixel, and the YUV luminance value of the reference point is multiplied by a second predetermined coefficient smaller than an intermediate luminance value of the abnormal eye region, and the abnormal eye region is The average brightness value is less than the predetermined brightness value.
  • the processor 602 is available. Gaussian blurring smoothes the abnormal eye region.
  • the second predetermined coefficient takes a value of 0.9
  • the predetermined brightness value takes a value of 115.
  • the processor 602 may be implemented to: acquire the at least one candidate An average value of YUV data of some or all of the candidate reference points in the reference point; if the brightness value corresponding to the average value is greater than a predetermined threshold, determining a predetermined reference value as a reference value of the reference point of the abnormal eye region, otherwise This average value serves as a reference value for the reference point of the abnormal eye region.
  • the RGB of the red pixel satisfies the following condition: max(r, g, b)>th1, and max(r, g, b)-g>th2, and max(r, g, b) / g > th3, where r represents the red component of the three color components of RGB, g represents the green component of the three color components of RGB, and b represents the blue component of the three color components of RGB, Th1, th2, and th3 respectively represent three predetermined values of the red pixel.
  • RGB of the red pixel satisfies the following condition: r 2 /(g 2 +b 2 +th4)>th5, and r>th6, where r represents three colors of RGB
  • the red component in the component g represents the green component of the three color components of RGB
  • b represents the blue component of the three color components of RGB
  • th4, th5, and th6 respectively represent three predetermined values of the red pixel determination.
  • the manner of extracting the first mask image is also applicable to the extraction of the second mask image, which is not described herein again in the embodiment of the present invention.
  • the graphics processing device 600 can also perform the method of FIG. 1 and have the functions of the graphics processing device in the embodiment shown in FIG. 1 and FIG. 3 .
  • FIG. 1 and FIG. 3 For specific implementation, reference may be made to the specific embodiment shown in FIG. 1 and FIG. 3 . The examples are not described here.
  • the graphics processing device mentioned in the embodiment of the present invention may be a terminal device, such as a mobile phone, a tablet computer, or the like. It can also be portable, pocket-sized, hand-held, computer-integrated or in-vehicle terminal equipment.
  • the disclosed systems, devices, and methods may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be indirect coupling through some interface, device or unit.
  • a communication connection which may be in electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the functions may be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a standalone product.
  • the technical solution of the present invention which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including
  • the instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Ophthalmology & Optometry (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

本发明实施例提供了一种眼部图像处理方法和装置,该方法包括:确定图像的眼眶区域;获取该眼眶区域的第一掩膜图像;根据该第一掩膜图像确定该眼眶区域的至少一个第一异常区域;根据该第一掩膜图像对应的异常眼部区域判断条件确定该至少一个第一异常区域中的第一候选异常眼部区域,其中该第一候选异常眼部区域满足该第一掩膜图像对应的异常眼部区域判断条件中的所有判断条件;当该第一候选异常眼部区域的置信度大于第七预定值时确定该第一候选异常眼部区域为该眼眶区域的异常眼部区域。本发明实施例的方法和装置能够更准确地定位眼部图像的异常眼部区域,为异常眼部的处理提供了准确的位置信息。

Description

眼部图像处理方法和装置
本申请要求于2013年11月12日提交中国专利局,申请号为201310559822.9、发明名称为“眼部图像处理方法和装置”的中国专利申请,其全部内容通过引用结合在本申请中。
技术领域
本发明实施例涉及图像处理领域,更具体地,涉及一种眼部图像处理方法和装置。
背景技术
在光线较暗的环境中,人眼瞳孔会放大让更多的光线通过。如果拍摄时打开了闪光灯,眼底视网膜上毛细血管就会被拍摄下来,根据不同的镜头和拍摄场景,拍摄出的照片会出现不同的颜色(常见如红色、金色、白色等),称为红眼/金眼现象。
对于常见的手机、数码相机,由于“镜头”与“闪光灯”常常靠的很近,也就更容易产生“红眼现象”。一般通过闪光灯的预闪来抑制红眼,缺陷是不利于抓拍,并且消除效果有限。
由于红眼/金眼大多在低光照场景下拍摄,拍摄的红眼/金眼情况千差万别,例如由于化妆等原因会使得眼皮呈现红色,戴眼镜等原因会使得眼镜片出现金色反光,眼白呈现类金眼等情况,利用简单阈值排除方法不能彻底排除非红眼/金眼区域,还有可能造成误消除。
发明内容
本发明实施例提供一种眼部图像处理方法和装置,能够更准确地定位眼部图像的异常眼部区域。
第一方面,提供了一种眼部图像处理方法,该方法包括:确定输入图像的眼眶区域;获取该眼眶区域的第一掩膜图像,其中,该第一掩膜图像为金 眼掩膜图像或红眼掩膜图像,该第一掩膜图像为二值掩膜图像;根据该第一掩膜图像确定该眼眶区域的至少一个第一异常区域;根据该第一掩膜图像对应的异常眼部区域判断条件确定该至少一个第一异常区域中的第一候选异常眼部区域,其中该第一候选异常眼部区域满足该第一掩膜图像对应的异常眼部区域判断条件中的所有判断条件,该第一掩膜图像对应的异常眼部区域判断条件包括以下至少一个条件:该第一候选异常眼部区域的像素个数大于第一预定值,该第一候选异常眼部区域的圆度大于第二预定值且该第一候选异常眼部区域的圆度小于第三预定值,该第一候选异常眼部区域的原始半径大于第四预定值,该第一候选异常眼部区域的填充度大于第五预定值,该第一候选异常眼部区域与该眼眶区域的像素比大于第六预定值,其中第一预定值为一个正整数,第二预定值为一个小于1的正数,第三预定值为一个大于1的正数,该第四预定值为一个正数,该第五预定值为一个正数,该第六预定值为一个正数;当该第一候选异常眼部区域的置信度大于第七预定值时,确定该第一候选异常眼部区域为该眼眶区域中的异常眼部区域,该第一候选异常眼部区域的置信度由该第一候选异常眼部区域的填充度和该眼眶区域的亮度特征确定。
结合第一方面,在第一种可能的实现方式中,该方法还包括:当该异常眼部区域未被找到时,获取该眼眶区域的第二掩膜图像,该第二掩膜图像为金眼掩膜图像或红眼掩膜图像,该第二掩膜图像为二值掩膜图像,该第二掩膜图像不同于该第一掩膜图像;根据该第二掩膜图像确定该眼眶区域的至少一个第二异常区域;根据该第二掩膜图像对应的异常眼部区域判断条件确定该至少一个第二异常区域中的第二候选异常眼部区域,其中该第二候选异常眼部区域满足该第二掩膜图像对应的异常眼部区域判断条件中的所有判断条件,该第二掩膜图像对应的异常眼部区域判断条件包括以下至少一个条件:该第二候选异常眼部区域的像素个数大于第八预定值,该第二候选异常眼部区域的圆度大于第九预定值且该第二候选异常眼部区域的圆度小于第十预定 值,该第二候选异常眼部区域的原始半径大于第十一预定值,该第二候选异常眼部区域的填充度大于第十二预定值,该第二候选异常眼部区域与该眼眶区域的像素比大于第十三预定值,其中第八预定值为一个正整数,第九预定值为一个小于1的正数,第十预定值为一个大于1的正数,该第十一预定值为一个正数,该第十二预定值为一个正数,该第十三预定值为一个正数;当该第二候选异常眼部区域的置信度大于第十四预定值时,确定该第二候选异常眼部区域为该眼眶区域中的异常眼部区域。
结合第一方面或第一方面的第一种可能的实现方式,在第二种可能的实现方式中,具体实现为:该第一候选异常眼部区域的置信度s用以下公式确定:s=c+β*gray,其中,β表示该眼眶区域的亮度特征在该置信度中的比例因子,gray表示该眼眶区域的亮度特征,gray=(α*gray4-gray2)/(α*gray4),c表示该第一候选异常眼部区域的填充度,c=sp/(π*radius*radius),其中,gray4表示该眼眶区域的平均亮度,α表示该眼眶区域的平均亮度在该眼眶区域的亮度特征的比例因子,gray2表示该第一候选异常眼部区域以外预定个像素范围以内的区域的平均亮度,或者gray2表示该第一候选异常眼部区域以外预定个像素范围以内的若干个参考点的平均亮度,sp表示该第一候选异常眼部区域的像素个数,radius表示该第一候选异常眼部区域的原始半径。
结合第一方面或第一方面的第一种可能的实现方式或第一方面的第二种可能的实现方式,在第三种可能的实现方式中,获取该眼眶区域的第一掩膜图像具体实现为:获取该眼眶区域的亮度信息;根据该眼眶区域的亮度信息获取该眼眶区域的边缘强度图像;对该边缘强度图像进行二值聚类分割以获取该眼眶区域的第一掩膜图像。
结合第一方面的第三种可能的实现方式,在第四种可能的实现方式中,根据该眼眶区域的亮度信息获取该眼眶区域的边缘强度图像具体实现为,对该眼眶区域进行高斯模糊处理,根据同性sobel算子对该进行高斯模糊处理后的眼眶区域进行soble边缘强度提取以获取该眼眶区域的边缘强度图像;对该 边缘强度图像进行二值聚类分割以获取该眼眶区域的第一掩膜图像具体实现为:获取使得该眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第一阈值,将小于第一阈值的边缘强度设为第一阈值,并获取使得该眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第二阈值,并根据该第二阈值对该眼眶区域的边缘强度图像进行二值化以获取该眼眶区域的第一掩膜图像,其中边缘强度小于第二阈值的像素的掩膜图像信息取值为0,边缘强度大于或等于第二阈值的像素的掩膜图像信息取值为1。
结合第一方面的第三种可能的实现方式或第一方面的第四种可能的实现方式,在第五种可能的实现方式中,该方法还包括:如果该异常眼部区域的原始半径的值大于该眼眶区域中异常眼部区域的最小经验半径乘以第一预定系数后的值,则从该异常眼部区域之外选择至少一个候选参考点;根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值;如果该参考点的YUV参考值对应的像素不是红色像素,则根据该参考点的YUV参考值调整该异常眼部区域的外亮点区域,根据该异常眼部区域的内亮点区域的亮度平均值调整该异常眼部区域的内亮点区域,其中该内亮点区域以该异常眼部区域的中心点为圆心,以该异常眼部区域的最佳亮点半径为半径,该外亮点区域为该异常眼部区域中该内亮点区域以外的区域;对该异常眼部区域进行平滑处理。
结合第一方面的第五种可能的实现方式,在第六种可能的实现方式中,具体实现为:该眼眶区域中异常眼部区域的最小经验半径由以下公式minRad=width/50+2确定,其中,minRad表示该眼眶区域中异常眼部区域的最小经验半径,width表示该眼眶区域的宽度。
结合第一方面的第五种可能的实现方式或第一方面的第六种可能的实现方式,在第七种可能的实现方式中,具体实现为:该第一预定系数取值为1.25。
结合第一方面或第一方面的第一种可能的实现方式或第一方面的第二种可能的实现方式,在第八种可能的实现方式中,获取该眼眶区域的第一掩膜 图像具体实现为:获取该眼眶区域的RGB信息;根据该眼眶区域的RGB信息对该眼眶区域进行二值分割以获取该眼眶区域的第一掩膜图像。
结合一方面的第八种可能的实现方式,在第九种可能的实现方式中,根据该眼眶区域的RGB信息对该眼眶区域进行二值分割以获取该眼眶区域的第一掩膜图像具体实现为:将该眼眶区域中的红色像素对应的掩膜图像信息置为1,该眼眶区域中红色像素以外的像素对应的掩膜图像信息置为0,从而形成该第一掩膜图像。
结合第一方面的第八种可能的实现方式或第一方面的第九种可能的实现方式,在第十种可能的实现方式中,该方法还包括:从该异常眼部区域以外选择至少一个候选参考点;根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值;如果该参考点的YUV参考值符合预定的条件,则根据该参考点的YUV参考值调整该异常眼部区域的外亮点区域,根据该异常眼部区域的内亮点区域的亮度平均值调整该异常眼部区域的内亮点区域,或者如果该参考点的YUV参考值不符合预定的条件,则将该异常眼部区域的外亮点区域从YUV空间转换为HSV空间,并根据渐变因子调低该外亮点区域的像素在HSV空间的亮度H值,然后根据该异常眼部区域的内亮点区域像素的亮度平均值调整该异常眼部区域的内亮点区域,该渐变因子随着该外亮点区域的像素与该异常眼部区域中心的距离的减小而减小;对该异常眼部区域进行平滑处理;其中,该内亮点区域以该异常眼部区域的中心点为圆心,以该异常眼部区域的最佳亮点半径为半径,该外亮点区域为该异常眼部区域中该内亮点区域以外的区域,该预定的条件为:该参考点的YUV参考值对应的像素是红色像素,并且该参考点的YUV亮度值乘以第二预定系数后的值小于该异常眼部区域的中间亮度值,并且该异常眼部区域的亮度平均值小于预定亮度值。
结合第一方面的第十种可能的实现方式,在第十一种可能的实现方式中,具体实现为:该第二预定系数取值为0.9,该预定亮度值取值为115。
结合第一方面的第十种可能的实现方式,在第十二种可能的实现方式中,具体实现为该渐变因子factor用以下公式确定:factor=(fMax-fMin)*(distance-a*radius)/(radius-a*radius)+fMin,其中radius表示该异常眼部区域的原始半径,distance表示该外亮点区域的像素到该异常眼部区域中心的距离,fMax表示factor的最大值,fMin表示factor的最小值,a表示该渐变因子的距离系数。
结合第一方面的第十二种可能的实现方式,在第十三种可能的实现方式中,具体实现为,该渐变因子公式具体为factor=(0.4-0.1)*(distance–0.25*radius)/(radius–0.25*radius)+0.1,其中,fMax取值为0.4,fMin取值为0.1,a取值为0.25。
结合第一方面的第五种可能的实现方式或第一方面的第十种可能的实现方式,在第十四种可能的实现方式中,具体实现为,异常眼部区域的最佳亮点半径optR用以下公式确定:optR=(maxR-minR)*(eyedistance-100)/400+minR,其中,maxR表示估算出的该异常眼部区域的最佳亮点半径的最大值,minR表示估算出的该异常眼部区域的最佳亮点半径的最小值,eyedistance表示该输入图像中两个眼睛中心的距离。
结合第一方面的第五种可能的实现方式或第一方面的第十种可能的实现方式,在第十五种可能的实现方式中,根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值具体实现为:获取该至少一个候选参考点中部分或全部候选参考点的YUV数据的平均值;如果该平均值对应的亮度值大于预定的阈值,则确定预定的参考值作为该异常眼部区域的参考点的参考值,否则以该平均值作为该异常眼部区域的参考点的参考值。
结合第一方面的第九种可能的实现方式,在第十六种可能的实现方式中,具体实现为,该红色像素的RGB满足以下条件:max(r,g,b)>th1,且max(r,g,b)-g>th2,且max(r,g,b)/g>th3,其中,r表示RGB的 三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th1、th2、th3分别表示红色像素的3个预定值;或者该红色像素的RGB满足以下条件:r2/(g2+b2+th4)>th5,且r>th6,其中,r表示RGB的三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th4、th5、th6分别表示红色像素判定的3个预定值。
第二方面,提供了一种图形处理装置,该装置包括:确定单元,用于确定输入图像的眼眶区域;获取单元,用于获取该眼眶区域的第一掩膜图像,并根据该第一掩膜图像确定该眼眶区域的至少一个第一异常区域,其中该第一掩膜图像为金眼掩膜图像或红眼掩膜图像,该第一掩膜图像为二值掩膜图像;该确定单元还用于根据该第一掩膜图像对应的异常眼部区域判断条件确定该至少一个第一异常区域中的第一候选异常眼部区域,其中该第一候选异常眼部区域满足该第一掩膜图像对应的异常眼部区域判断条件中的所有判断条件,该第一掩膜图像对应的异常眼部区域判断条件包括以下至少一个条件:该第一候选异常眼部区域的像素个数大于第一预定值,该第一候选异常眼部区域的圆度大于第二预定值且该第一候选异常眼部区域的圆度小于第三预定值,该第一候选异常眼部区域的原始半径大于第四预定值,该第一候选异常眼部区域的填充度大于第五预定值,该第一候选异常眼部区域与该眼眶区域的像素比大于第六预定值,其中第一预定值为一个正整数,第二预定值为一个小于1的正数,第三预定值为一个大于1的正数,该第四预定值为一个正数,该第五预定值为一个正数,该第六预定值为一个正数;该确定单元还用于当该第一候选异常眼部区域的置信度大于第七预定值时确定该第一候选异常眼部区域为该眼眶区域中的异常眼部区域,该第一候选异常眼部区域的置信度由该第一候选异常眼部区域的填充度和该眼眶区域的亮度特征确定。
结合第二方面,在第一种可能的实现方式中,具体实现为:该获取单元 还用于当该异常眼部区域未被找到时,获取该眼眶区域的第二掩膜图像,并根据该第二掩膜图像确定该眼眶区域的至少一个第二异常区域,其中该第二掩膜图像为金眼掩膜图像或红眼掩膜图像,该第二掩膜图像为二值掩膜图像,该第二掩膜图像不同于该第一掩膜图像;该确定单元还用于根据该第二掩膜对应的异常眼部区域判断条件确定该至少一个第二异常区域中的第二候选异常眼部区域,其中该第二候选异常眼部区域满足该第二掩膜图像对应的异常眼部区域判断条件中的所有判断条件,该第二掩膜图像对应的异常眼部区域判断条件包括以下至少一个条件:该第二候选异常眼部区域的像素个数大于第八预定值,该第二候选异常眼部区域的圆度大于第九预定值且该第二候选异常眼部区域的圆度小于第十预定值,该第二候选异常眼部区域的原始半径大于第十一预定值,该第二候选异常眼部区域的填充度大于第十二预定值,该第二候选异常眼部区域与该眼眶区域的像素比大于第十三预定值,其中第八预定值为一个正整数,第九预定值为一个小于1的正数,第十预定值为一个大于1的正数,该第十一预定值为一个正数,该第十二预定值为一个正数,该第十三预定值为一个正数;该确定单元还用于当该第二候选异常眼部区域的置信度大于第十四预定值时确定该第二候选异常眼部区域为该眼眶区域中的异常眼部区域。
结合第二方面或第二方面的第一种可能的实现方式,在第二种可能的实现方式中,具体实现为:该第一候选异常眼部区域的置信度s用以下公式确定:s=c+β*gray,其中,β表示该眼眶区域的亮度特征在该置信度中的比例因子,gray表示该眼眶区域的亮度特征,gray=(α*gray4-gray2)/(α*gray4),c表示该第一候选异常眼部区域的填充度,c=sp/(π*radius*radius),其中,gray4表示该眼眶区域的平均亮度,α表示该眼眶区域的平均亮度在该眼眶区域的亮度特征的比例因子,gray2表示该第一候选异常眼部区域以外预定个像素范围以内的区域的平均亮度,或者gray2表示该第一候选异常眼部区域以外预定个像素范围以内的若干个参考点的平均亮度,sp表示该第一候选异常眼部区域 的像素个数,radius表示该第一候选异常眼部区域的原始半径。
结合第二方面或第二方面的第一种可能的实现方式或第二方面的第二种可能的实现方式,在第三种可能的实现方式中,具体实现为:该获取单元具体用于获取该眼眶区域的亮度信息;根据该眼眶区域的亮度信息获取该眼眶区域的边缘强度图像;对该边缘强度图像进行二值聚类分割以获取该眼眶区域的第一掩膜图像。
结合第二方面的第三种可能的实现方式,在第四种可能的实现方式中,具体实现为:在用于根据该眼眶区域的亮度信息获取该眼眶区域的边缘强度图像,该获取单元具体用于对该眼眶区域进行高斯模糊处理,根据同性sobel算子对该进行高斯模糊处理后的眼眶区域进行soble边缘强度提取以获取该眼眶区域的边缘强度图像;在用于对该边缘强度图像进行二值聚类分割以获取该眼眶区域的第一掩膜图像,该获取单元具体用于获取使得该眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第一阈值,将小于第一阈值的边缘强度设为第一阈值,并获取使得该眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第二阈值,并根据该第二阈值对该眼眶区域的边缘强度图像进行二值化以获取该眼眶区域的第一掩膜图像,其中边缘强度小于第二阈值的像素的掩膜图像信息取值为0,边缘强度大于或等于第二阈值的像素的掩膜图像信息取值为1。
结合第二方面的第三种可能的实现方式或第二方面的第四种可能的实现方式,在第五种可能的实现方式中,该装置还包括选择单元和图形处理单元,其中,该选择单元用于如果该异常眼部区域的原始半径的值大于该眼眶区域中眼部区域的最小经验半径乘以第一预定系数的值,则从该异常眼部区域之外选择至少一个候选参考点;该确定单元还用于根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值;该图形处理单元用于如果该参考点的YUV参考值对应的像素不是红色像素,则根据该参考点的YUV参考值调整该异常眼部区域的外亮点区域, 根据该异常眼部区域的内亮点区域的亮度平均值调整该异常眼部区域的内亮点区域,其中该内亮点区域以该异常眼部区域的中心点为圆心,以该异常眼部区域的最佳亮点半径为半径,该外亮点区域为该异常眼部区域中该内亮点区域以外的区域;该图形处理单元还用于对该异常眼部区域进行平滑处理。
结合第二方面的第五种可能的实现方式,在第六种可能的实现方式中,具体实现为:该眼眶区域中异常眼部区域的最小经验半径由以下公式minRad=width/50+2确定,其中,minRad表示该眼眶区域中异常眼部区域的最小经验半径,width表示该眼眶区域的宽度。
结合第二方面的第五种可能的实现方式或第二方面的第六种可能的实现方式,在第七种可能的实现方式中,具体实现为:该第一预定系数取值为1.25。
结合第二方面或第二方面的第一种可能的实现方式或第二方面的第二种可能的实现方式,在第八种可能的实现方式中,具体实现为:该获取单元具体用于获取该眼眶区域的RGB信息;根据该眼眶区域的RGB信息对该眼眶区域进行二值分割以获取该眼眶区域的第一掩膜图像。
结合一方面的第八种可能的实现方式,在第九种可能的实现方式中,具体实现为:在用于根据该眼眶区域的RGB信息对该眼眶区域进行二值分割以获取该眼眶区域的第一掩膜图像,该获取单元具体用于将该眼眶区域中的红色像素对应的掩膜图像信息置为1,该眼眶区域中红色像素以外的像素对应的掩膜图像信息置为0,从而形成该第一掩膜图像。
结合第二方面的第八种可能的实现方式或第二方面的第九种可能的实现方式,在第十种可能的实现方式中,该装置还包括选择单元和图形处理单元,其中,该选择单元用于从该异常眼部区域以外选择至少一个候选参考点;该确定单元还用于根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值;该图形处理单元用于如果该参考点的YUV参考值符合预定的条件,则根据该参考点的YUV参考值调整该异常眼部区域的外亮点区域,根据该异常眼部区域的内亮点区域的亮度 平均值调整该异常眼部区域的内亮点区域,或者该图形处理单元用于如果该参考点的YUV参考值不符合预定的条件,则将该异常眼部区域的外亮点区域从YUV空间转换为HSV空间,并根据渐变因子调低该外亮点区域的像素在HSV空间的亮度H值,然后根据该异常眼部区域的内亮点区域像素的亮度平均值调整该异常眼部区域的内亮点区域,该渐变因子随着该外亮点区域的像素与该异常眼部区域中心的距离的减小而减小,其中,该内亮点区域以该异常眼部区域的中心点为圆心,以该异常眼部区域的最佳亮点半径为半径,该外亮点区域为该异常眼部区域中该内亮点区域以外的区域,该预定的条件为:该参考点的YUV参考值对应的像素是红色像素,并且该参考点的YUV亮度值乘以第二预定系数后的值小于该异常眼部区域的中间亮度值,并且该异常眼部区域的亮度平均值小于预定亮度值;该图形处理单元还用于对该异常眼部区域进行平滑处理。
结合第二方面的第十种可能的实现方式,在第十一种可能的实现方式中,具体实现为:该第二预定系数取值为0.9,该预定亮度值取值为115。
结合第二方面的第十种可能的实现方式,在第十二种可能的实现方式中,具体实现为该渐变因子factor用以下公式确定:factor=(fMax-fMin)*(distance-a*radius)/(radius-a*radius)+fMin,其中radius表示该异常眼部区域的原始半径,distance表示该外亮点区域的像素到该异常眼部区域中心的距离,fMax表示factor的最大值,fMin表示factor的最小值,a表示该渐变因子的距离系数。
结合第二方面的第十二种可能的实现方式,在第十三种可能的实现方式中,具体实现为,该渐变因子公式具体为factor=(0.4-0.1)*(distance–0.25*radius)/(radius–0.25*radius)+0.1,其中,fMax取值为0.4,fMin取值为0.1,a取值为0.25。
结合第二方面的第五种可能的实现方式或第二方面的第十种可能的实现方式,在第十四种可能的实现方式中,具体实现为,异常眼部区域的最佳亮 点半径optR用以下公式确定:optR=(maxR-minR)*(eyedistance-100)/400+minR,其中,maxR表示估算出的该异常眼部区域的最佳亮点半径的最大值,minR表示估算出的该异常眼部区域的最佳亮点半径的最小值,eyedistance表示该输入图像中两个眼睛中心的距离。
结合第二方面的第五种可能的实现方式或第二方面的第十种可能的实现方式,在第十五种可能的实现方式中,具体实现为:在用于根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值,该确定单元具体用于:获取该至少一个候选参考点中部分或全部候选参考点的YUV数据的平均值;如果该平均值对应的亮度值大于预定的阈值,则确定预定的参考值作为该异常眼部区域的参考点的参考值,否则以该平均值作为该异常眼部区域的参考点的参考值。
结合第二方面的第九种可能的实现方式,在第十六种可能的实现方式中,具体实现为,该红色像素的RGB满足以下条件:max(r,g,b)>th1,且max(r,g,b)-g>th2,且max(r,g,b)/g>th3,其中,r表示RGB的三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th1、th2、th3分别表示红色像素的3个预定值;或者该红色像素的RGB满足以下条件:r2/(g2+b2+th4)>th5,且r>th6,其中,r表示RGB的三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th4、th5、th6分别表示红色像素判定的3个预定值。
基于以上技术方案,本发明实施例的眼部图像处理方法和装置,通过对眼眶区域的掩膜图像进行分析获取候选异常眼部区域,并通过候选异常眼部区域的填充度和眼眶区域的亮度特征确定候选异常眼部区域的置信度,从而能够更准确地定位眼部图像的异常眼部区域,为异常眼部的处理提供了准确的位置信息。
附图说明
为了更清楚地说明本发明实施例的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例图像处理方法流程图;
图2a是本发明实施例的眼眶区域示例图;
图2b是本发明实施例的一种人脸区域示意图;
图3是本发明实施例图像处理方法另一流程图;
图4是本发明实施例候选参考点选取示意图;
图5是本发明实施例图形处理装置示意图;
图6是本发明实施例另一图形处理装置示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
需要注意的是,在本发明中,如果没有特别指明,平均值均指算术平均值。
图1是本发明实施例眼部图像处理方法流程图,图1的方法由图形处理装置执行。
101,确定输入图像的眼眶区域。
如果输入图像为眼眶矩形区域,则可以直接在图像上进行处理。图2a是本发明实施例的眼眶区域示例图。图2a示出了金眼和红眼的眼眶区域。从图2a可以看出,眼眶区域包括眼睛和眼睛周围的部分区域,眼睛又包括眼球和 眼白两部分区域。本发明中,金眼瑕疵及红眼瑕疵就出现在眼睛中的眼球所在的区域。
如果输入图像为脸框区域,则需要估算出脸框区域中的眼眶区域。一般情况下,选取的眼眶区域为矩形区域,当然,也不排除选择其它形状的眼眶区域的可能。图2b是本发明实施例的一种人脸脸框区域示意图。一个具体的实现方式如图2b所示,如果脸框左上角坐标(0,0),宽w,高h,则可选择取左上角坐标(0,h/7),宽w,高h/4的区域作为眼眶区域。
另外,本发明中,凡是涉及长度的参数,例如半径、距离、宽、高等的参数,在没有特别指明的情况下,均以像素为单位。例如,半径为70,表示半径的长度为70个像素,或者说半径的长度等于70个像素的长度。
102,获取该眼眶区域的第一掩膜图像。
本发明实施例中,可通过多种方式获取眼眶区域的掩膜图像。
该第一掩膜图像可以是眼眶区域的金眼掩膜图像,也可以是眼眶区域的红眼掩膜图像。当然,该第一掩膜图像还可以是其它类型的掩膜图像。
该第一掩膜图像可以为二值掩膜图像,用0和1表示,0表示像素正常,1表示像素异常,根据所有像素的状态形成的二值掩膜图像,可判断出眼眶区域中的瑕疵区域,例如金眼、红眼等。当然,也可用0表示像素异常,1表示像素正常,本发明对此并不作限制。在本发明实施例中,掩膜图像用1表示像素异常。
103,根据该第一掩膜图像确定该眼眶区域的至少一个第一异常区域。
根据该第一掩膜图像,可得到若干个像素异常的连通区域。本发明实施例中,第一异常区域即表示该第一掩膜图像中像素异常的连通区域在眼眶区域中对应的区域。
104,根据该眼眶区域的第一掩膜图像确定该至少一个第一异常区域中的第一候选异常眼部区域。
该第一候选异常眼部区域满足以下条件:该第一候选异常眼部区域的像 素个数大于第一预定值,该第一候选异常眼部区域的圆度大于第二预定值且该第一候选异常眼部区域的圆度小于第三预定值,该第一候选异常眼部区域的原始半径大于第四预定值,该第一候选异常眼部区域的填充度大于第五预定值,该第一候选异常眼部区域与该眼眶区域的像素比大于第六预定值,其中第一预定值为一个正整数,第二预定值为一个小于1的正数,第三预定值为一个大于1的正数,该第四预定值为一个正数,该第五预定值为一个正数,该第六预定值为一个正数。例如,第一预定值取值为60,第二预定值取值为0.6,第三预定值取值为1.6,第四预定值取值为30,第五预定值取值为0.65,第六预定值取值为0.08,等等。
105,当该第一候选异常眼部区域的置信度大于第七预定值时,确定该第一候选异常眼部区域为该眼眶区域中的异常眼部区域。
其中,该第一候选异常眼部区域的置信度由该第一候选异常眼部区域的填充度和该眼眶区域的亮度特征确定。该第一候选异常眼部区域的置信度用于表示第一候选异常眼部区域为眼眶区域的异常眼部区域的可信程度。
本发明实施例中,通过对眼眶区域的掩膜图像进行分析获取候选异常眼部区域,并通过候选异常眼部区域的填充度和眼眶区域的亮度特征确定候选异常眼部区域的置信度,从而能够更准确地定位眼部图像的异常眼部区域,为异常眼部的处理提供了准确的位置信息。
可选地,该方法还包括:当该异常眼部区域未被找到时,获取该眼眶区域的第二掩膜图像,该第二掩膜图像为金眼掩膜图像或红眼掩膜图像,该第二掩膜图像可以为二值掩膜图像,该第二掩膜图像不同于该第一掩膜图像;根据该第二掩膜图像获取该眼眶区域的至少一个第二异常区域;根据该第二掩膜图像对应的异常眼部区域判断条件确定该至少一个第二异常区域中的第二候选异常眼部区域,其中该第二候选异常眼部区域满足该第二掩膜图像对应的异常眼部区域判断条件中的所有判断条件,该第二掩膜图像对应的异常眼部区域判断条件包括以下至少一个条件:该第二候选异常眼部区域的像素 个数大于第八预定值,该第二候选异常眼部区域的圆度大于第九预定值且该第二候选异常眼部区域的圆度小于第十预定值,该第二候选异常眼部区域的原始半径大于第十一预定值,该第二候选异常眼部区域的填充度大于第十二预定值,该第二候选异常眼部区域与该眼眶区域的像素比大于第十三预定值,其中第八预定值为一个正整数,第九预定值为一个小于1的正数,第十预定值为一个大于1的正数,该第十一预定值为一个正数,该第十二预定值为一个正数,该第十三预定值为一个正数;当该第二候选异常眼部区域的置信度大于第十四预定值时,确定该第二候选异常眼部区域为该眼眶区域的异常眼部区域,其中,该第二候选异常眼部区域的置信度由该第二候选异常眼部区域的填充度和该眼眶区域的亮度特征确定。与第一掩膜图像类似,第二掩膜图像也可用0,1表示。同样,根据该第二掩膜图像,可得到若干个像素异常的连通区域。本发明实施例中,第二异常区域即表示该第二掩膜图像中像素异常的连通区域在眼眶区域中对应的区域。本发明实施例中,第二异常区域和第一异常区域仅仅是用于区分两次掩膜图像确定的异常区域,没有实质上的区别。
本发明实施例中,当一种掩膜图像定位异常眼部区域失败时,获取眼眶区域的另一种掩膜图像,进而确定异常眼部区域,能够提高异常眼部区域定位的准确性。
可选地,步骤102之后,还可对第一掩膜图像进行形态学操作以移除所述第一掩膜图像的孤立点。
可选地,该第一候选异常眼部区域的置信度s用公式(1.1)表示:
s=c+β*gray   公式(1.1),
其中c表示该第一候选异常眼部区域的填充度,gray表示该眼眶区域的亮度特征,β表示该眼眶区域的亮度特征在置信度中的比例因子;
该第一候选异常眼部区域的填充度c用公式(1.2)表示:
c=sp/(π*radius*radius)        公式(1.2),
其中,sp表示该第一候选异常眼部区域的像素个数,radius表示该第一候选异常眼部区域的原始半径;
该眼眶区域的亮度特征gray用公式(1.3)表示:
gray=(α*gray4-gray2)/(α*gray4)            公式(1.3),
其中,gray4表示该眼眶区域的平均亮度,gray2表示该第一候选异常眼部区域以外预定个像素范围内区域的平均亮度,或者gray2表示该第一候选异常眼部区域以外预定个像素范围内的若干个参考点的平均亮度,α表示该眼眶区域的平均亮度在该眼眶区域的亮度特征的比例因子。
可选地,作为一个实施例,步骤102具体实现为:获取该眼眶区域的亮度信息;根据该眼眶区域的亮度信息获取该眼眶区域的边缘强度图像;对该边缘强度图像进行二值聚类分割以获取该眼眶区域的第一掩膜图像。具体地,根据该眼眶区域的亮度信息获取该眼眶区域的边缘强度图像可实现为:对该眼眶区域进行高斯模糊处理,根据同性(sobel)算子对该进行高斯模糊处理后的眼眶区域进行soble边缘强度提取以获取该眼眶区域的边缘强度图像;对该边缘强度图像进行二值聚类分割以获取该眼眶区域的金眼掩膜图像可实现为:获取使得该眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第一阈值,将小于第一阈值的边缘强度设为第一阈值,并获取使得该眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第二阈值,并根据该第二阈值对该眼眶区域的边缘强度图像进行二值化以获取该眼眶区域的第一掩膜图像,其中边缘强度小于第二阈值的像素的掩膜图像信息取值为0,边缘强度大于或等于第二阈值的像素的掩膜图像信息取值为1。
进一步地,该方法还包括:如果该异常眼部区域的原始半径的值大于该眼眶区域中异常眼部区域的最小经验半径乘以第一预定系数后的值,则从该异常眼部区域之外选择至少一个候选参考点;根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值;如果该参考点的YUV参考值对应的像素不是红色像素,则根据该参考 点的YUV参考值调整该异常眼部区域的外亮点区域,根据该异常眼部区域的内亮点区域的亮度平均值调整该异常眼部区域的内亮点区域,其中该内亮点区域以该异常眼部区域的中心点为圆心,以该异常眼部区域的最佳亮点半径为半径,该外亮点区域为该异常眼部区域中该内亮点区域以外的区域;对该异常眼部区域进行平滑处理。。具体地,可用高斯模糊处理对该异常眼部区域进行平滑处理。
优选的,该眼眶区域中异常眼部区域的最小经验半径用以下公式确定:minRad=width/50+2,其中,minRad表示该眼眶区域中异常眼部区域的最小经验半径,width表示该异常眼部区域所在的眼眶区域的宽度。
优选的,该第一预定系数取值为1.25。
具体地,该异常眼部区域的最佳亮点半径用以下公式确定:optR=(maxR-minR)*(eyedistance-100)/400+minR,其中,optR表示该异常眼部区域的最佳亮点半径,maxR表示估算出的该异常眼部区域的最佳亮点半径的最大值,minR表示估算出的该异常眼部区域的最佳亮点半径的最小值,eyedistance表示该输入图像中两个眼睛中心的距离。
具体地,根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值可实现为:获取该至少一个候选参考点中部分或全部候选参考点的YUV数据的平均值;如果该平均值对应的亮度值大于预定的阈值,则确定预定的参考值作为该异常眼部区域的参考点的参考值,否则以该平均值作为该异常眼部区域的参考点的参考值。
可选地,作为另一个实施例,步骤102具体实现为:获取该眼眶区域的RGB信息;根据该眼眶区域的RGB信息对该眼眶区域进行二值分割以获取该眼眶区域的第一掩膜图像。进一步地,根据该眼眶区域的RGB信息对该眼眶区域进行二值分割以获取该眼眶区域的第一掩膜图像可实现为:将该眼眶区域中的红色像素对应的掩膜图像信息置为1,该眼眶区域中红色像素以外的像素对应的掩膜图像信息置为0,从而形成该第一掩膜图像。
进一步地,该方法还包括:从该异常眼部区域以外选择至少一个候选参考点;根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值;如果该参考点的YUV参考值符合预定的条件,则根据该参考点的YUV参考值调整该异常眼部区域的外亮点区域,根据该异常眼部区域的内亮点区域的亮度平均值调整该异常眼部区域的内亮点区域,或者如果该参考点的YUV参考值不符合预定的条件,则将该异常眼部区域的外亮点区域从YUV空间转换为HSV空间,并根据渐变因子调低该外亮点区域的像素在HSV空间的亮度H值,然后根据该异常眼部区域的内亮点区域像素的亮度平均值调整该异常眼部区域的内亮点区域,该渐变因子随着该外亮点区域的像素与该异常眼部区域中心的距离的减小而减小;对该异常眼部区域进行平滑处理;其中,该内亮点区域以该异常眼部区域的中心点为圆心,以该异常眼部区域的最佳亮点半径为半径,该外亮点区域为该异常眼部区域中该内亮点区域以外的区域,该预定的条件为:该参考点的YUV参考值对应的像素是红色像素,并且该参考点的YUV亮度值乘以第二预定系数后的值小于该异常眼部区域的中间亮度值,并且该异常眼部区域的亮度平均值小于预定亮度值。优选地,该第二预定系数取值为0.9,该预定亮度值取值为115。
具体地,该渐变因子用以下公式确定:factor=(fMax-fMin)*(distance-a*radius)/(radius-a*radius)+fMin,其中factor表示渐变衰减因子,radius表示该异常眼部区域的原始半径,distance表示该外亮点区域的像素到该异常眼部区域中心的距离,fMax表示factor的最大值,fMin表示factor的最小值,a表示渐变因子的距离系数。优选地,该渐变因子公式可表示为:factor=(0.4-0.1)*(distance–0.25*radius)/(radius–0.25*radius)+0.1,其中,fMax取值为0.4,fMin取值为0.1,a取值为0.25。
具体地,该异常眼部区域的最佳亮点半径用以下公式确定:optR=(maxR-minR)*(eyedistance-100)/400+minR,其中,optR表示该异常眼部区域 的最佳亮点半径,maxR表示估算出的该异常眼部区域的最佳亮点半径的最大值,minR表示估算出的该异常眼部区域的最佳亮点半径的最小值,eyedistance表示该输入图像中两个眼睛中心的距离。
具体地,根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值可实现为:获取该至少一个候选参考点中部分或全部候选参考点的YUV数据的平均值;如果该平均值对应的亮度值大于预定的阈值,则确定预定的参考值作为该异常眼部区域的参考点的参考值,否则以该平均值作为该异常眼部区域的参考点的参考值。
本发明实施例红色像素的一种判断方式,红色像素的RGB满足以下条件:max(r,g,b)>th1,且max(r,g,b)-g>th2,且max(r,g,b)/g>th3,其中,r表示RGB的三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th1、th2、th3分别表示红色像素的3个预定值。
本发明实施例红色像素的另一种判断方式,红色像素的RGB满足以下条件:r2/(g2+b2+th4)>th5,且r>th6,其中,r表示RGB的三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th4、th5、th6分别表示红色像素判定的3个预定值。
上述获取第一掩膜图像的方式以及根据第一掩膜图像处理输入图像的方式也适用于第二掩膜图像,只是其中相应的参数或判断条件需要根据掩膜图像的类型(金眼掩膜图像或红眼掩膜图像)作相应的调整,本发明实施例在此不再赘述。
下面将结合具体的实施例,对本发明实施例的方法作进一步的描述。
图3是本发明实施例图像处理方法的具体流程图。
301,初始化眼眶区域。
在进行眼部瑕疵消除时,首先要确定眼眶区域。
如果图像为眼眶矩形区域,则可以直接在图像上进行处理。
如果图像为脸框区域,则要估算出眼眶矩形区域。一个具体的例子如图2b所示,如果人脸框左上角坐标(0,0),宽w,高h,则可选取眼框左上角坐标(0,h/7),宽w,高h/4的区域作为眼眶区域。
302,提取掩膜图像。
可通过多种方式提取眼眶区域的掩膜图像。
本发明实施例的一种掩膜图像提取方法,可提取眼眶区域的金眼掩膜图像。
(1)获取眼眶区域的边缘强度图像。
首先,可对眼眶区域做一个高斯模糊处理,然后对经过高斯模糊处理的图像进行sobel边缘强度提取,得到眼眶区域的边缘强度图像。
sobel算子具体如下:
水平方向sobel算子[-1 0 1;-2 0 2;-1 0 1],
垂直方向sobel算子[-1 -2 -1;0 0 0;1 2 1]。
(2)对边缘强度图形进行二值化处理以获取掩膜图像。
由于金眼瑕疵的强度很大,如果存在金眼瑕疵,则通过阈值将其提取出来。
可通过聚类分析法提取金眼掩膜图像。以类间方差法(聚类分析法的一种)为例,根据边缘强度图形计算阈值,然后根据该阈值对边缘强度图像进行0、1二值化,1表示眼眶区域对应的像素异常。具体步骤如下:
首先,统计眼眶区域边缘强度的直方图,然后给定一个阈值,将直方图分为两段(对应于边缘强度图像的两类边缘强度),统计每一段的概率值和均值,构造方差公式。遍历每一个阈值(0到255),满足类间方差最大的那个阈值t0即为所要找的第一阈值。将小于阈值t0的数据设为t0,再次重复上述操作,重新生成第二阈值t1,根据第二阈值t1,将眼眶区域的边缘强度图像进行二值分割,边缘强度小于t1的像素置为0,边缘强度大于t1的像素置为 1,从而生成眼眶区域的掩膜图像。边缘强度等于t1的,可以统一置为0,或者统一置为1。
类间方差算法具体如下:
假设边缘强度图像边缘强度级为L,直方图为Pi,用阈值t分成两类。
C0=(0,1,2…,t),C1=(t+1,t+2…,L-1)。
两类的概率和均值分别由公式(3.1)和(3.2)表示:
Figure PCTCN2014090454-appb-000001
   公式(3.1),
Figure PCTCN2014090454-appb-000002
   公式(3.2),
其中,ω0(t)表示C0的概率,ω1(t)表示C1的概率,μ0(t)表示C0的均值,μ1(t)表示C1的均值。
C0和C1的类间方差可用公式(3.3)表示:
σ2=ω00-μ)211-μ)2   公式(3.3),
其中,σ2表示C0和C1的类间方差。
此时,二值分割后的掩膜图像即为眼眶区域的掩膜图像,该掩膜图像为金眼掩膜图像。
本发明实施例的另一种掩膜图像提取方法,可提取眼眶区域的红眼掩膜图像。本发明实施例中,根据像素的类型对眼眶区域进行二值化处理。如眼眶区域的像素为红色像素,对应的掩膜图像的信息置为1,否则置为0。
在判断像素为红色像素时,需要获取像素的RGB信息。
本发明的一种方式,当获取像素的RGB信息后,可根据公式(3.3)判断像素是否为红色像素,当像素的RGB信息满足公式(3.3)时该像素为红色像素。
Figure PCTCN2014090454-appb-000003
   公式(3.3)
其中,r表示像素的RGB信息中的红色分量,g表示像素的RGB信息中的绿色分量,b表示像素的RGB信息中的蓝色分量,R表示像素的RGB的三个颜色分量的最大值,th1、th2和th3为预定的阈值。当th1取值范围60~80,th2取值范围45~65,th3取值范围1.8~2.0,可取得较准确的判断效果。例如,th1=70,th2=45,th3=1.9;或者th1=65,th2=40,th3=1.8;或者th1=75,th2=50,th3=2.0。当然,th1、th2和th3的取值也可能落入其它取值区间,本发明实施例在此并不作限制。
本发明的另一种方式,当获取像素的RGB信息后,可根据公式(3.4)判断像素是否为红色像素,当像素的RGB信息满足公式(3.4)时该像素为红色像素。
Figure PCTCN2014090454-appb-000004
   公式(3.4)
其中ratio表示像素的红色系数,r表示像素的红色分量,g表示像素的绿色分量,b表示像素的蓝色分量。当th4取值范围10~18,th5取值范围3.2~3.4,th6取值范围60~80,可取得较准确的判断效果。例如,th4可取值为14,th5取值为3.3,th6取值为70。当然,th4、th5和th6的取值也可能落入其它取值区间,本发明实施例在此并不作限制。
当然,还可能存在其它判断红色像素的方法,本发明实施例在此不作限制。
根据红色像素进行二值分割后的掩膜图像即为眼眶区域的一种掩膜图像,该掩膜图像为红眼掩膜图像。
当然,本发明实施例还可通过其它方式获取眼眶区域的金眼掩膜图像和红眼掩膜图像,也可通过其它的方式获取其他类眼部瑕疵的掩膜图像,本发明实施例在此不作限制。
303,分析掩膜图像,标记候选异常眼部区域。
通过对掩膜图像进行分析,进而标记出眼眶区域中的候选异常眼部区域。
首先,可通过形态学操作对二值掩膜进行处理,以得到更好的掩膜效果。形态学操作可包括腐蚀、膨胀操作等。
本发明实施例中,可采用孤立点移除操作。每个像素周围存在正上、正下、正左、正右、左上、左下,右上、右下共8个邻域点。通过判断每个像素周围8个邻域点的个数,如果该像素周边8个邻域点的个数小于一个阈值,则认为该点为孤立的点并移除,例如,如果该像素周边8个邻域点的个数小于3个,可将该点视为孤立点,移除。该方法可用去除一些相对孤立的噪点。
其次,对掩膜图像进行连通区域分析,判断一个点跟周边的点是否是连通的。连通的种类有四连通(正上、正下、正左、正右)和八连通(正上、正下、正左、正右、左上、左下,右上、右下)。常用的算法有两次扫描法和递归方法等,本发明实施例以递归方法为例进行描述,但并不排除使用其它算法的可能。递归方法如下:一次扫描掩膜图像中的每个像素,当找到某个未标记的目标像素时,将其压入堆栈并从该点开始反复标记其邻域,直到堆栈为空。
最后,得到一个处理后的掩膜图像,其中,像素对应的掩膜图像信息为1的聚集区域即为候选异常眼部区域。根据处理后的掩膜图像,可确定眼眶区域的若干个候选异常眼部区域。
304,统计候选异常眼部区域的参数。
通过分析掩膜图像,可初步确定眼眶区域的若干个候选异常眼部区域。
可通过多个参数判断候选异常眼部区域是否为异常眼部区域。常用的参数有圆度、面积和填充度等。其定义如下:
圆度(roundness)=候选异常眼部区域的宽(w)/候选异常眼部区域的高(h)。
面积(area)=候选异常眼部区域的像素个数(sumPixels)。
填充度(compactness)=候选异常眼部区域的像素个数(sumPixels)/(π*radius*radius),其中,radius表示候选异常眼部区域的原始半径。
305,判断是否找到异常眼部区域。
第一步,可根据多个参数的阈值初步确定候选异常眼部区域是否为异常眼部区域。
可从上述圆度、面积、半径和填充度等方面判断。在进行判断时,可选择上述参数的一个或多个进行阈值判断。凡是不符合判断条件中的任一个条件的,可从异常眼部区域中排除。因此,判断条件越多,越不会出现将正常区域误判为异常眼部区域的误判。
常用的判断条件有以下几组:
(1)、候选异常眼部区域的面积大于第一预定值。
换句话说,就是候选异常眼部区域的像素个数大于第一预定值,其中第一预定值为一个正整数。
第一预定值可以是一个固定值,也可通过计算获得。
当第一预定值通过计算确定时,一种计算方式,第一预定值=(0.001*眼眶区域像素个数)。当然,还可能有其它计算公式,本发明实施例在此不作限制。
对于金眼瑕疵的判定条件来说,当第一预定值为一个固定值时,第一预定值取值在20~40之间,可取得较好的判定效果。例如第一预定值可取值为20、30、40等。
对于红眼瑕疵的判定条件来说,当第一预定值为一个固定值时,第一预定值取值在50~70之间,可取得较好的判定效果。例如,第一预定值可取值为60。
当候选异常眼部区域的面积大于第一预定值,可初步认定此候选异常眼部区域可能为异常眼部区域,否则,排除此候选异常眼部区域。
(2)、候选异常眼部区域的圆度大于第二预定值,且候选异常眼部区域的圆度小于第三预定值。
异常眼部区域的圆度,介于第二预定值和第三预定值两个数值之间。第二预定值为一个小于1的正数,第三预定值为一个大于1的正数,例如,异常眼部区域的圆度范围可取0.6~1.6,0.65~1.55,0.7~1.5,等等。
不妨假设异常眼部区域的圆度范围为0.6~1.6,则此时第二预定值为0.6,第三预定值为1.6。当候选异常眼部区域的圆度小于0.6或大于1.6时,可排除此候选异常眼部区域;当候选异常眼部区域的圆度接入0.6和1.6之间时,可初步认定此候选异常眼部区域可能为异常眼部区域。
对于金眼瑕疵的判定条件来说,第二预定值取值在0.6~0.7之间,第三预定值取值在1.5~1.6之间,可取得较好的判定效果。
对于金眼瑕疵的判定条件来说,第二预定值取值在0.6~0.7之间,第三预定值取值在1.5~1.6之间,可取得较好的判定效果。
(3)、候选异常眼部区域的原始半径大于第四预定值。
当候选异常眼部区域的原始半径小于第四预定值时,可排除此候选异常眼部区域;当候选异常眼部区域的原始半径大于或等于第四预定值时,可初步认定此候选异常眼部区域可能为异常眼部区域。第四预定值为一个正数。
对于金眼瑕疵的判定条件来说,第四预定值取值在3~5之间,可取得较好的判定效果。
对于红眼瑕疵的判定条件来说,第四预定值取值在4~6之间,可取得较好的判定效果。
对于金眼掩膜图像和红眼掩膜图像,该半径的阈值一般不同。
本发明实施例中,异常眼部区域的原始半径的一种计算方式可用如下公式表示:
原始半径(locationR)=max(异常眼部区域宽,异常眼部区域高)/2。
(4)、候选异常眼部区域的填充度大于第五预定值。
当候选异常眼部区域的填充度小于第五预定值时,可排除此候选异常眼部区域;当候选异常眼部区域的填充度大于或等于第五预定值时,可初步认定此候选异常眼部区域可能为异常眼部区域。
对于金眼掩膜图像和红眼掩膜图像,该填充度的阈值一般不同。
对于金眼瑕疵的判定条件来说,第五预定值取值在0.6~0.7之间,可取得较好的判定效果。
对于红眼瑕疵的判定条件来说,第五预定值取值在0.5~0.6之间,可取得较好的判定效果。
例如,金眼掩膜图像的第五预定值可取值为0.65,红眼掩膜图像的第五预定值可取值为0.5。当然,也不排除选取其它数值的可能。
(5)、候选异常眼部区域与眼眶区域像素比大于第六预定值。
候选异常眼部区域与眼眶区域像素比(ratio)=(π*radius*radius)/(眼眶宽*眼眶高),其中radius表示候选异常眼部区域的原始半径。
第六预定值一般取值在0.009~0.011之间,可取得较好的判定效果,当然,也不排除取其它数值的可能。
上述第一预定值到第六预定值的取值范围,只是一种可能取得较好判定效果的范围,当然,不排除第一预定值到第六预定值落入其它取值区间的可能。
对于红眼掩膜图像和金眼掩膜图像,可分别选取上述几个条件作为异常眼部区域的判断条件。例如,对于红眼掩膜图像,可选择1、2、4、5作为判断条件,对于金眼掩膜图像,可选择1、2、3、4作为判断条件。当然,也可减少几个判断条件,或新增几个判断条件。
当选中上述的一个或几个作为判断条件后,则当所有选中的条件都满足时,才可初步确认候选异常眼部区域可能为异常眼部区域。如果选中的条件 中任一个条件不满足,则将该候选异常眼部区域排除。
第二步,判断候选异常眼部区域的置信度是否大于第七预定值。
置信度(score)=填充度(compactness)+β*亮度特征(gray)
亮度特征(gray)=(α*gray4–gray2)/(α*gray4)。
其中,gray4表示该眼眶区域的平均亮度,gray2表示该第一候选异常眼部区域以外预定个像素范围内区域的平均亮度,或者gray2表示该第一候选异常眼部区域以外预定个像素范围内的若干个参考点的平均亮度,α表示该眼眶区域的平均亮度在该眼眶区域的亮度特征的比例因子,β表示亮度特征在置信度中的比例因子。通常情况下,α取值范围0.9~1.1,β取值范围1.4~1.8,score取值范围1.0~1.2,此时置信度的判断较为准确。当然,也不排除α,β和score的取值落入其它取值区间的可能。
一个计算gray2的例子如下:在候选异常眼部区域以外,3个像素范围内,左右区域各取若干个参考点,求取亮度平均值,该亮度平均值即为gray2。
当置信度大于第七预定值时,可认为该候选异常眼部区域为异常眼部区域,否则认为该候选异常眼部区域为非异常眼部区域。
例如,α取值为0.95,β取值为1.6,第七预定值取值为1.0,等等。
如果找到异常眼部区域,则根据掩膜图像的类型进行相应处理。如果为金眼掩膜图像,执行步骤307;如果为红眼掩膜图像,则执行步骤312。
如果未找到异常眼部区域,则执行步骤306。
306,判断是否选择另一种提取掩膜图像的方式。
如果需要选择另一种掩膜图像提取,则执行步骤302。
否则,执行步骤319,不处理退出。
307,计算异常眼部区域的最小经验半径minRad。
此时,眼部瑕疵的种类为金眼瑕疵,掩膜图像为金眼掩膜图像。
通过异常眼部区域的最小经验半径公式,可估算出异常眼部区域的经验半径。
一种异常眼部区域的经验半径公式如下:
最小经验半径(minRad)=眼眶宽度(width)/50+2。
308,判断minRad乘以预定系数是否小于原始半径。
如果最小经验半径minRad乘以预定系数后的值大于原始半径,说明瑕疵亮点不大,无法进行处理,或者处理后效果不好,或者是处理后效果没有明显改善。此时,执行步骤319。
如果最小经验半径minRad乘以预定系数小于原始半径,说明瑕疵亮点较大,此时,执行步骤309。
优选的,本发明实施例中,该预定系数可以取值为1.25。
另外,对于临界条件,即最小经验半径minRad乘以预定系数等于原始半径,可以选择处理,也可以选择不处理。
309,分析异常眼部区域外区域。
根据检测的异常眼部区域的中心坐标和最小经验半径minRad,可选取若干个候选参考点的信息。候选参考点的信息,可以是与候选参考点的亮度有关的信息。本发明实施例,以候选参考点的YUV三个通道的信息进行说明。
YUV的三个分量中,“Y”表示“亮度”(Luminance或Luma),也就是灰阶值;而“U”和“V”表示的则是“色度”(Chrominance或Chroma),作用是描述影像色彩及饱和度,用于指定像素的颜色。“亮度”是透过RGB输入信号来建立的,方法是将RGB信号的特定部分叠加到一起。“色度”则定义了颜色的两个方面─色调与饱和度,分别用Cr和Cb来表示。其中,Cr反映了RGB输入信号红色部分与RGB信号亮度值之间的差异。而Cb反映的是RGB输入信号蓝色部分与RGB信号亮度值之间的差异。
在进行异常眼部的瑕疵调整时,通常把每个异常区域目标分为左右两侧,分别是左眼左侧,左眼右侧,右眼左侧,右眼右侧,每一侧均可得出一个平均参考点。
在选取候选参考点时,可从以异常眼部区域的中心坐标为中心,locationR +n个像素为半径范围内,异常眼部区域以外的区域选择若干个点作为候选参考点,n一般取值为2、3、4、5,当然也不排除n取其它值的可能。一般情况下,可从异常眼部区域的四个方位(上、下、左、右)选取候选参考点,或者从异常眼部区域的八个方位(左上、正左、左下、正上、正下、右上、正右、右下)选取候选参考点。可以随机选择候选参考点,也可按照一定的规则进行候选参考点。显然,按照一定的规则选取候选参考点,相对于随机选取而言,能够取得可预期的效果,而且,在一些特定的选取规则下,候选参考点的选取能够取得相对较好的效果。
图4是本发明实施例候选参考点选取的一种示意图。图中所示为左眼的候选参考点选取,方框区域为左眼左侧。图中的locationR表示异常眼部区域的原始半径。优选地,一种候选参考点的选取规则,如图4所示,对左眼左侧来说,可选取左眼的正上、左上、正左、左下、正下共5个方位的候选参考点,其中正左选择的参考点最多,正上和正下次之,左上和左下再次之。以图4为例,左眼左侧共选取25个候选参考点,其中正左为17个;正上和正下各为3个;左上和左下各为1个。与左眼左侧类似,左眼右侧可选取左眼的正上、右上、正右、右下、正下共5个方位的候选参考点,其中正右选择的参考点最多,正上和正下次之,右上和右下再次之。右眼的候选参考点选取方式与左眼类似,本发明实施例在此不再赘述。
在选出候选参考点后,可根据候选参考点确定参考点的参考值。参考点的参考值,包括YUV的Y、U、V三个分量的参考值,分别由候选参考点相应的分量计算获取。一种方式,可将所有候选参考点的平均值作为参考点的参考值。另一种方式,可从候选参考点中选择亮度最暗的前几个候选参考点的平均值作为参考点的参考值。再一种方式,可从候选参考点中选择亮度居中的几个候选参考点的平均值。当然,还可通过其它方式确定参考点的参考值。例如,上述的平均值改为平方平均值、调和平均值或加权平均值等。具体的,加权平均值可根据候选参考点所在的方位取得加权,等等。
此时,可得到异常眼部区域左右两侧各自的YUV平均值。
当然,也可以将异常眼部区域视为一个整体,根据候选参考点得到一个参考点作为异常眼部区域的参考点。
或者,可以将异常眼部区域分成3个乃至更多个子区域,根据异常眼部区域的子区域分别选择候选参考点,并根据子区域各自的候选参考点得到子区域各自的参考点。
310,判断是否存在合适参考点。
如果存在合适参考点,则执行步骤311,否则执行步骤319。
获得YUV的平均值后,先确定该YUV的平均值对应的像素是否是红色像素。一个YUV值(包含Y、U、V三个分量)对应于一个RGB信息(包含r,g,b三个分量),如果该YUV值对应的RGB信息符合红色像素的判断条件,则可以说该YUV的平均值对应的像素是红色像素。红色像素的判断标准可参考步骤302中的公式(3.3)和公式(3.4),本发明实施例在此不再赘述。
如果存在至少一个参考点的YUV平均值对应的像素为红色像素,此时以该参考进行处理将导致处理效果类似于红眼瑕疵,处理效果不好,因此,执行步骤319。
如果所有参考点各自的YUV平均值对应的像素不是红色像素,则对所有参考点各自的YUV平均值中的亮度值进行判断。如果YUV平均值中亮度值大于预定的阈值,则YUV平均值中不适合作为参考点的参考值,此时,可另取一个默认的参考值作为参考点对应的参考值;如果YUV平均值中亮度值小于预定的阈值,则以该YUV平均值作为参考点的参考值。
该预定的阈值取值在80~115时,可取得较好的参考点。例如,当该预定的阈值为100,且YUV平均值中亮度值为110,则可将一个默认的参考值作为参考点的参考值。当然,也不排除该预定的阈值取值落入其它取值区间的可能。
311,用参考点调整外亮点区域。
根据得到的参考点的参考值,对异常眼部区域的外亮点区域进行填充。
可将异常眼部区域分成内亮点区域和外亮点区域两部分,其中,异常眼部区域中最佳亮点半径以内的区域为内亮点区域,异常眼部区域中最佳亮点半径以外的区域为外亮点区域。
异常眼部区域的一种最佳亮点半径计算公式如下:
异常眼部区域的最佳亮点半径(optR)=(最大参考宽度(maxR)-最小参考宽度(minR))*((眼睛距离(eyedistance)-100)/400+最小参考宽度(minR))。
其中,最大参考宽度和最小参考宽度为根据经验估算出来的内亮点区域最大参考宽度和最小参考宽度。
在用参考点对外亮点区域进行调整时,遵循从亮到暗的原则用参考点的参考值对外亮点区域进行填充。具体的,其填充的亮度值要满足由异常眼部区域的外部到中心点按线性递减。例如,假设参考点的亮度为Y,距离中心点距离原始半径(locationR)的点填充的亮度为Y*1,中心点填充的亮度为Y*0.85,以此对外亮点区域进行填充。需要说明的是,虽然此处指出中心点填充的亮度为Y*0.85,但实际上并不对包括中心点在内的内亮点区域进行填充。
调整完毕后,可用高斯模糊处理平滑边界区域。
312,分析异常眼部区域外区域。
此时,眼部瑕疵的种类为红眼瑕疵,掩膜图像为红眼掩膜图像。
异常眼部区域的原始半径可用如下公式表示:
原始半径(locationR)=max(异常眼部区域宽,异常眼部区域高)/2。
与步骤310类似,在选取候选参考点时,可从以异常眼部区域的中心坐标为中心,locationR+n个像素为半径范围内,异常眼部区域以外的区域选择若干个点作为候选参考点,n一般取值为2、3、4、5,当然也不排除n取其它值的可能。一般情况下,可从异常眼部区域的四个方位(上、下、左、 右)选取候选参考点,或者从异常眼部区域的八个方位(左上、正左、左下、正上、正下、右上、正右、右下)选择候选参考点。优选地,为了避免选取到眼皮区域,通常只在异常眼部区域的左右两侧选取候选参考点,以图4为例,左侧只取正左区域的点作为候选参考点,最多加上左上和左下区域,右侧只取正右区域的点作为候选参考点,最多加上右上和右下区域。
在选出候选参考点后,可根据候选参考点确定参考点的参考值。参考点的参考值,包括YUV的Y、U、V三个分量的参考值,分别由候选参考点相应的分量计算获取。一种方式,可将所有候选参考点的平均值作为参考点的参考值。另一种方式,可从候选参考点中选择亮度最暗的前几个候选参考点的平均值作为参考点的参考值。再一种方式,可从候选参考点中选择亮度居中的几个候选参考点的平均值。当然,还可通过其它方式确定参考点的参考值,例如,上述的平均值改为平方平均值、调和平均值或加权平均值等。具体的,加权平均值可根据候选参考点所在的方位取得加权,等等。
此时,可得到异常眼部区域左右两侧各自的YUV平均值,也就是说,确定了异常眼部区域两侧各自的参考点。
当然,也可以将异常眼部区域视为一个整体,根据候选参考点得到一个参考点作为异常眼部区域的参考点。
或者,可以将异常眼部区域分成3个乃至更多个子区域,根据异常眼部区域的子区域分别选择候选参考点,并根据子区域各自的候选参考点得到子区域各自的参考点。
313,判断是否存在合适参考点。
根据预定的条件判断获取的参考点是否为合适的参考点。如果异常眼部区域的所有参考点都符合预定的条件,则说明存在合适的参考点,此时可执行步骤314;如果存在至少一个参考点不符合预定的条件,则说明不存在合适的参考点,此时可执行步骤315。
该预定的条件包括:参考点的YUV参考值对应的像素是红色像素,并且 参考点的YUV亮度值乘以第二预定系数后的值小于异常眼部区域的中间亮度值,并且异常眼部区域的亮度平均值小于预定亮度值。当第二预定系数取值范围在0.8~1.0之间,预定亮度值取值在105~125之间,可取得较合适的参考点。当然,也不排除取值范围落入其它取值区间的可能。
一个具体的例子,该预定条件可用如下公式表示:
参考点的YUV值对应的像素为红色像素&&yMean*0.9<=yMedian&&yMedian<115。
其中,yMean表示参考点YUV中的亮度值,yMedian表示异常眼部区域的亮度中间值。该公式表示参考点对应的像素为红色像素,并且参考点的亮度值乘以0.9小于或等于异常眼部区域的亮度平均值,并且异常眼部区域的亮度平均值小于115,&&表示逻辑与。
在判断参考点的YUV值对应的像素是否为红色像素时,可参考步骤302中的方法,本发明实施例在此不再赘述。
314,用参考点调整外亮点区域。
与金眼类似,可将异常眼部区域分成内亮点区域和外亮点区域两部分,其中,异常眼部区域中最佳亮点半径以内的区域为内亮点区域,异常眼部区域中最佳亮点半径以外的区域为外亮点区域。
异常眼部区域的一种最佳亮点半径计算公式如下:
异常眼部区域的最佳亮点半径(optR)=(最大参考宽度(maxR)-最小参考宽度(minR))*((眼睛距离(eyedistance)-100)/400+最小参考宽度(minR))
其中,最大参考宽度和最小参考宽度为根据经验估算出来的内亮点区域最大参考宽度和最小参考宽度。
在用参考点对外亮点区域替换消除时,遵循从亮到暗的原则用参考点的参考值对外亮点区域进行替换。具体的,其替换的亮度值要满足由异常眼部区域的外部到中心点按线性递减。例如,假设参考点的亮度为Y,距离中心 点距离原始半径(locationR)的点替换的亮度为Y*1,中心点替换的亮度为Y*0.85,以此对外亮点区域进行填充。需要说明的是,虽然此处指出中心点填充的亮度为Y*0.85,但实际上并不对包括中心点在内的内亮点区域进行填充。
替换消除完毕后,可用高斯模糊处理平滑边界区域。
315,转HSV空间消除。
第一步,将待调整区域的YUV空间转为HSV空间。
本发明实施例中,待调整区域为外亮点区域。其中,异常眼部区域中以中心点为圆心,以最佳亮点半径为半径的区域为内亮点区域;异常眼部区域中内亮点区域以外区域为外亮点区域。
HSV是基于颜色的直观特性的一种颜色空间,其中颜色的参数分别是:色调(Hue,H),饱和度(Saturation,S),亮度(Value,V)。
色调H:表示色彩信息,即所处的光谱颜色的位置,用角度度量,取值范围为0°~360°,从红色开始按逆时针方向计算,红色为0°,绿色为120°,蓝色为240°。它们的补色是:黄色为60°,青色为180°,品红为300°。
饱和度S:表示成所选颜色的纯度和该颜色最大的纯度之间的比率,取值范围为0.0~1.0,S=0时,只有灰度值。
亮度V:表示色彩的明亮程度,取值范围为0.0(黑色)~1.0(白色)。有一点要注意:它和光强度之间并没有直接的联系。
第二步,对待调整区域的H值进行拉低。
根据分析,当H值被拉低时,色度、饱和度作用将减弱,颜色呈现偏黑色,达到红眼校正的目的。因此,在对异常眼部区域进行调整时,可对调整区域的H值,乘以一个渐变因子进行拉低。考虑到眼睛的黑色是由外到内逐渐变黑,设计的渐变因子跟距离有关,即求得当前点到红眼中心的距离distance,distance的值越低,渐变因子越小,二者呈线性关系。渐变因子公式如下:
factor=(fMax-fMin)*(distance-a*radius)/(radius-a*radius)+fMin,
其中factor表示渐变衰减因子,radius表示该异常眼部区域的原始半径,distance表示外亮点区域的像素到该异常眼部区域的中心的距离,fMax表示factor的最大值,fMin表示factor的最小值,即factor递减的最终值,a表示渐变因子的距离系数。当fMax取值在0.3~0.5之间,fmin取值在0.1~0.2之间,a取值在0.2~0.3之间时,可取得较好的校正效果。当然,也不排除fMax、fmin或a的取值范围落入其它取值区间的可能。
调整完毕后,再将HSV空间逆变换到YUV空间。
一种具体的实现方式如下:
将外亮点区域转换到HSV空间,然后对S通道乘以一个衰减因子hsFactor(例如,0.25)进行衰减,最小衰减到80(最小衰减到80,是说当通过公示计算的结果小于80时,最终取值为80);对V通道乘以一个亮度因子factor进行衰减,最小衰减到80。
其中亮度因子factor表示如下:
factor=(0.4-0.1)*(distance–0.25*radius)/(radius–0.25*radius)+0.1
最后,将外亮点区域从HSV空间逆变换到YUV空间。
316,内亮点区域去色保留。
获取内亮点区域的亮度参考值,并以该亮度参考值对内亮点区域去色保留,调整内亮点区域的亮度值。
一种方式,可求取内亮点区域的所有像素的亮度Y值的中间值,并以该亮度中间值作为内亮点区域的亮度参考值。
另一种方式,可选择内亮点区域的若干个像素,选中其中的亮度中间值,并以该亮度中间值作为内亮点区域的亮度参考值。
当然,还可能存在其它确定内亮点区域亮度的方法,例如,可用内亮点 区域的所有像素的亮度Y值的平均值,或者是内亮点区域的若干个像素的亮度Y值的平均值,等等,本发明实施例在此不作限制。
然后,执行步骤317。
317,对异常眼部区域平滑边界。
用高斯模糊处理对异常眼部区域的边界进行平滑处理。
318,输出消除结果。
将处理后的图像输出。
至此,图像处理执行完毕。
319,退出。
此时,存在几种可能,例如,可能是未找到异常眼部区域,或者处理效果不好。
本发明实施例中,通过多种方式对异常眼部区域进行定位后再处理,可避免异常眼部区域的误检,另外,本发明实施例的异常眼部消除方法,一定程度上能够取得较好的消除效果。
图5是本发明实施例图形处理装置500的结构示意图。图形处理装置500可包括:确定单元501和获取单元502。
确定单元501,用于确定输入图像的眼眶区域。
如果输入图像为眼眶矩形区域,则直接在图像上进行处理。
如果输入图像为脸框区域,则确定单元501要估算出脸框区域中的眼眶区域。一般情况下,选取的眼眶区域为矩形区域,当然,也不排除选择其它形状的眼眶区域的可能。
获取单元502,用于获取该眼眶区域的第一掩膜图像,并根据该第一掩膜图像确定该眼眶区域的至少一个第一异常区域。
其中,该第一掩膜图像可以是眼眶区域的金眼掩膜图像,也可以是眼眶区域的红眼掩膜图像,该第一掩膜图像为二值掩膜图像。
确定单元501还用于根据该眼眶区域的第一掩膜图像确定该至少一个第 一异常区域中的第一候选异常眼部区域。
该第一候选异常眼部区域满足该第一掩膜图像对应的异常眼部区域判断条件中的所有判断条件,该第一掩膜图像对应的异常眼部区域判断条件包括以下至少一个条件:该第一候选异常眼部区域的像素个数大于第一预定值,该第一候选异常眼部区域的圆度大于第二预定值且该第一候选异常眼部区域的圆度小于第三预定值,该第一候选异常眼部区域的原始半径大于第四预定值,该第一候选异常眼部区域的填充度大于第五预定值,该第一候选异常眼部区域与该眼眶区域的像素比大于第六预定值,其中第一预定值为一个正整数,第二预定值为一个小于1的正数,第三预定值为一个大于1的正数,该第四预定值为一个正数,该第五预定值为一个正数,该第六预定值为一个正数。例如,第一预定值取值为60,第二预定值取值为0.6,第三预定值取值为1.6,第四预定值取值为30,第五预定值取值为0.65,第六预定值取值为0.08,等等。
确定单元501还用于当该第一候选异常眼部区域的置信度大于第七预定值时,确定该第一候选异常眼部区域为该眼眶区域中的异常眼部区域。
其中,该第一候选异常眼部区域的置信度由该第一候选异常眼部区域的填充度和该眼眶区域的亮度特征确定,该第一候选异常眼部区域的置信度用于表示第一候选异常眼部区域为眼眶区域的异常眼部区域的可信程度。
本发明实施例中,图形处理装置500通过对眼眶区域的掩膜图像进行分析获取候选异常眼部区域,并通过候选异常眼部区域的填充度和眼眶区域的亮度特征确定候选异常眼部区域的置信度,从而能够更准确地定位眼部图像的异常眼部区域,为异常眼部的处理提供了准确的位置信息。
可选地,获取单元502还用于当该异常眼部区域未被找到时,获取该眼眶区域的第二掩膜图像,并根据该第二掩膜图像确定该眼眶区域的至少一个第二异常区域,其中该第二掩膜图像为金眼掩膜图像或红眼掩膜图像,该第二掩膜图像为二值掩膜图像,该第二掩膜图像不同于该第一掩膜图像;确定 单元501还用于根据该第二掩膜图像对应的异常眼部区域判断条件确定该至少一个第二异常区域中的第二候选异常眼部区域,并且当该第二候选异常眼部区域的置信度大于第十四预定值时,确定该第二候选异常眼部区域为该眼眶区域的异常眼部区域,其中该第二候选异常眼部区域满足该第二掩膜图像对应的异常眼部区域判断条件中的所有判断条件,该第二掩膜图像对应的异常眼部区域判断条件包括以下至少一个条件:该第二候选异常眼部区域的像素个数大于第八预定值,该第二候选异常眼部区域的圆度大于第九预定值且该第二候选异常眼部区域的圆度小于第十预定值,该第二候选异常眼部区域的原始半径大于第十一预定值,该第二候选异常眼部区域的填充度大于第十二预定值,该第二候选异常眼部区域与该眼眶区域的像素比大于第十三预定值,其中第八预定值为一个正整数,第九预定值为一个小于1的正数,第十预定值为一个大于1的正数,该第十一预定值为一个正数,该第十二预定值为一个正数,该第十三预定值为一个正数,该第二候选异常眼部区域的置信度由该第二候选异常眼部区域的填充度和该眼眶区域的亮度特征确定。
本发明实施例中,当一种掩膜图像定位异常眼部区域失败时,提取眼眶区域的另一种掩膜图像,进而确定异常眼部区域,能够提高异常眼部区域定位的准确性。
可选地,获取单元502还可对第一掩膜图像进行形态学操作以移除所述第一掩膜图像的孤立点。
可选地,该第一候选异常眼部区域的置信度s用公式(5.1)表示:
s=c+β*gray        公式(5.1),
其中c表示该第一候选异常眼部区域的填充度,gray表示该眼眶区域的亮度特征,β表示该眼眶区域的亮度特征在置信度中的比例因子;
该第一候选异常眼部区域的填充度c用公式(5.2)表示:
c=sp/(π*radius*radius)   公式(5.2),
其中,sp表示该第一候选异常眼部区域的像素个数,radius表示该第一候 选异常眼部区域的原始半径;
该眼眶区域的亮度特征gray用公式(5.3)表示:
gray=(α*gray4-gray2)/(α*gray4)          公式(5.3),
其中,gray4表示该眼眶区域的平均亮度,gray2表示该第一候选异常眼部区域以外预定个像素范围内区域的平均亮度,或者gray2表示该第一候选异常眼部区域以外预定个像素范围以内的参考点的平均亮度,α表示该眼眶区域的平均亮度在该眼眶区域的亮度特征的比例因子。
可选地,作为一个实施例,获取单元502具体用于获取该眼眶区域的亮度信息;根据该眼眶区域的亮度信息获取该眼眶区域的边缘强度图像;对该边缘强度图像进行二值聚类分割以获取该眼眶区域的第一掩膜图像。具体地,在用于根据该眼眶区域的亮度信息获取该眼眶区域的边缘强度图像,获取单元502具体用于对该眼眶区域进行高斯模糊处理,根据sobel算子对该进行高斯模糊处理后的眼眶区域进行soble边缘强度提取以获取该眼眶区域的边缘强度图像;在用于对该边缘强度图像进行二值聚类分割以获取该眼眶区域的第一掩膜图像,获取单元502具体用于获取使得该眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第一阈值,将小于第一阈值的边缘强度设为第一阈值,并获取使得该眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第二阈值,并根据该第二阈值对该眼眶区域的边缘强度图像进行二值化以获取该眼眶区域的第一掩膜图像,其中边缘强度小于第二阈值的像素的掩膜图像信息取值为0,边缘强度大于或等于第二阈值的像素的掩膜图像信息取值为1。
进一步地,图形处理装置500还包括选择单元503和图形处理单元504。其中,选择单元503用于如果该异常眼部区域的原始半径的值大于该眼眶区域中异常眼部区域的最小经验半径乘以第一预定系数后的值,则从该异常眼部区域之外选择至少一个候选参考点。确定单元501还用于根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参 考点的YUV参考值;如果该参考点的YUV参考值对应的像素不是红色像素,则图形处理单元504用于根据该参考点的YUV参考值调整该异常眼部区域的外亮点区域,根据该异常眼部区域的内亮点区域的亮度平均值调整该异常眼部区域的内亮点区域,其中该内亮点区域以该异常眼部区域的中心点为圆心,以该异常眼部区域的最佳亮点半径为半径,该外亮点区域为该异常眼部区域中该内亮点区域以外的区域。图形处理单元504还用于对该异常眼部区域进行平滑处理。具体地,图形处理单元504可通过高斯模糊处理对该异常眼部区域进行平滑处理。
优选的,该最小经验半径用以下公式确定:minRad=width/60+2,其中,minRad表示该最小经验半径,width表示该异常眼部区域所在的眼眶区域的宽度。
优选的,该第一预定系数为1.25。
具体地,该异常眼部区域的最佳亮点半径用以下公式确定:optR=(maxR-minR)*(eyedistance-100)/500+minR,其中,optR表示该异常眼部区域的最佳亮点半径,maxR表示估算出的该异常眼部区域的最佳亮点半径的最大值,minR表示估算出的该异常眼部区域的最佳亮点半径的最小值,eyedistance表示该输入图像中两个眼睛中心的距离。
具体地,在用于根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值,确定单元501具体可实现为:获取该至少一个候选参考点中部分或全部候选参考点的YUV数据的平均值;如果该平均值对应的亮度值大于预定的阈值,则确定预定的参考值作为该异常眼部区域的参考点的参考值,否则以该平均值作为该异常眼部区域的参考点的参考值。
可选地,作为另一个实施例,获取单元502具体实现为:获取该眼眶区域的RGB信息;根据该眼眶区域的RGB信息对该眼眶区域进行二值分割以获取该眼眶区域的第一掩膜图像。
具体地,在用于根据该眼眶区域的RGB信息对该眼眶区域进行二值分割以获取该眼眶区域的第一掩膜图像,获取单元502具体实现为:将该眼眶区域中的红色像素对应的掩膜图像信息置为1,该眼眶区域中红色像素以外的像素对应的掩膜图像信息置为0,从而形成该第一掩膜图像。
进一步地,图形处理装置500还包括选择单元503和图形处理单元504,其中,选择单元503用于从该异常眼部区域以外选择至少一个候选参考点。确定单元501还用于根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值。如果该参考点的YUV参考值都符合预定的条件,则图形处理单元504根据该参考点的YUV参考值调整该异常眼部区域的外亮点区域,根据该异常眼部区域的内亮点区域的亮度平均值调整该异常眼部区域的内亮点区域,或者如果该参考点的YUV参考值不符合预定的条件,则图形处理单元504将该异常眼部区域的外亮点区域从YUV空间转换为HSV空间,并根据渐变因子调低该外亮点区域的像素在该HSV空间的H值,然后根据该异常眼部区域的内亮点区域的亮度平均值调整该异常眼部区域的内亮点区域。其中,该渐变因子随着该外亮点区域的像素距离该眼部区域中心的减小而减小,该内亮点区域以该异常眼部区域的中心点为圆心,以该异常眼部区域的最佳亮点半径为半径,该外亮点区域为该异常眼部区域中该内亮点区域以外的区域。图形处理单元504还用于对该异常眼部区域进行平滑处理。具体地,该预定的条件为:该参考点的YUV参考值对应于红色像素,并且该参考点的YUV亮度值乘以第二预定系数小于异常眼部区域的中间亮度值,并且异常眼部区域的亮度平均值小于预定亮度值。具体地,图形处理单元504可用高斯模糊处理对该异常眼部区域进行平滑处理。优选地,该第二预定系数取值为0.9,该预定亮度值取值为115。
具体地,该渐变因子用以下公式确定:factor=(fMax-fMin)*(distance-a*radius)/(radius-a*radius)+fMin,其中factor表示渐变衰减因子,radius表示所述异常眼部区域的原始半径,distance表示该外亮点区域的像素 到所述异常眼部区域的中心的距离,fMax表示factor的最大值,fMin表示factor的最小值,a表示渐变因子的距离系数。优选地,该渐变因子公式可表示为:factor=(0.4-0.1)*(distance–0.25*radius)/(radius–0.25*radius)+0.1,其中,fMax取值为0.4,fMin取值为0.1,a取值为0.25。
具体地,该异常眼部区域的最佳亮点半径用以下公式确定:optR=(maxR-minR)*(eyedistance-100)/500+minR,其中,optR表示该异常眼部区域的最佳亮点半径,maxR表示估算出的该异常眼部区域的最佳亮点半径的最大值,minR表示估算出的该异常眼部区域的最佳亮点半径的最小值,eyedistance表示该图像中两个眼睛中心的距离。
具体地,在用于根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值,确定单元501具体可实现为:获取该至少一个候选参考点中部分或全部候选参考点的YUV数据的平均值;如果该平均值对应的亮度值大于预定的阈值,则确定预定的参考值作为该异常眼部区域的参考点的参考值,否则以该平均值作为该异常眼部区域的参考点的参考值。
本发明实施例红色像素的一种判断方式,红色像素的RGB满足以下条件:max(r,g,b)>th1,且max(r,g,b)-g>th2,且max(r,g,b)/g>th3,其中,r表示RGB的三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th1、th2、th3分别表示红色像素的3个预定值。
本发明实施例红色像素的另一种判断方式,红色像素的RGB满足以下条件:r2/(g2+b2+th4)>th5,且r>th6,其中,r表示RGB的三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th4、th5、th6分别表示红色像素判定的3个预定值。
上述提取第一掩膜图像的方式也适用于提取第二掩膜图像,本发明实施 例在此不再赘述。
图形处理装置500还可执行图1的方法,并具备图形处理装置在图1、图3所示实施例中的功能,具体实现可参考图1、图3所示的具体实施例,本发明实施例在此不再赘述。
图6是本发明实施例图形处理装置600的结构示意图。图形处理装置600可包括:IO接口601、处理器602和存储器603。
IO接口601、处理器602和存储器603通过总线604系统相互连接。总线604可以是ISA总线、PCI总线或EISA总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图6中仅用一个双向箭头表示,但并不表示仅有一根总线或一种类型的总线。
存储器603,用于存放程序。具体地,程序可以包括程序代码,所述程序代码包括计算机操作指令。存储器603可以包括只读存储器和随机存取存储器,并向处理器602提供指令和数据。存储器603可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。
IO接口601,用于接收输入图像,并输出处理后的图像输出。
处理器602,执行存储器603所存放的程序,用于确定IO接口601接收的输入图像的眼眶区域,获取该眼眶区域的第一掩膜图像,根据该第一掩膜图像确定该眼眶区域的至少一个第一异常区域,根据该眼眶区域的第一掩膜图像确定该至少一个第一异常区域中的第一候选异常眼部区域,并在该第一候选异常眼部区域的置信度大于第七预定值时,确定该第一候选异常眼部区域为该眼眶区域中的异常眼部区域。
其中,该第一候选异常眼部区域满足该第一掩膜图像对应的异常眼部区域判断条件中的所有判断条件,该第一掩膜图像对应的异常眼部区域判断条件包括以下至少一个条件:该第一候选异常眼部区域的像素个数大于第一预定值,该第一候选异常眼部区域的圆度大于第二预定值且该第一候选异常眼 部区域的圆度小于第三预定值,该第一候选异常眼部区域的原始半径大于第四预定值,该第一候选异常眼部区域的填充度大于第五预定值,该第一候选异常眼部区域与该眼眶区域的像素比大于第六预定值,其中第一预定值为一个正整数,第二预定值为一个小于1的正数,第三预定值为一个大于1的正数,该第四预定值为一个正数,该第五预定值为一个正数,该第六预定值为一个正数。例如,第一预定值取值为60,第二预定值取值为0.6,第三预定值取值为1.6,第四预定值取值为30,第五预定值取值为0.65,第六预定值取值为0.08,等等。
另外该第一候选异常眼部区域的置信度由该第一候选异常眼部区域的填充度和该眼眶区域的亮度特征确定,该第一候选异常眼部区域的置信度用于表示第一候选异常眼部区域为眼眶区域的异常眼部区域的可信程度。
上述如本发明图1、图3任一实施例揭示的图形处理装置执行的方法可以应用于处理器602中,或者由处理器602实现。处理器602可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器602中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器602可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(DSP)、专用集成电路(ASIC)、现成可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本发明实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器603,处理器602读取存储器603中的信息,结合其硬件完成上述方法的步骤。
本发明实施例中,图形处理装置600通过对眼眶区域的掩膜图像进行分析获取候选异常眼部区域,并通过候选异常眼部区域的填充度和眼眶区域的亮度特征确定候选异常眼部区域的置信度,从而能够更准确地定位眼部图像的异常眼部区域,为异常眼部的处理提供了准确的位置信息。
可选地,处理器602还用于当该异常眼部区域未被找到时,获取该眼眶区域的第二掩膜图像,并根据该第二掩膜图像确定该眼眶区域的至少一个第二异常区域,其中该第二掩膜图像为金眼掩膜图像或红眼掩膜图像,该第二掩膜图像为二值掩膜图像,该第二掩膜图像不同于该第一掩膜图像;处理器602还用于根据该第二掩膜图像对应的异常眼部区域判断条件确定该至少一个第二异常区域中的第二候选异常眼部区域,并且当该第二候选异常眼部区域的置信度大于第十四预定值时,确定该第二候选异常眼部区域为该眼眶区域的异常眼部区域,其中该第二候选异常眼部区域满足该第二掩膜图像对应的异常眼部区域判断条件中的所有判断条件,该第二掩膜图像对应的异常眼部区域判断条件包括以下至少一个条件:该第二候选异常眼部区域的像素个数大于第八预定值,该第二候选异常眼部区域的圆度大于第九预定值且该第二候选异常眼部区域的圆度小于第十预定值,该第二候选异常眼部区域的原始半径大于第十一预定值,该第二候选异常眼部区域的填充度大于第十二预定值,该第二候选异常眼部区域与该眼眶区域的像素比大于第十三预定值,其中第八预定值为一个正整数,第九预定值为一个小于1的正数,第十预定值为一个大于1的正数,该第十一预定值为一个正数,该第十二预定值为一个正数,该第十三预定值为一个正数,该第二候选异常眼部区域的置信度由该第二候选异常眼部区域的填充度和该眼眶区域的亮度特征确定。
本发明实施例中,当一种掩膜图像定位异常眼部区域失败时,提取眼部区域的另一种掩膜图像,进而确定异常眼部区域,能够提高异常眼部区域定位的准确性。
可选地,处理器602还可对第一掩膜图像进行形态学操作以移除所述第 一掩膜图像的孤立点。
可选地,该第一候选异常眼部区域的置信度s用公式(6.1)表示:
s=c+β*gray           公式(6.1),
其中c表示该第一候选异常眼部区域的填充度,gray表示该眼眶区域的亮度特征,β表示该眼眶区域的亮度特征在置信度中的比例因子;
该第一候选异常眼部区域的填充度c用公式(6.2)表示:
c=sp/(π*radius*radius)           公式(6.2),
其中,sp表示该第一候选异常眼部区域的像素个数,radius表示该第一候选异常眼部区域的原始半径;
该眼眶区域的亮度特征gray用公式(6.3)表示:
gray=(α*gray4-gray2)/(α*gray4)            公式(6.3),
其中,gray4表示该眼眶区域的平均亮度,gray2表示该第一候选异常眼部区域以外预定个像素范围内区域的平均亮度,或者gray2表示该第一候选异常眼部区域以外预定个像素范围以内的参考点的平均亮度,α表示该眼眶区域的平均亮度在该眼眶区域的亮度特征的比例因子。
可选地,作为一个实施例,在用于获取该眼眶区域的第一掩膜图像,处理器602具体用于获取该眼眶区域的亮度信息;根据该眼眶区域的亮度信息获取该眼眶区域的边缘强度图像;对该边缘强度图像进行二值聚类分割以获取该眼眶区域的第一掩膜图像。具体地,在用于根据该眼眶区域的亮度信息获取该眼眶区域的边缘强度图像,处理器602具体用于对该眼眶区域进行高斯模糊处理,根据sobel算子对该进行高斯模糊处理后的眼眶区域进行soble边缘强度提取以获取该眼眶区域的边缘强度图像;在用于对该边缘强度图像进行二值聚类分割以获取该眼眶区域的第一掩膜图像,处理器602具体用于获取使得该眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第一阈值,将小于第一阈值的边缘强度设为第一阈值,并获取使得该眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第二阈值,并根据该第二阈 值对该眼眶区域的边缘强度图像进行二值化以获取该眼眶区域的第一掩膜图像,其中边缘强度小于第二阈值的像素的掩膜图像信息取值为0,边缘强度大于或等于第二阈值的像素的掩膜图像信息取值为1。
进一步地,处理器602还用于如果该异常眼部区域的原始半径的值大于该眼眶区域中异常眼部区域的最小经验半径乘以第一预定系数后的值,则从该异常眼部区域之外选择至少一个候选参考点,并根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值。如果如果该参考点的YUV参考值对应的像素不是红色像素,则处理器602还用于根据该参考点的YUV参考值调整该异常眼部区域的外亮点区域,根据该异常眼部区域的内亮点区域的亮度平均值调整该异常眼部区域的内亮点区域,并对该异常眼部区域进行平滑处理。其中该内亮点区域以该异常眼部区域的中心点为圆心,以该异常眼部区域的最佳亮点半径为半径,该外亮点区域为该异常眼部区域中该内亮点区域以外的区域。具体地,则处理器602可通过高斯模糊处理对该异常眼部区域进行平滑处理。
优选的,该最小经验半径用以下公式确定:minRad=width/60+2,其中,minRad表示该最小经验半径,width表示该异常眼部区域所在的眼眶区域的宽度。
优选的,该第一预定系数为1.25。
具体地,该异常眼部区域的最佳亮点半径用以下公式确定:optR=(maxR-minR)*(eyedistance-100)/600+minR,其中,optR表示该异常眼部区域的最佳亮点半径,maxR表示估算出的该异常眼部区域的最佳亮点半径的最大值,minR表示估算出的该异常眼部区域的最佳亮点半径的最小值,eyedistance表示该输入图像中两个眼睛中心的距离。
具体地,在用于根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值,处理器602具体可实现为:获取该至少一个候选参考点中部分或全部候选参考点的YUV数据的 平均值;如果该平均值对应的亮度值大于预定的阈值,则确定预定的参考值作为该异常眼部区域的参考点的参考值,否则以该平均值作为该异常眼部区域的参考点的参考值。
可选地,作为另一个实施例,在用于获取该眼眶区域的第一掩膜图像,处理器602具体实现为:获取该眼眶区域的RGB信息;根据该眼眶区域的RGB信息对该眼眶区域进行二值分割以获取该眼眶区域的第一掩膜图像。具体地,在用于根据该眼眶区域的RGB信息对该眼眶区域进行二值分割以获取该眼眶区域的第一掩膜图像,处理器602具体实现为:将该眼眶区域中的红色像素对应的掩膜图像信息置为1,该眼眶区域中红色像素以外的像素对应的掩膜图像信息置为0,从而形成该第一掩膜图像。
进一步地,处理器602还用于从该异常眼部区域以外选择至少一个候选参考点,并根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值。如果该参考点的YUV参考值都符合预定的条件,则处理器602还用于根据该参考点的YUV参考值调整该异常眼部区域的外亮点区域,并根据该异常眼部区域的内亮点区域的亮度平均值调整该异常眼部区域的内亮点区域;或者如果该参考点的YUV参考值不符合预定的条件,则处理器602还用于将该异常眼部区域的外亮点区域从YUV空间转换为HSV空间,并根据渐变因子调低该外亮点区域的像素在该HSV空间的H值,然后根据该异常眼部区域的内亮点区域的亮度平均值调整该异常眼部区域的内亮点区域,并对该异常眼部区域进行平滑处理。其中,该渐变因子随着该外亮点区域的像素距离该眼部区域中心的减小而减小,该内亮点区域以该异常眼部区域的中心点为圆心,以该异常眼部区域的最佳亮点半径为半径,该外亮点区域为该异常眼部区域中该内亮点区域以外的区域。具体地,该预定的条件为:该参考点的YUV参考值对应于红色像素,并且该参考点的YUV亮度值乘以第二预定系数小于异常眼部区域的中间亮度值,并且异常眼部区域的亮度平均值小于预定亮度值。具体地,则处理器602可用 高斯模糊处理对该异常眼部区域进行平滑处理。优选地,该第二预定系数取值为0.9,该预定亮度值取值为115。
可选地,该渐变因子用以下公式确定:factor=(fMax-fMin)*(distance-a*radius)/(radius-a*radius)+fMin,其中factor表示渐变衰减因子,radius表示该异常眼部区域的原始半径,distance表示该外亮点区域的像素到该异常眼部区域的中心的距离,fMax表示factor的最大值,fMin表示factor的最小值,a表示渐变因子的距离系数。优选地,该渐变因子公式可表示为:factor=(0.4-0.1)*(distance–0.25*radius)/(radius–0.25*radius)+0.1,其中,fMax取值为0.4,fMin取值为0.1,a取值为0.25。
具体地,该异常眼部区域的最佳亮点半径用以下公式确定:optR=(maxR-minR)*(eyedistance-100)/600+minR,其中,optR表示该异常眼部区域的最佳亮点半径,maxR表示估算出的该异常眼部区域的最佳亮点半径的最大值,minR表示估算出的该异常眼部区域的最佳亮点半径的最小值,eyedistance表示该输入图像中两个眼睛中心的距离。
具体地,在用于根据该至少一个候选参考点中部分或全部候选参考点的YUV数据确定该异常眼部区域的参考点的YUV参考值,处理器602具体可实现为:获取该至少一个候选参考点中部分或全部候选参考点的YUV数据的平均值;如果该平均值对应的亮度值大于预定的阈值,则确定预定的参考值作为该异常眼部区域的参考点的参考值,否则以该平均值作为该异常眼部区域的参考点的参考值。
本发明实施例红色像素的一种判断方式,红色像素的RGB满足以下条件:max(r,g,b)>th1,且max(r,g,b)-g>th2,且max(r,g,b)/g>th3,其中,r表示RGB的三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th1、th2、th3分别表示红色像素的3个预定值。
本发明实施例红色像素的另一种判断方式,红色像素的RGB满足以下条 件:r2/(g2+b2+th4)>th5,且r>th6,其中,r表示RGB的三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th4、th5、th6分别表示红色像素判定的3个预定值。
上述提取第一掩膜图像的方式也适用于提取第二掩膜图像,本发明实施例在此不再赘述。
图形处理装置600还可执行图1的方法,并具备图形处理装置在图1、图3所示实施例中的功能,具体实现可参考图1、图3所示的具体实施例,本发明实施例在此不再赘述。
可以理解的是,本发明实施例中提到的图形处理装置可以为终端设备,例如可以为移动电话、平板电脑等。也可以是便携式、袖珍式、手持式、计算机内置的或者车载的终端设备等。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。本领域普通技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合 或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。

Claims (34)

  1. 一种眼部图像处理方法,其特征在于,包括:
    确定输入图像的眼眶区域;
    获取所述眼眶区域的第一掩膜图像,其中,所述第一掩膜图像为金眼掩膜图像或红眼掩膜图像,所述第一掩膜图像为二值掩膜图像;
    根据所述第一掩膜图像确定所述眼眶区域的至少一个第一异常区域;
    根据所述第一掩膜图像对应的异常眼部区域判断条件确定所述至少一个第一异常区域中的第一候选异常眼部区域,其中所述第一候选异常眼部区域满足所述第一掩膜图像对应的异常眼部区域判断条件中的所有判断条件,所述第一掩膜图像对应的异常眼部区域判断条件包括以下至少一个条件:所述第一候选异常眼部区域的像素个数大于第一预定值,所述第一候选异常眼部区域的圆度大于第二预定值且所述第一候选异常眼部区域的圆度小于第三预定值,所述第一候选异常眼部区域的原始半径大于第四预定值,所述第一候选异常眼部区域的填充度大于第五预定值,所述第一候选异常眼部区域与所述眼眶区域的像素比大于第六预定值,其中第一预定值为一个正整数,第二预定值为一个小于1的正数,第三预定值为一个大于1的正数,所述第四预定值为一个正数,所述第五预定值为一个正数,所述第六预定值为一个正数;
    当所述第一候选异常眼部区域的置信度大于第七预定值时,确定所述第一候选异常眼部区域为所述眼眶区域中的异常眼部区域,所述第一候选异常眼部区域的置信度由所述第一候选异常眼部区域的填充度和所述眼眶区域的亮度特征确定。
  2. 如权利要求1所述的方法,其特征在于,还包括:
    当所述异常眼部区域未被找到时,获取所述眼眶区域的第二掩膜图像,所述第二掩膜图像为金眼掩膜图像或红眼掩膜图像,其中所述第二掩膜图像为二值掩膜图像,所述第二掩膜图像不同于所述第一掩膜图像;
    根据所述第二掩膜图像确定所述眼眶区域的至少一个第二异常区域;
    根据所述第二掩膜图像对应的异常眼部区域判断条件确定所述至少一个第二异常区域中的第二候选异常眼部区域,其中所述第二候选异常眼部区域满足所述第二掩膜图像对应的异常眼部区域判断条件中的所有判断条件,所述第二掩膜图像对应的异常眼部区域判断条件包括以下至少一个条件:所述第二候选异常眼部区域的像素个数大于第八预定值,所述第二候选异常眼部区域的圆度大于第九预定值且所述第二候选异常眼部区域的圆度小于第十预定值,所述第二候选异常眼部区域的原始半径大于第十一预定值,所述第二候选异常眼部区域的填充度大于第十二预定值,所述第二候选异常眼部区域与所述眼眶区域的像素比大于第十三预定值,其中第八预定值为一个正整数,第九预定值为一个小于1的正数,第十预定值为一个大于1的正数,所述第十一预定值为一个正数,所述第十二预定值为一个正数,所述第十三预定值为一个正数;
    当所述第二候选异常眼部区域的置信度大于第十四预定值时,确定所述第二候选异常眼部区域为所述眼眶区域中的异常眼部区域。
  3. 如权利要求1或2所述的方法,其特征在于,
    所述第一候选异常眼部区域的置信度s用以下公式表示,
    s=c+β*gray,
    其中,β表示所述眼眶区域的亮度特征在所述置信度中的比例因子,gray表示所述眼眶区域的亮度特征,gray=(α*gray4-gray2)/(α*gray4),c表示所述第一候选异常眼部区域的填充度,c=sp/(π*radius*radius),其中,gray4表示所述眼眶区域的平均亮度,α表示所述眼眶区域的平均亮度在所述眼眶区域的亮度特征的比例因子,gray2表示所述第一候选异常眼部区域以外预定个像素范围以内的区域的平均亮度,或者gray2表示所述第一候选异常眼部区域以外预定个像素范围以内的若干个参考点的平均亮度,sp表示所述第一候选异常眼部区域的像素个数,radius表示所述第一候选异常眼部区域的原始半径。
  4. 如权利要求1至3任一项所述的方法,其特征在于,所述获取所述眼眶 区域的第一掩膜图像包括:
    获取所述眼眶区域的亮度信息;
    根据所述眼眶区域的亮度信息获取所述眼眶区域的边缘强度图像;
    对所述边缘强度图像进行二值聚类分割以获取所述眼眶区域的第一掩膜图像。
  5. 如权利要求4所述的方法,其特征在于,
    所述根据所述眼眶区域的亮度信息获取所述眼眶区域的边缘强度图像包括:
    对所述眼眶区域进行高斯模糊处理,根据同性sobel算子对所述进行高斯模糊处理后的眼眶区域进行soble边缘强度提取以获取所述眼眶区域的边缘强度图像;
    所述对所述边缘强度图像进行二值聚类分割以获取所述眼眶区域的第一掩膜图像包括:获取使得所述眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第一阈值,将小于第一阈值的边缘强度设为第一阈值,并获取使得所述眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第二阈值,并根据所述第二阈值对所述眼眶区域的边缘强度图像进行二值化以获取所述眼眶区域的第一掩膜图像,其中边缘强度小于第二阈值的像素的掩膜图像信息取值为0,边缘强度大于或等于第二阈值的像素的掩膜图像信息取值为1。
  6. 如权利要求4或5所述的方法,其特征在于,所述方法还包括:
    如果所述异常眼部区域的原始半径的值大于所述眼眶区域中异常眼部区域的最小经验半径乘以第一预定系数后的值,则从所述异常眼部区域之外选择至少一个候选参考点;
    根据所述至少一个候选参考点中部分或全部候选参考点的YUV数据确定所述异常眼部区域的参考点的YUV参考值;
    如果所述参考点的YUV参考值对应的像素不是红色像素,则根据所述参考点的YUV参考值调整所述异常眼部区域的外亮点区域,根据所述异常眼部区域 的内亮点区域的亮度平均值调整所述异常眼部区域的内亮点区域,其中所述内亮点区域以所述异常眼部区域的中心点为圆心,以所述异常眼部区域的最佳亮点半径为半径,所述外亮点区域为所述异常眼部区域中所述内亮点区域以外的区域;
    对所述异常眼部区域进行平滑处理。
  7. 如权利要求6所述的方法,其特征在于,
    所述眼眶区域中异常眼部区域的最小经验半径用以下公式确定:
    minRad=width/50+2,
    其中,minRad表示所述眼眶区域中异常眼部区域的最小经验半径,width表示所述眼眶区域的宽度。
  8. 如权利要求6或7所述的方法,其特征在于,所述第一预定系数取值为1.25。
  9. 如权利要求1至3任一项所述的方法,其特征在于,所述获取所述眼眶区域的第一掩膜图像包括:
    获取所述眼眶区域的RGB信息;
    根据所述眼眶区域的RGB信息对所述眼眶区域进行二值分割以获取所述眼眶区域的第一掩膜图像。
  10. 如权利要求9所述的方法,其特征在于,所述根据所述眼眶区域的RGB信息对所述眼眶区域进行二值分割以获取所述眼眶区域的第一掩膜图像包括:
    将所述眼眶区域中的红色像素对应的掩膜图像信息置为1,所述眼眶区域中红色像素以外的像素对应的掩膜图像信息置为0,从而形成所述第一掩膜图像。
  11. 如权利要求9或10所述的方法,其特征在于,所述方法还包括:
    从所述异常眼部区域以外选择至少一个候选参考点;
    根据所述至少一个候选参考点中部分或全部候选参考点的YUV数据确定所述异常眼部区域的参考点的YUV参考值;
    如果所述参考点的YUV参考值符合预定的条件,则根据所述参考点的YUV 参考值调整所述异常眼部区域的外亮点区域,根据所述异常眼部区域的内亮点区域的亮度平均值调整所述异常眼部区域的内亮点区域,或者
    如果所述参考点的YUV参考值不符合预定的条件,则将所述异常眼部区域的外亮点区域从YUV空间转换为HSV空间,并根据渐变因子调低所述外亮点区域的像素在HSV空间的亮度H值,然后根据所述异常眼部区域的内亮点区域像素的亮度平均值调整所述异常眼部区域的内亮点区域,所述渐变因子随着所述外亮点区域的像素与所述异常眼部区域中心的距离的减小而减小;
    对所述异常眼部区域进行平滑处理;
    其中,所述内亮点区域以所述异常眼部区域的中心点为圆心,以所述异常眼部区域的最佳亮点半径为半径,所述外亮点区域为所述异常眼部区域中所述内亮点区域以外的区域,所述预定的条件为:所述参考点的YUV参考值对应的像素是红色像素,并且所述参考点的YUV亮度值乘以第二预定系数后的值小于所述异常眼部区域的中间亮度值,并且所述异常眼部区域的亮度平均值小于预定亮度值。
  12. 如权利要求11所述的方法,其特征在于,所述第二预定系数取值为0.9,所述预定亮度值取值为115。
  13. 如权利要求11所述的方法的,其特征在于,所述渐变因子factor用以下公式确定:
    factor=(fMax-fMin)*(distance-a*radius)/(radius-a*radius)+fMin,
    其中radius表示所述异常眼部区域的原始半径,distance表示所述外亮点区域的像素到所述异常眼部区域中心的距离,fMax表示factor的最大值,fMin表示factor的最小值,a表示所述渐变因子的距离系数。
  14. 如权利要求13所述的方法,其特征在于,所述渐变因子公式具体实现为:
    factor=(0.4-0.1)*(distance–0.25*radius)/(radius–0.25*radius)+0.1,其中,fMax取值为0.4,fMin取值为0.1,a取值为0.25。
  15. 如权利要求6或11所述的方法,其特征在于,所述异常眼部区域的最佳亮点半径optR用以下公式确定:
    optR=(maxR-minR)*(eyedistance-100)/400+minR,
    其中,maxR表示估算出的所述异常眼部区域的最佳亮点半径的最大值,minR表示估算出的所述异常眼部区域的最佳亮点半径的最小值,eyedistance表示所述输入图像中两个眼睛中心的距离。
  16. 如权利要求6或11述的方法,其特征在于,所述根据所述至少一个候选参考点中部分或全部候选参考点的YUV数据确定所述异常眼部区域的参考点的YUV参考值包括:
    获取所述至少一个候选参考点中部分或全部候选参考点的YUV数据的平均值;
    如果所述平均值对应的亮度值大于预定的阈值,则确定预定的参考值作为所述异常眼部区域的参考点的参考值,否则以所述平均值作为所述异常眼部区域的参考点的参考值。
  17. 如权利要求10所述的方法,其特征在于,
    所述红色像素的RGB满足以下条件:max(r,g,b)>th1,且max(r,g,b)-g>th2,且max(r,g,b)/g>th3,其中,r表示RGB的三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th1、th2、th3分别表示红色像素的3个预定值;或者
    所述红色像素的RGB满足以下条件:r2/(g2+b2+th4)>th5,且r>th6,其中,r表示RGB的三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th4、th5、th6分别表示红色像素判定的3个预定值。
  18. 一种图形处理装置,其特征在于,包括:
    确定单元,用于确定输入图像的眼眶区域;
    获取单元,用于获取所述眼眶区域的第一掩膜图像,并根据所述第一掩膜图像确定所述眼眶区域的至少一个第一异常区域,其中所述第一掩膜图像为金眼掩膜图像或红眼掩膜图像,所述第一掩膜图像为二值掩膜图像;
    所述确定单元还用于根据所述第一掩膜图像对应的异常眼部区域判断条件确定所述至少一个第一异常区域中的第一候选异常眼部区域,其中所述第一候选异常眼部区域满足所述第一掩膜图像对应的异常眼部区域判断条件中的所有判断条件,所述第一掩膜图像对应的异常眼部区域判断条件包括以下至少一个条件:所述第一候选异常眼部区域的像素个数大于第一预定值,所述第一候选异常眼部区域的圆度大于第二预定值且所述第一候选异常眼部区域的圆度小于第三预定值,所述第一候选异常眼部区域的原始半径大于第四预定值,所述第一候选异常眼部区域的填充度大于第五预定值,所述第一候选异常眼部区域与所述眼眶区域的像素比大于第六预定值,其中第一预定值为一个正整数,第二预定值为一个小于1的正数,第三预定值为一个大于1的正数,所述第四预定值为一个正数,所述第五预定值为一个正数,所述第六预定值为一个正数;
    所述确定单元还用于当所述第一候选异常眼部区域的置信度大于第七预定值时确定所述第一候选异常眼部区域为所述眼眶区域中的异常眼部区域,所述第一候选异常眼部区域的置信度由所述第一候选异常眼部区域的填充度和所述眼眶区域的亮度特征确定。
  19. 如权利要求18所述的装置,其特征在于,
    所述获取单元还用于当所述异常眼部区域未被找到时,获取所述眼眶区域的第二掩膜图像,并根据所述第二掩膜图像确定所述眼眶区域的至少一个第二异常区域,其中所述第二掩膜图像为金眼掩膜图像或红眼掩膜图像,所述第二掩膜图像为二值掩膜图像,所述第二掩膜图像不同于所述第一掩膜图像;
    所述确定单元还用于根据所述第二掩膜对应的异常眼部区域判断条件确定所述至少一个第二异常区域中的第二候选异常眼部区域,其中所述第二候选异常眼部区域满足所述第二掩膜图像对应的异常眼部区域判断条件中的所有判断 条件,所述第二掩膜图像对应的异常眼部区域判断条件包括以下至少一个条件:所述第二候选异常眼部区域的像素个数大于第八预定值,所述第二候选异常眼部区域的圆度大于第九预定值且所述第二候选异常眼部区域的圆度小于第十预定值,所述第二候选异常眼部区域的原始半径大于第十一预定值,所述第二候选异常眼部区域的填充度大于第十二预定值,所述第二候选异常眼部区域与所述眼眶区域的像素比大于第十三预定值,其中第八预定值为一个正整数,第九预定值为一个小于1的正数,第十预定值为一个大于1的正数,所述第十一预定值为一个正数,所述第十二预定值为一个正数,所述第十三预定值为一个正数;
    所述确定单元还用于当所述第二候选异常眼部区域的置信度大于第十四预定值时确定所述第二候选异常眼部区域为所述眼眶区域中的异常眼部区域。
  20. 如权利要求18或19所述的装置,其特征在于,
    所述第一候选异常眼部区域的置信度s用以下公式确定,
    s=c+β*gray,
    其中,β表示所述眼眶区域的亮度特征在所述置信度中的比例因子,gray表示所述眼眶区域的亮度特征,gray=(α*gray4-gray2)/(α*gray4),c表示所述第一候选异常眼部区域的填充度,c=sp/(π*radius*radius),其中,gray4表示所述眼眶区域的平均亮度,α表示所述眼眶区域的平均亮度在所述眼眶区域的亮度特征的比例因子,gray2表示所述第一候选异常眼部区域以外预定个像素范围以内的区域的平均亮度,或者gray2表示所述第一候选异常眼部区域以外预定个像素范围以内的若干个参考点的平均亮度,sp表示所述第一候选异常眼部区域的像素个数,radius表示所述第一候选异常眼部区域的原始半径。
  21. 如权利要求18至20任一项所述的装置,其特征在于,所述获取单元具体用于:
    获取所述眼眶区域的亮度信息;
    根据所述眼眶区域的亮度信息获取所述眼眶区域的边缘强度图像;
    对所述边缘强度图像进行二值聚类分割以获取所述眼眶区域的第一掩膜图像。
  22. 如权利要求21所述的装置,其特征在于,
    在用于根据所述眼眶区域的亮度信息获取所述眼眶区域的边缘强度图像,所述获取单元具体用于:对所述眼眶区域进行高斯模糊处理,根据同性sobel算子对所述进行高斯模糊处理后的眼眶区域进行soble边缘强度提取以获取所述眼眶区域的边缘强度图像;
    在用于对所述边缘强度图像进行二值聚类分割以获取所述眼眶区域的第一掩膜图像,所述获取单元具体用于:获取使得所述眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第一阈值,将小于第一阈值的边缘强度设为第一阈值,并获取使得所述眼眶区域的边缘强度图像按阈值分成两类后类间方差最大的第二阈值,并根据所述第二阈值对所述眼眶区域的边缘强度图像进行二值化以获取所述眼眶区域的第一掩膜图像,其中边缘强度小于第二阈值的像素的掩膜图像信息取值为0,边缘强度大于或等于第二阈值的像素的掩膜图像信息取值为1。
  23. 如权利要求21或22所述的装置,其特征在于,还包括:选择单元和图形处理单元,其中
    所述选择单元用于如果所述异常眼部区域的原始半径的值大于所述眼眶区域中眼部区域的最小经验半径乘以第一预定系数的值,则从所述异常眼部区域之外选择至少一个候选参考点;
    所述确定单元还用于根据所述至少一个候选参考点中部分或全部候选参考点的YUV数据确定所述异常眼部区域的参考点的YUV参考值;所述图形处理单元用于如果所述参考点的YUV参考值对应的像素不是红色像素,则根据所述参考点的YUV参考值调整所述异常眼部区域的外亮点区域,根据所述异常眼部区域的内亮点区域的亮度平均值调整所述异常眼部区域的内亮点区域,其中所述内亮点区域以所述异常眼部区域的中心点为圆心,以所述异 常眼部区域的最佳亮点半径为半径,所述外亮点区域为所述异常眼部区域中所述内亮点区域以外的区域;
    所述图形处理单元还用于对所述异常眼部区域进行平滑处理。
  24. 如权利要求23所述的装置,其特征在于,
    所述眼眶区域中异常眼部区域的最小经验半径用以下公式确定:minRad=width/50+2,
    其中,minRad表示所述眼眶区域中异常眼部区域的最小经验半径,width表示所述眼眶区域的宽度。
  25. 如权利要求23或24所述的装置,其特征在于,所述第一预定系数为1.25。
  26. 如权利要求20至22任一项所述的装置,其特征在于,所述获取单元具体用于:
    获取所述眼眶区域的RGB信息;
    根据所述眼眶区域的RGB信息对所述眼眶区域进行二值分割以获取所述眼眶区域的第一掩膜图像。
  27. 如权利要求26所述的装置,其特征在于,在用于根据所述眼眶区域的RGB信息对所述眼眶区域进行二值分割以获取所述眼眶区域的第一掩膜图像,所述获取单元具体用于:将所述眼眶区域中的红色像素对应的掩膜图像信息置为1,所述眼眶区域中红色像素以外的像素对应的掩膜图像信息置为0,从而形成所述第一掩膜图像。
  28. 如权利要求26或27所述的装置,其特征在于,还包括:选择单元和图形处理单元,其中,
    所述选择单元用于从所述异常眼部区域以外选择至少一个候选参考点;
    所述确定单元还用于根据所述至少一个候选参考点中部分或全部候选参考点的YUV数据确定所述异常眼部区域的参考点的YUV参考值;
    所述图形处理单元用于如果所述参考点的YUV参考值符合预定的条件,则 根据所述参考点的YUV参考值调整所述异常眼部区域的外亮点区域,根据所述异常眼部区域的内亮点区域的亮度平均值调整所述异常眼部区域的内亮点区域,或者
    所述图形处理单元用于如果所述参考点的YUV参考值不符合预定的条件,则将所述异常眼部区域的外亮点区域从YUV空间转换为HSV空间,并根据渐变因子调低所述外亮点区域的像素在HSV空间的亮度H值,然后根据所述异常眼部区域的内亮点区域像素的亮度平均值调整所述异常眼部区域的内亮点区域,所述渐变因子随着所述外亮点区域的像素与所述异常眼部区域中心的距离的减小而减小,
    其中,所述内亮点区域以所述异常眼部区域的中心点为圆心,以所述异常眼部区域的最佳亮点半径为半径,所述外亮点区域为所述异常眼部区域中所述内亮点区域以外的区域,所述预定的条件为:所述参考点的YUV参考值对应的像素是红色像素,并且所述参考点的YUV亮度值乘以第二预定系数后的值小于所述异常眼部区域的中间亮度值,并且所述异常眼部区域的亮度平均值小于预定亮度值;
    所述图形处理单元还用于对所述异常眼部区域进行平滑处理。
  29. 如权利要求28所述的装置,其特征在于,所述第二预定系数取值为0.9,所述预定亮度值取值为115。
  30. 如权利要求28所述的装置,其特征在于,所述渐变因子factor用以下公式确定:
    factor=(fMax-fMin)*(distance-a*radius)/(radius-a*radius)+fMin,
    其中radius表示所述异常眼部区域的原始半径,distance表示所述外亮点区域的像素到所述异常眼部区域中心的距离,fMax表示factor的最大值,fMin表示factor的最小值,a表示所述渐变因子的距离系数。
  31. 如权利要求30所述的装置,其特征在于,所述渐变因子公式具体实现为:factor=(0.4-0.1)*(distance–0.25*radius)/(radius–0.25*radius)+ 0.1,其中,fMax取值为0.4,fMin取值为0.1,a取值为0.25
  32. 如权利要求23或28所述的装置,其特征在于,所述异常眼部区域的最佳亮点半径optR用以下公式确定:
    optR=(maxR-minR)*(eyedistance-100)/400+minR,
    其中,maxR表示估算出的所述异常眼部区域的最佳亮点半径的最大值,minR表示估算出的所述异常眼部区域的最佳亮点半径的最小值,eyedistance表示所述输入图像中两个眼睛中心的距离。
  33. 如权利要求23或28述的装置,其特征在于,在用于根据所述至少一个候选参考点中部分或全部候选参考点的YUV数据确定所述异常眼部区域的参考点的YUV参考值,所述确定单元具体用于:
    获取所述至少一个候选参考点中部分或全部候选参考点的YUV数据的平均值;
    如果所述平均值对应的亮度值大于预定的阈值,则确定预定的参考值作为所述异常眼部区域的参考点的参考值,否则以所述平均值作为所述异常眼部区域的参考点的参考值。
  34. 如权利要求27述的装置,其特征在于,
    所述红色像素的RGB满足以下条件:max(r,g,b)>th1,且max(r,g,b)-g>th2,且max(r,g,b)/g>th3,其中,r表示RGB的三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th1、th2、th3分别表示红色像素的3个预定值;或者
    所述红色像素的RGB满足以下条件:r2/(g2+b2+th4)>th5,且r>th6,其中,r表示RGB的三个颜色分量中的红色分量,g表示RGB的三个颜色分量中的绿色分量,b表示RGB的三个颜色分量中蓝色分量,th4、th5、th6分别表示红色像素判定的3个预定值。
PCT/CN2014/090454 2013-11-12 2014-11-06 眼部图像处理方法和装置 WO2015070723A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310559822.9 2013-11-12
CN201310559822.9A CN104637031B (zh) 2013-11-12 2013-11-12 眼部图像处理方法和装置

Publications (1)

Publication Number Publication Date
WO2015070723A1 true WO2015070723A1 (zh) 2015-05-21

Family

ID=53056757

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/090454 WO2015070723A1 (zh) 2013-11-12 2014-11-06 眼部图像处理方法和装置

Country Status (2)

Country Link
CN (1) CN104637031B (zh)
WO (1) WO2015070723A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109829921A (zh) * 2018-12-14 2019-05-31 清影医疗科技(深圳)有限公司 一种头部的ct图像的处理方法及其系统、设备、存储介质
CN110097502A (zh) * 2019-04-16 2019-08-06 深圳市莫廷影像技术有限公司 眼底无灌注区的测量方法及装置及图像处理方法

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105447874A (zh) * 2015-12-07 2016-03-30 温州医科大学眼视光器械有限公司 一种人眼出血图像检测装置
CN106210522B (zh) * 2016-07-15 2019-06-14 Oppo广东移动通信有限公司 一种图像处理方法、装置、移动终端及可读存储介质
CN107451998B (zh) * 2017-08-08 2020-11-06 北京大恒普信医疗技术有限公司 一种眼底图像质量控制方法
CN107895343B (zh) * 2017-12-31 2021-02-23 广州二元科技有限公司 一种基于五官定位快速简单上腮红的图像处理方法
CN108305267B (zh) * 2018-02-14 2020-08-11 北京市商汤科技开发有限公司 物体分割方法、装置、设备、存储介质及程序
CN108921854B (zh) * 2018-05-22 2022-06-21 复旦大学 一种消化道内镜图像不规则病变区域标注方法及系统
CN109636796A (zh) * 2018-12-19 2019-04-16 中山大学中山眼科中心 一种人工智能眼部图片分析方法、服务器和系统
CN111080580B (zh) * 2019-11-29 2023-06-09 山东大学 基于中智集合的超声乳腺肿瘤快速阈值分割方法及系统
CN111931772B (zh) * 2020-09-18 2021-02-09 平安科技(深圳)有限公司 医学图像处理方法、装置、设备及存储介质
CN116110574B (zh) 2023-04-14 2023-06-20 武汉大学人民医院(湖北省人民医院) 一种基于神经网络实现的眼科智能问诊方法和装置
CN116309549B (zh) * 2023-05-11 2023-10-03 爱尔眼科医院集团股份有限公司 一种眼底区域检测方法、装置、设备及可读存储介质
CN117714884B (zh) * 2023-08-31 2024-09-27 荣耀终端有限公司 目标追踪方法和电子设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030044177A1 (en) * 2001-09-03 2003-03-06 Knut Oberhardt Method for the automatic detection of red-eye defects in photographic image data
CN1635547A (zh) * 2003-12-29 2005-07-06 佳能株式会社 检测和校正图像中的红眼的方法
CN101454798A (zh) * 2006-03-30 2009-06-10 富士胶片株式会社 红眼检测仪器、红眼检测方法和红眼检测程序
CN103226690A (zh) * 2012-01-30 2013-07-31 展讯通信(上海)有限公司 检测红眼的方法及装置、去除红眼的方法及装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4537143B2 (ja) * 2004-07-30 2010-09-01 キヤノン株式会社 画像処理装置及びその方法、撮像装置、プログラム
JP4498224B2 (ja) * 2005-06-14 2010-07-07 キヤノン株式会社 画像処理装置およびその方法
CN100354875C (zh) * 2005-09-29 2007-12-12 上海交通大学 基于人脸检测的红眼去除方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030044177A1 (en) * 2001-09-03 2003-03-06 Knut Oberhardt Method for the automatic detection of red-eye defects in photographic image data
CN1635547A (zh) * 2003-12-29 2005-07-06 佳能株式会社 检测和校正图像中的红眼的方法
CN101454798A (zh) * 2006-03-30 2009-06-10 富士胶片株式会社 红眼检测仪器、红眼检测方法和红眼检测程序
CN103226690A (zh) * 2012-01-30 2013-07-31 展讯通信(上海)有限公司 检测红眼的方法及装置、去除红眼的方法及装置

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109829921A (zh) * 2018-12-14 2019-05-31 清影医疗科技(深圳)有限公司 一种头部的ct图像的处理方法及其系统、设备、存储介质
CN109829921B (zh) * 2018-12-14 2023-10-31 清影医疗科技(深圳)有限公司 一种头部的ct图像的处理方法及其系统、设备、存储介质
CN110097502A (zh) * 2019-04-16 2019-08-06 深圳市莫廷影像技术有限公司 眼底无灌注区的测量方法及装置及图像处理方法
CN110097502B (zh) * 2019-04-16 2022-03-15 深圳市莫廷影像技术有限公司 眼底无灌注区的测量方法及装置及图像处理方法

Also Published As

Publication number Publication date
CN104637031A (zh) 2015-05-20
CN104637031B (zh) 2017-08-29

Similar Documents

Publication Publication Date Title
WO2015070723A1 (zh) 眼部图像处理方法和装置
US7826659B2 (en) Image processing apparatus and method, computer program, and storage medium dividing an input image into band images
US8244003B2 (en) Image preprocessing
US8290267B2 (en) Detecting redeye defects in digital images
US8559708B2 (en) Image preprocessing
US7747071B2 (en) Detecting and correcting peteye
US8923612B2 (en) Image processing apparatus and method, and program
JP3810776B2 (ja) ディジタル画像中の赤目を検出し補正する方法
US8660323B2 (en) Image Preprocessing
WO2017121018A1 (zh) 二维码图像处理的方法和装置、终端、存储介质
JP3684017B2 (ja) 画像処理装置及び方法
US20080049970A1 (en) Automatic detection and correction of non-red eye flash defects
US20070286490A1 (en) Facial feature detection method and device
JP2007097178A (ja) 顔検出による赤目の除去方法
KR101631012B1 (ko) 화상 처리 장치 및 화상 처리 방법
KR20060129332A (ko) 화상중의 인물 후보 영역 추출 방법 및 인물 후보 영역 추출 시스템, 인물 후보 영역 추출 프로그램이 기록된 기록 매체, 및 인물 이미지의 상하 판정 방법 및 상하 판정 시스템, 상하 판정 프로그램이 기록된 기록 매체
US8244004B2 (en) Image preprocessing
JP2005165387A (ja) 画面のスジ欠陥検出方法及び装置並びに表示装置
JP7030425B2 (ja) 画像処理装置、画像処理方法、プログラム
EP1865443A2 (en) Facial feature detection method and device
CN113132705A (zh) 图像色边的校正方法、校正装置、电子设备及存储介质
CN112581380A (zh) 图像的色彩增强方法、装置和服务器
JP2015001967A (ja) エッジ検出装置およびエッジ検出方法
JP2009258771A (ja) 画像処理方法、画像処理装置、画像処理プログラム、撮像装置
WO2010149220A1 (en) An apparatus

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14862990

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14862990

Country of ref document: EP

Kind code of ref document: A1