Method, device, computer equipment and medium for determining face deflection angle
By identifying the feature information in the face image and the geometric relationship of the reference face image, the deflection angle of the face is calculated, which solves the problem of low efficiency of face deflection angle recognition in the existing technology, and realizes the detection on devices with limited hardware resources. Efficient identification and angle correction.
Patent Information
- Application Number
- CN202010797552.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-10
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2040-08-10
AI Technical Summary
The existing technology is inefficient in identifying the face deflection angle in face images, and it is especially difficult to achieve efficient recognition on devices with limited hardware resources.
By acquiring the face image, identifying the facial feature information (such as left pupil coordinates, right pupil coordinates, nose point coordinates and lip midpoint coordinates), and using geometric relationships to determine the deflection angle of the face, including the deflection angles in the horizontal and vertical directions. , calculate the deflection angle using the projection ratio and the reference angle, and provide a method and device for determining the deflection angle of the human face.
It improves the efficiency of identifying the face deflection angle in face images, and can easily identify the face deflection angle in face images on devices with less hardware resources, provides prompt information to correct the angle, and improves image quality.
Smart Images

Figure CN111914783B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of face recognition technology, and in particular to a method for determining a face deflection angle, an apparatus for determining a face deflection angle, a computer device, and a computer-readable storage medium. Background Art
[0002] In current face detection and recognition, the frontal face image of the user is used as a benchmark, and the deflection angle of the face (such as deflection up and down, left and right, etc.) can be used as a dimension to judge the quality of the face image. The general approach is to use a large number of labeled face images and angle deflection information to feed the deep learning neural network to train a model that can recognize the deflection angle of the face. However, this is costly and not conducive to implementation on devices with relatively few hardware resources.
[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of the present application is to provide a method for determining a face deflection angle, a device for determining a face deflection angle, a computer device and a computer-readable storage medium, aiming to solve the problem of low efficiency in identifying the face deflection angle in a face image.
[0005] To achieve the above object, the present application provides a method for determining a face deflection angle, the method comprising the following steps:
[0006] Get face image;
[0007] Identify facial feature information in the facial image, the facial feature information at least including left pupil coordinates, right pupil coordinates, nose tip coordinates, and lip midpoint coordinates;
[0008] According to the geometric relationship between the facial feature information and the reference value corresponding to the benchmark facial image, the deflection angle of the face in the facial image is determined, wherein the deflection angle includes at least one of a first deflection angle and a second deflection angle, the first deflection angle is the angle at which the face is deflected around a horizontal direction, and the second deflection angle is the angle at which the face is deflected around a vertical direction.
[0009] Further, the reference value includes a third projection and a fourth projection, the third projection is a projection of a line connecting a midpoint between the eyes and a nose tip in the reference face image in a vertical direction; the fourth projection is a projection of a line connecting a nose tip and a midpoint of the lips in the reference face image in a vertical direction; the step of determining the deflection angle of the face in the face image according to the geometric relationship between the face feature information and the reference value corresponding to the reference face image includes:
[0010] Determining the midpoint coordinates between the left pupil coordinates and the right pupil coordinates;
[0011] Determine a first projection of a line between the midpoint coordinate and the nose tip coordinate in the vertical direction, and determine a second projection of a line between the nose tip coordinate and the lip midpoint coordinate in the vertical direction;
[0012] The first deflection angle is determined according to a geometric relationship among the first projection, the second projection, the third projection and the fourth projection.
[0013] Further, the step of determining the first deflection angle according to the geometric relationship among the first projection, the second projection, the third projection and the fourth projection comprises:
[0014] determining a first ratio between the first projection and the second projection, and a second ratio between the third projection and the fourth projection;
[0015] Substituting the first ratio and the second ratio into a preset geometric formula to calculate the first deflection angle: θ1=arctan[(ab) / (a(b+1))*cot(β)];
[0016] Among them, θ1 is the first deflection angle, a is the first ratio, b is the second ratio, β is the reference angle in the reference face image, and the reference angle is the angle between the first line and the second line; the first line is the line between the midpoint between the eyes and the midpoint of the lips; the second line is the line between the midpoint between the eyes and the tip of the nose, or the second line is the line between the tip of the nose and the midpoint of the lips.
[0017] Further, the reference value includes a reference angle, and the reference angle is an angle between a first connecting line and a second connecting line; the first connecting line is a connecting line between a midpoint between the eyes and a midpoint of the lips; the second connecting line is a connecting line between a midpoint between the eyes and a nose tip, or the second connecting line is a connecting line between a nose tip and a midpoint of the lips; the step of determining the deflection angle of the face in the face image according to the geometric relationship between the face feature information and the reference value corresponding to the reference face image comprises:
[0018] Determining the midpoint coordinates between the left pupil coordinates and the right pupil coordinates;
[0019] Determine a first distance between the midpoint coordinate and the nose tip coordinate, a second distance between the midpoint coordinate and the lip midpoint coordinate, and a third distance between the nose tip coordinate and the lip midpoint coordinate;
[0020] The second deflection angle is determined according to the geometric relationship between the first distance, the second distance, the third distance and the reference angle. Furthermore, the deflection angle also includes a third deflection angle, which is an angle at which the face is deflected around a direction perpendicular to the plane where the face image is located; after the step of identifying the facial feature information in the face image, the method further includes:
[0021] When the currently determined deflection angle is the first deflection angle and / or the second deflection angle, performing the step of determining the deflection angle of the face according to the facial feature information;
[0022] When the currently determined deflection angle is the third deflection angle, the third deflection angle is determined according to the left pupil coordinates and the right pupil coordinates.
[0023] Furthermore, the method for determining the face deflection angle also includes:
[0024] When it is determined that the obtained deflection angle is greater than a preset angle corresponding to the deflection angle, a prompt message is output.
[0025] Furthermore, the prompt information includes a face angle correction direction, and the face angle correction direction is determined according to the deflection angle.
[0026] To achieve the above object, the present application further provides a device for determining a face deflection angle, the device for determining a face deflection angle comprising:
[0027] The device for determining the face deflection angle includes a memory, a processor, and a face deflection angle determination program stored in the memory and executable on the processor. When the face deflection angle determination program is executed by the processor, the steps of the face deflection angle determination method described above are implemented.
[0028] To achieve the above object, the present application also provides a computer device, the computer device comprising:
[0029] The computer device includes a memory, a processor, and a program for determining a face deflection angle stored in the memory and executable on the processor. When the program for determining a face deflection angle is executed by the processor, the steps of the method for determining a face deflection angle as described above are implemented.
[0030] To achieve the above-mentioned purpose, the present application also provides a computer-readable storage medium, on which a program for determining a face deflection angle is stored. When the program for determining a face deflection angle is executed by a processor, the steps of the method for determining a face deflection angle as described above are implemented.
[0031] The present application provides a method for determining a face deflection angle, a device for determining a face deflection angle, a computer device, and a computer-readable storage medium, which obtain a face image; identify face feature information in the face image, wherein the face feature information at least includes left pupil coordinates, right pupil coordinates, nose tip coordinates, and lip midpoint coordinates; and determine the face deflection angle in the face image according to a geometric relationship between the face feature information and a reference value corresponding to a reference face image, wherein the deflection angle includes at least one of a first deflection angle and a second deflection angle, wherein the first deflection angle is an angle at which the face deflects around a horizontal direction, and the second deflection angle is an angle at which the face deflects around a vertical direction. In this way, the efficiency of identifying the face deflection angle in the face image can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 This is a schematic diagram of the steps of a method for determining a face deflection angle in an embodiment of the present application;
[0033] Figure 2 This is a schematic diagram of another step of the method for determining the face deflection angle in one embodiment of the present application;
[0034] Figure 3 This is a schematic diagram of another step of the method for determining the face deflection angle in one embodiment of the present application;
[0035] Figure 4 This is a schematic diagram of another step of the method for determining the face deflection angle in one embodiment of the present application;
[0036] Figure 5 This is a schematic diagram of another step of the method for determining the face deflection angle in one embodiment of the present application;
[0037] Figure 6 A schematic block diagram of the structure of a computer device according to an embodiment of the present application.
[0038] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0040] Reference Figure 1 In one embodiment, the method for determining the face deflection angle includes:
[0041] Step S10: Acquire a face image.
[0042] In this embodiment, the embodiment terminal may be a device for determining a face deflection angle, and the device may be arranged in a mobile device (such as a smart phone or a tablet computer); the terminal may also be a computer device.
[0043] Optionally, the terminal may acquire the user's facial image in real time or periodically through a camera device disposed in the terminal, or a camera device in communication with the terminal.
[0044] Optionally, the facial image acquired by the terminal may also be pre-stored in a database of the terminal.
[0045] Optionally, the facial image acquired by the terminal may also be transmitted by other electronic devices.
[0046] Optionally, after the terminal obtains the face image, it can pre-process the face image. The pre-processing of the face image may include geometric processing, illumination compensation and histogram equalization. In addition, the image can be decomposed by wavelet transform method, high-frequency information can be filtered out, and relatively stable low-frequency molecules can be used to express the image information, blurring the influence of facial expressions and postures. In this way, the quality of the face image can be improved, which is convenient for the subsequent extraction of facial features.
[0047] Step S20, identifying facial feature information in the facial image, wherein the facial feature information at least includes left pupil coordinates, right pupil coordinates, nose tip coordinates, and lip midpoint coordinates.
[0048] Using face recognition technology, preset facial feature points in the face image are identified to obtain facial feature information corresponding to the facial features.
[0049] The preset facial feature points include at least the left pupil, right pupil, nose tip and lip midpoint (the middle of the lips). After the terminal identifies the positions of these facial feature points in the image, it determines the plane rectangular coordinate system coordinates corresponding to the facial feature points according to the preset coordinate origin, and obtains the left pupil coordinate A (x1, y1), right pupil coordinate B (x2, y2), nose tip coordinate D (x4, y4) and lip midpoint coordinate E (x5, y5) as facial feature information.
[0050] It should be understood that when constructing a plane rectangular coordinate system with the plane where the face image is located, when the plane where the face image is located is perpendicular to the horizontal plane, the extension direction of the intersection of the two is the horizontal direction (X-axis direction), and the direction perpendicular to the horizontal plane is the vertical direction (Y-axis direction). In addition, the direction perpendicular to the plane where the face image is located can be marked as the Z-axis direction.
[0051] It should be understood that as long as the coordinates of the facial feature points follow the same coordinate origin, the specific location of the coordinate origin has no effect on the calculation of the distance between the coordinates.
[0052] Step S30, determining the deflection angle of the face in the face image based on the geometric relationship between the facial feature information and the reference value corresponding to the benchmark facial image, wherein the deflection angle includes at least one of a first deflection angle and a second deflection angle, the first deflection angle is the angle at which the face is deflected around a horizontal direction, and the second deflection angle is the angle at which the face is deflected around a vertical direction.
[0053] Optionally, after obtaining the facial feature information, the terminal can determine the deflection angle of the face relative to the frontal face image according to the facial feature information. The deflection angle includes at least one of a first deflection angle and a second deflection angle, wherein the first deflection angle is the angle of clockwise or counterclockwise deflection of the face around the horizontal direction (if the plane where the face image is located is perpendicular to the horizontal plane, then the face deflection at this time is manifested as the face deflecting upward or downward), and the second deflection angle is the angle of clockwise or counterclockwise deflection of the face around the vertical direction (if the plane where the face image is located is perpendicular to the horizontal plane, then the face deflection at this time is manifested as the face deflecting to the left or right).
[0054] That is, when determining the deflection angle of the face, the terminal may determine only the first deflection angle, or only the second deflection angle, or may determine both the first deflection angle and the second deflection angle.
[0055] Optionally, after obtaining the left pupil coordinate A(x1, y1) and the right pupil coordinate B(x2, y2), the terminal can further determine the midpoint coordinate between the two. The midpoint coordinate C(x3, y3) between the two eyes is calculated as follows:
[0056] C(x3,y3)=((x2-x1) / 2,(y2-y1) / 2)
[0057] That is, the facial feature information may include the coordinates of the midpoint between the eyes of the face.
[0058] Optionally, the reference value corresponding to the benchmark facial image may include the relative position relationship between the midpoint between the eyes and the tip of the nose and the midpoint of the lips in the benchmark facial image.
[0059] Furthermore, the terminal determines the relative position relationship between the midpoint coordinates C (x3, y3), the nose tip point coordinates D (x4, y4) and the lip midpoint coordinates E (x5, y5) in the facial image, and simultaneously obtains the relative position relationship between the midpoint between the eyes and the nose tip point and the lip midpoint in the reference facial image, compares the two position relationships, and uses geometric relationships to determine the angle formed between each key point in the two position relationships (for example, the angle formed between the line connecting the nose tip point coordinates and the lip midpoint of the currently recognized facial image, and the line connecting the nose tip point and the lip midpoint of the reference facial image), thereby determining the first deflection angle and / or the second deflection angle.
[0060] Optionally, the reference facial image may be a frontal facial image or a side facial image of a user corresponding to the current facial image, and the reference facial image is pre-stored in a database.
[0061] Optionally, the terminal may also pre-store frontal or side face images of common faces of different age groups, genders, and races, and use these images as reference face images. When obtaining the face image of the current user, the terminal first obtains the user's age group, gender, and / or race information from the face image, and then obtains the frontal or side face image of the corresponding age group, gender, and / or race from the database as the reference face image.
[0062] It should be noted that the reference side face image is an image obtained by rotating the reference front face image 90° around the vertical direction.
[0063] It should be noted that the database may be a database in a terminal memory or a database on a server, and the terminal may obtain data stored on the server through network communication.
[0064] In this way, the efficiency of identifying the deflection angle of the face in the face image is improved, and the deflection angle of the face in the face image can be easily identified even on a device with relatively less hardware resources.
[0065] In one embodiment, if Figure 2 As shown in the above Figure 1 Based on the embodiment shown, the step of determining the deflection angle of the face according to the facial feature information includes:
[0066] Step S31, determining the midpoint coordinates between the left pupil coordinates and the right pupil coordinates.
[0067] Step S32, determining a first projection of a line between the midpoint coordinates and the nose tip coordinates in the vertical direction, and determining a second projection of a line between the nose tip coordinates and the lip midpoint coordinates in the vertical direction.
[0068] Step S33: determining the first deflection angle according to a geometric relationship among the first projection, the second projection, the third projection and the fourth projection.
[0069] In this embodiment, after obtaining the left pupil coordinate A (x1, y1) and the right pupil coordinate B (x2, y2), the terminal can further determine the midpoint coordinate between the two. The midpoint coordinate C (x3, y3) between the two eyes is calculated as follows:
[0070] C(x3,y3)=((x2-x1) / 2,(y2-y1) / 2)
[0071] After determining the midpoint coordinates between the left pupil coordinates and the right pupil coordinates, determine the first projection F1=y3-y4 in the vertical direction of the line between the midpoint coordinates and the nose tip coordinates according to the midpoint coordinates C (x3, y3) and the nose tip coordinates D (x4, y4); and determine the second projection F2=y4-y5 in the vertical direction of the line between the nose tip coordinates D (x4, y4) and the lip midpoint coordinates E (x5, y5).
[0072] Optionally, when the terminal determines the first deflection angle according to the first projection F1, the second projection F2, the second ratio b and the reference angle β, the first ratio a between the first projection F1 and the second projection F2 may be determined first, where a=F1 / F2. Then, according to the geometric relationship between a, b and β, the first deflection angle θ1 is determined, and the calculation formula is as follows:
[0073] θ1=arctan[(ab) / (a(b+1))*cot(β)]
[0074] The second ratio b is the ratio between the third projection F3 and the fourth projection F4 (b=F3 / F4).
[0075] It should be noted that the third projection is the projection of the line connecting the midpoint between the person's eyes and the tip of the nose in the reference face image in the vertical direction; the fourth projection is the projection of the line connecting the tip of the nose and the midpoint of the lips in the reference face image in the vertical direction.
[0076] It should be noted that the reference angle β is the angle between the first line and the second line, the first line is the line between the midpoint between the eyes and the midpoint of the lips in the reference face image; the second line is the line between the midpoint between the eyes and the tip of the nose in the reference face image; or the second line is the line between the tip of the nose and the midpoint of the lips in the reference face image.
[0077] Among them, the second connecting line is preferably the connecting line between the midpoint between the eyes and the nose tip in the reference face image, because the connecting line between the two roughly overlaps with the bridge of the nose, and the connecting line identified along the bridge of the nose is more accurate, thereby obtaining a more accurate reference angle.
[0078] It should be understood that the reference frontal face image can be used to determine the third projection and the fourth projection; the reference side face image can be used to determine the third projection, the fourth projection and the reference angle (obtained from the first connecting line and the second connecting line).
[0079] Optionally, after obtaining the reference facial image, the terminal can determine the third projection F3 and the fourth projection F4 corresponding to the reference facial image based on the midpoint coordinates between the eyes, the nose tip coordinates and the lip midpoint coordinates in the reference facial image (the calculation principle is the same as the first projection and the second projection, which will not be repeated here).
[0080] Optionally, after obtaining the reference side face image, the terminal can determine the first connecting line and the second connecting line corresponding to the reference side face image based on the midpoint coordinates between the eyes, the nose tip point coordinates and the lips midpoint coordinates in the reference side face image, thereby obtaining the reference angle β (draw a straight line perpendicular to the first connecting line and intersecting it at the nose tip point, and then the reference angle β can be calculated using the length of each line segment according to the cosine theorem).
[0081] Optionally, the terminal may also pre-store the second ratio b and the reference angle β corresponding to various reference face images. When the terminal determines the reference face image corresponding to the current user, it directly obtains the second ratio b and the reference angle β associated with the reference face image to calculate the first deflection angle of the currently recognized face image. In this way, the delay of face image data processing can be further reduced.
[0082] Among them, when the calculated first deflection angle θ1 is greater than 0, it indicates that the face is deflected upward; when the calculated first deflection angle θ1 is less than 0, it indicates that the face is deflected downward; when the calculated first deflection angle θ1 is equal to 0, it indicates that the face is not deflected around the horizontal direction at this time, and at this time the ratio a between the first projection and the second projection is equal to the second ratio b.
[0083] Optionally, when the terminal outputs the first deflection angle θ1, it may further output the deflection direction corresponding to the first deflection angle θ1.
[0084] Optionally, since the ratio a corresponding to different combinations of the first projection and the second projection in the same reference face image must correspond to different first deflection angles, the first deflection angles corresponding to different ratios a in the same reference face image can be enumerated and saved, and when the terminal determines to obtain the ratio a between the first projection and the second projection in the current face image, the first deflection angle corresponding to the reference face image can be directly queried based on the ratio a.
[0085] In this way, the face deflection angle in the face image can be quickly calculated by using the trigonometric function relationship. Even on devices with less hardware resources, real-time processing of face images can be achieved, and the face deflection angle around the horizontal direction in the face image can be easily identified.
[0086] In one embodiment, if Figure 3 As shown in the above Figure 1 to Figure 2 Based on the embodiment of the present invention, the step of determining the deflection angle of the face according to the facial feature information includes:
[0087] Step S34, determine the first distance between the midpoint coordinates and the nose tip point coordinates, the second distance between the midpoint coordinates and the lip midpoint coordinates, and the third distance between the nose tip point coordinates and the lip midpoint coordinates.
[0088] Step S35: determine the second deflection angle according to a geometric relationship among the first distance, the second distance, the third distance and a reference angle.
[0089] In this embodiment, after obtaining the left pupil coordinate A (x1, y1) and the right pupil coordinate B (x2, y2), the terminal can further determine the midpoint coordinate between the two. The midpoint coordinate C (x3, y3) between the two eyes is calculated as follows:
[0090] C(x3,y3)=((x2-x1) / 2,(y2-y1) / 2)
[0091] After determining the midpoint coordinates between the left pupil coordinates and the right pupil coordinates, the distances between these three points are determined based on the midpoint coordinates C (x3, y3), the nose tip coordinates D (x4, y4) and the lip midpoint coordinates E (x5, y5).
[0092] According to the midpoint coordinates C (x3, y3) and the nose tip coordinates D (x4, y4), the first distance e between the two is determined as:
[0093]
[0094] Among them, according to the midpoint coordinates C (x3, y3) and the lip midpoint coordinates E (x5, y5), the second distance d between the two is determined as:
[0095]
[0096] Among them, according to the coordinates of the nose tip point D (x4, y4) and the lip midpoint coordinates E (x5, y5), the third distance c between the two is determined as:
[0097]
[0098] After obtaining the first distance e, the second distance d and the third distance c according to the midpoint coordinates C (x3, y3), the nose tip coordinates D (x4, y4) and the lip midpoint coordinates E (x5, y5), the cosine theorem can be used to calculate the value of ∠ECD or ∠DEC, recorded as α, and the calculation formula is as follows:
[0099] α=∠ECD=arccos[(d 2 +e 2 -c 2 ) / (2*d*e)]
[0100] Or, α = ∠DEC = arccos[(d 2 -e 2 +c 2 ) / (2*d*c)]
[0101] Among them, when the second connecting line used to calculate the reference angle β is the line between the midpoint between the person's eyes and the tip of the nose in the reference face image, ∠ECD is calculated; when the second connecting line used to calculate the reference angle β is the line between the tip of the nose and the midpoint of the lips in the reference face image, ∠DEC is calculated.
[0102] Furthermore, the terminal obtains the reference angle β and calculates the second deflection angle θ2 using the following formula:
[0103] θ2=arcsin(α / β)
[0104] It should be noted that, since ∠α is actually the projection of ∠β in the Z-axis direction, the geometric relationship between the two can be used to calculate the angle of deflection of the face around the vertical direction (Y-axis direction) - the second deflection angle θ2.
[0105] Furthermore, by calculating which side of the reference line CE the nose tip point coordinate D (x4, y4) is on (determining whether it is on the left or right side), the deflection direction corresponding to the second deflection angle θ2 can be further obtained. The reference line CE is the line between the midpoint coordinate C (x3, y3) and the lip midpoint coordinate E (x5, y5).
[0106] Among them, according to the midpoint coordinates C (x3, y3), the nose tip coordinates D (x4, y4) and the lip midpoint coordinates E (x5, y5), the direction of the second deflection angle θ2 can be determined by using a preset geometric formula, and the formula is as follows:
[0107] S=(y5-y3)*x4+(x3-x5)*y4-x3*y5+x5*y3
[0108] Among them, when S<0, it indicates that the face is deflected to the left (that is, the deflection direction corresponding to the second deflection angle θ2 is to the left); when S>0, it indicates that the face is deflected to the right (that is, the deflection direction corresponding to the second deflection angle θ2 is to the right).
[0109] It should be understood that when S=0, that is, the second deflection angle θ2=0, it indicates that the face is not deflected around the vertical direction at this time.
[0110] Optionally, when the terminal outputs the second deflection angle θ2, it may further output the deflection direction corresponding to the second deflection angle θ2.
[0111] In this way, the face deflection angle in the face image can be quickly calculated by using the trigonometric function relationship. Even on devices with less hardware resources, real-time processing of face images can be achieved, and the deflection angle of the face in the face image around the vertical direction can be easily identified.
[0112] In one embodiment, if Figure 4 As shown in the above Figures 1 to 3 Based on the embodiment of the invention, the deflection angle further includes a third deflection angle, and the third deflection angle is an angle at which the face is deflected around a direction perpendicular to the plane where the face image is located; after the step of identifying the facial feature information in the face image, the step further includes:
[0113] Step S40: When the currently determined deflection angle is a third deflection angle, determine the third deflection angle according to the left pupil coordinates and the right pupil coordinates.
[0114] In this embodiment, the deflection angle may further include a third deflection angle, where the third deflection angle is the angle at which the face is deflected around a direction perpendicular to the plane where the face image is located (Z-axis direction) (equivalent to a parallel rotation on the plane where the face image is located).
[0115] Optionally, when the deflection angle currently determined by the terminal is the first deflection angle and / or the second deflection angle, the step of determining the deflection angle of the face according to the facial feature information (step S30) is executed, that is, the deflection angle of the face is determined according to the left pupil coordinates, the right pupil coordinates, the nose tip coordinates and the lip midpoint coordinates; if the deflection angle currently determined by the terminal is the third deflection angle, the third deflection angle θ3 is determined according to the left pupil coordinates A (x1, y1) and the right pupil coordinates B (x2, y2).
[0116] Using the plane geometric relationship between the left pupil coordinate A (x1, y1) and the right pupil coordinate B (x2, y2), the formula for calculating the third deflection angle θ3 is as follows:
[0117] θ3=arctan((y2-y1) / (x2-x1))
[0118] When the calculated third deflection angle θ3 is greater than 0, it indicates that the face is deflected counterclockwise around the Z-axis; when the calculated third deflection angle θ3 is less than 0, it indicates that the face is deflected clockwise around the Z-axis.
[0119] Optionally, when the terminal outputs the third deflection angle θ3, it may further output the deflection direction corresponding to the third deflection angle θ3.
[0120] It should be understood that even if the determination methods are different, the deflection angle finally determined by the terminal may include at least one of the first deflection angle, the second deflection angle, and the third deflection angle.
[0121] In this way, the deflection angle of the face in the face image can be quickly calculated by using the trigonometric function relationship. Even on devices with less hardware resources, real-time processing of the face image can be achieved, and the deflection angle of the face in the face image around the direction perpendicular to the plane where the face image is located can be easily identified.
[0122] In one embodiment, if Figure 5 As shown in the above Figures 1 to 4 Based on the embodiment of the present invention, the method for determining the face deflection angle further includes:
[0123] Step S50: When it is determined that the obtained deflection angle is greater than a preset angle corresponding to the deflection angle, output a prompt message.
[0124] In this embodiment, the deflection angle of the face in the face image may include at least one of a first deflection angle, a second deflection angle, and a third deflection angle. The first deflection angle, the second deflection angle, and the third deflection angle may be pre-set with corresponding preset angles. For example, the preset angle value range of the first deflection angle is 10°-20°, the preset angle value range corresponding to the second deflection angle is 15°-30°, and the preset angle value range corresponding to the third deflection angle is 5°-25°.
[0125] When the terminal detects that the deflection angle determined in the face image is greater than the preset angle corresponding to the deflection angle of this category, it outputs a prompt message to prompt the user to correct his posture and face the camera device to obtain a face image with a better face capture angle.
[0126] It should be understood that when the deflection angle is a negative value, the absolute value is first taken and then compared with the preset angle.
[0127] Optionally, the prompt information output by the terminal may further include the face angle correction direction. When generating the prompt information, the terminal obtains the current deflection angle that is greater than the corresponding preset angle, and determines the opposite direction of the deflection angle as the face angle correction direction.
[0128] Among them, when the first deflection angle θ1 is greater than 0, it indicates that the current face is deflected upward, and the direction of face angle correction should be downward (such as prompting the user to turn his face downward); when the first deflection angle θ1 is less than 0, it indicates that the current face is deflected downward, and the direction of face angle correction should be upward.
[0129] Among them, when the second deflection angle θ2 is greater than 0, it indicates that the current face is deflected to the right, and the direction of face angle correction should be to the left (such as prompting the user to turn his face to the left); when the second deflection angle θ2 is less than 0, it indicates that the current face is deflected to the left, and the direction of face angle correction should be to the right.
[0130] Among them, when the third deflection angle θ3 is greater than 0, it indicates that the face is deflected counterclockwise around the Z-axis, and the direction of face angle correction should be clockwise; when the third deflection angle θ3 is less than 0, it indicates that the face is deflected clockwise around the Z-axis, and the direction of face angle correction should be counterclockwise.
[0131] In this way, when the output prompt information includes the face angle correction direction, it can better prompt the user to correct the posture and face the camera device to obtain a face image with a better face capture angle. It can also help the user understand the reason why the previously captured face image was unqualified.
[0132] Reference Figure 6In an embodiment of the present application, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used for a determination program of a face deflection angle. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for determining a face deflection angle is implemented.
[0133] Those skilled in the art will understand that Figure 6 The structure shown in is merely a block diagram of a portion of the structure related to the present application solution and does not constitute a limitation on the computer device to which the present application solution is applied.
[0134] In addition, the present application also proposes a computer-readable storage medium, the computer-readable storage medium includes a program for determining a face deflection angle, and when the program for determining a face deflection angle is executed by a processor, the steps of the method for determining a face deflection angle as described in the above embodiment are implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0135] In summary, the method, apparatus, computer device and storage medium for determining the face deflection angle provided in the embodiments of the present application obtain a face image; identify facial feature information in the face image, wherein the facial feature information includes at least left pupil coordinates, right pupil coordinates, nose tip coordinates and lip midpoint coordinates; determine the deflection angle of the face in the face image based on a geometric relationship between the facial feature information and a reference value corresponding to a benchmark face image, wherein the deflection angle includes at least one of a first deflection angle and a second deflection angle, wherein the first deflection angle is an angle at which the face deflects around a horizontal direction, and the second deflection angle is an angle at which the face deflects around a vertical direction; in this way, the efficiency of identifying the face deflection angle in the face image can be improved, and it can be implemented even on devices with relatively few hardware resources.
[0136] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0137] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0138] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for determining a face deflection angle, characterized in that: The method for determining the face deflection angle comprises the following steps: Get face image; Identify facial feature information in the facial image, the facial feature information at least including left pupil coordinates, right pupil coordinates, nose tip coordinates, and lip midpoint coordinates; Determine a deflection angle of a face in the face image according to a geometric relationship between the face feature information and a reference value corresponding to the reference face image, wherein the deflection angle includes at least one of a first deflection angle and a second deflection angle, the first deflection angle is an angle of deflection of the face around a horizontal direction, and the second deflection angle is an angle of deflection of the face around a vertical direction; The reference value includes a third projection and a fourth projection, wherein the third projection is a projection of a line connecting a midpoint between the eyes and a nose tip in a reference face image in a vertical direction; and the fourth projection is a projection of a line connecting a nose tip and a midpoint of the lips in a reference face image in a vertical direction. The step of determining the deflection angle of the face in the face image according to the geometric relationship between the face feature information and the reference value corresponding to the reference face image includes: Determining the midpoint coordinates between the left pupil coordinates and the right pupil coordinates; Determine a first projection of a line between the midpoint coordinate and the nose tip coordinate in the vertical direction, and determine a second projection of a line between the nose tip coordinate and the lip midpoint coordinate in the vertical direction; The first deflection angle is determined according to a geometric relationship among the first projection, the second projection, the third projection and the fourth projection.
2. The method for determining the face deflection angle according to claim 1, wherein: The step of determining the first deflection angle according to the geometric relationship between the first projection, the second projection, the third projection and the fourth projection comprises: determining a first ratio between the first projection and the second projection, and a second ratio between the third projection and the fourth projection; Substituting the first ratio and the second ratio into a preset geometric formula to calculate the first deflection angle: θ1=arctan[(ab) / (a(b+1))*cot(β)]; Among them, θ1 is the first deflection angle, a is the first ratio, b is the second ratio, β is the reference angle in the reference face image, and the reference angle is the angle between the first line and the second line; the first line is the line between the midpoint between the eyes and the midpoint of the lips; the second line is the line between the midpoint between the eyes and the tip of the nose, or the second line is the line between the tip of the nose and the midpoint of the lips.
3. The method for determining the face deflection angle according to claim 1, wherein: The reference value includes a reference angle, and the reference angle is the angle between a first connecting line and a second connecting line; the first connecting line is a connecting line between the midpoint between the eyes and the midpoint of the lips; the second connecting line is a connecting line between the midpoint between the eyes and the tip of the nose, or the second connecting line is a connecting line between the tip of the nose and the midpoint of the lips; the step of determining the deflection angle of the face in the face image according to the geometric relationship between the face feature information and the reference value corresponding to the reference face image includes: Determining the midpoint coordinates between the left pupil coordinates and the right pupil coordinates; Determine a first distance between the midpoint coordinate and the nose tip coordinate, a second distance between the midpoint coordinate and the lip midpoint coordinate, and a third distance between the nose tip coordinate and the lip midpoint coordinate; The second deflection angle is determined according to a geometric relationship among the first distance, the second distance, the third distance and the reference angle.
4. The method for determining the face deflection angle according to claim 1, wherein: The deflection angle further includes a third deflection angle, and the third deflection angle is an angle at which the face is deflected around a direction perpendicular to the plane where the face image is located; after the step of identifying the face feature information in the face image, the step further includes: When the currently determined deflection angle is the first deflection angle and / or the second deflection angle, performing the step of determining the deflection angle of the face according to the facial feature information; When the currently determined deflection angle is the third deflection angle, the third deflection angle is determined according to the left pupil coordinates and the right pupil coordinates.
5. The method for determining the face deflection angle according to any one of claims 1 to 4, characterized in that: The method for determining the face deflection angle also includes: When it is determined that the obtained deflection angle is greater than a preset angle corresponding to the deflection angle, a prompt message is output.
6. The method for determining the face deflection angle according to claim 5, characterized in that: The prompt information includes a face angle correction direction, and the face angle correction direction is determined according to the deflection angle.
7. A device for determining a face deflection angle, characterized in that: The device for determining the face deflection angle includes a memory, a processor, and a face deflection angle determination program stored in the memory and executable on the processor. When the face deflection angle determination program is executed by the processor, the steps of the face deflection angle determination method as described in any one of claims 1 to 6 are implemented.
8. A computer device, characterized in that: The computer device includes a memory, a processor, and a program for determining a face deflection angle stored in the memory and executable on the processor. When the program for determining a face deflection angle is executed by the processor, the steps of the method for determining a face deflection angle as described in any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program for determining a face deflection angle, and when the program for determining a face deflection angle is executed by a processor, the steps of the method for determining a face deflection angle as described in any one of claims 1 to 6 are implemented.
