A neck determination method, device and equipment for a non-frontal face image and a medium

By detecting non-frontal face images using color space and skin color models, and combining sine curve fitting and angle calculation, the problem of distinguishing the neck and face in non-frontal face images is solved, thus improving the accuracy of face detection.

CN118172818BActive Publication Date: 2026-11-20AGRICULTURAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410376798.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-29
Publication Date
2026-11-20
Estimated Expiration
2044-03-29

AI Technical Summary

Technical Problem

Existing face detection methods struggle to accurately distinguish between the neck and face in non-frontal face images, leading to decreased detection accuracy.

Method used

Using color space and skin color model to detect non-frontal face images, the first neck starting point on the left and right sides of the neck is determined by skin color contour curve extraction and sine curve fitting, combined with direction angle and included angle calculation.

Benefits of technology

It accurately distinguishes between the neck and face, improving the accuracy of face detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118172818B_ABST
    Figure CN118172818B_ABST
Patent Text Reader

Abstract

The application provides a neck determination method, device, equipment and medium for a non-frontal face image. The left lower jaw neck contour curve and the right lower jaw neck contour curve are fitted in a sinusoidal curve fitting mode, the first neck starting point corresponding to one side can be determined, the neck and the face can be accurately distinguished, when the first neck starting point cannot be determined through the sinusoidal curve fitting, the pixel points on the left lower jaw neck contour curve or the right lower jaw neck contour curve are traversed, the trend change of the contour curve can be judged through the direction angle and the size of the included angle, and then the turning point at the junction of the neck and the lower jaw is determined, so as to be the first neck starting point of the left or right lower jaw neck contour curve. The application accurately determines the first neck starting points of the left neck and the right neck by combining the sinusoidal curve fitting method and the angle calculation method, so as to distinguish the neck and the face, and then improve the accuracy of face detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing, and in particular to a method, apparatus, device, and medium for determining the neck of a non-frontal human face image. Background Technology

[0002] Face detection is widely used in many scenarios, such as facial recognition payment. Most existing face detection methods are based on frontal faces, and their performance is poor for non-frontal faces, such as those with the head tilted back. Furthermore, the varied orientation angles of faces in non-frontal images pose challenges for face detection, making it difficult to distinguish between the face and neck. If the face and neck are not differentiated during face detection, and the neck region is included as part of the face, the accuracy of face detection will be significantly reduced. Therefore, providing a suitable method for neck determination in non-frontal face images has become an urgent technical problem to be solved. Summary of the Invention

[0003] In view of this, the purpose of this application is to provide a method, apparatus, device, and medium for determining the neck in non-frontal face images, accurately determining the first neck starting points on the left and right sides of the neck, thereby distinguishing the neck from the face and improving the accuracy of face detection. The specific solution is as follows:

[0004] On the one hand, this application provides a method for determining the neck of a non-frontal face image, including:

[0005] The first face image was detected using color space and skin color model to obtain a binarized skin color region image;

[0006] Contour extraction is performed on the skin color region image to obtain the skin color contour curve;

[0007] The skin contour curve is cut off according to the preset horizontal and vertical lines to obtain the left mandibular neck contour curve and the right mandibular neck contour curve.

[0008] Sine curves are fitted to the left mandibular neck contour curve and the right mandibular neck contour curve respectively to obtain the left fitted sine curve and the right fitted sine curve.

[0009] Determine whether the parameters of the target fitted sine curve conform to the preset curve parameters. If so, calculate the extreme point of the target fitted sine curve and use the extreme point as the first neck starting point of the target fitted sine curve. The target fitted sine curve is either the left fitted sine curve or the right fitted sine curve.

[0010] Otherwise, the target mandibular neck contour curve corresponding to the target fitted sine curve is traversed to determine the direction angle of the first vector and the angle between the first vector and the second vector; the first vector is from the i-th pixel to the ij-th pixel, and the second vector is from the i-th pixel to the (i+j)-th pixel.

[0011] When the direction angle is within a preset direction angle range and the included angle is within a preset included angle range, the i-th pixel is taken as the first neck starting point of the target mandibular neck contour curve.

[0012] Furthermore, embodiments of this application also provide a neck determination device for non-frontal face images, comprising:

[0013] The detection unit is used to detect the first face image acquired using color space and skin color model, and obtain a binarized skin color region image.

[0014] The extraction unit is used to extract the contour of the skin color region image to obtain the skin color contour curve;

[0015] The cropping unit is used to crop the skin contour curve according to the preset horizontal line and the preset vertical line to obtain the left mandibular neck contour curve and the right mandibular neck contour curve.

[0016] The fitting unit is used to perform sine curve fitting on the left mandibular neck contour curve and the right mandibular neck contour curve respectively to obtain the left fitted sine curve and the right fitted sine curve.

[0017] The calculation unit is used to determine whether the parameters of the target fitted sine curve conform to the preset curve parameters. If so, it calculates the extreme point of the target fitted sine curve and uses the extreme point as the first neck starting point of the target fitted sine curve. The target fitted sine curve is the left fitted sine curve or the right fitted sine curve.

[0018] The first determining unit is used to otherwise traverse the target mandibular neck contour curve corresponding to the target fitted sine curve, determine the direction angle of the first vector, and the angle between the first vector and the second vector; the first vector is from the i-th pixel to the ij-th pixel, and the second vector is from the i-th pixel to the (i+j)-th pixel.

[0019] The second determining unit is used to take the i-th pixel as the first neck starting point of the target mandibular neck contour curve when the direction angle is within a preset direction angle range and the included angle is within a preset included angle range.

[0020] In another aspect, embodiments of this application provide a computer device, the computer device including a processor and a memory:

[0021] The memory is used to store program code and transmit the program code to the processor;

[0022] The processor is used to execute the methods described above according to the instructions in the program code.

[0023] In another aspect, embodiments of this application provide a computer-readable storage medium for storing a computer program for performing the methods described above.

[0024] This application provides a method, apparatus, device, and medium for determining the neck in a non-frontal face image. It utilizes a color space and skin color model to detect the acquired first face image, obtaining a binarized skin color region image. Contour extraction is performed on the skin color region image to obtain a skin color contour curve. The skin color contour curve is then truncated according to preset horizontal and vertical lines to obtain a left mandibular neck contour curve and a right mandibular neck contour curve. Sine curve fitting is performed on the left and right mandibular neck contour curves respectively to obtain a left-fitted sine curve and a right-fitted sine curve. It is then determined whether the parameters of the target fitted sine curve conform to preset curve parameters; if so, then… Calculate the extreme points of the target fitted sine curve and use the extreme points as the first neck starting point of the target fitted sine curve; the target fitted sine curve is either the left fitted sine curve or the right fitted sine curve; otherwise, traverse the target mandibular neck contour curve corresponding to the target fitted sine curve to determine the direction angle of the first vector and the angle between the first vector and the second vector; the first vector is from the i-th pixel to the ij-th pixel, and the second vector is from the i-th pixel to the (i+j)-th pixel; when the direction angle is within the preset direction angle range and the angle is within the preset angle range, use the i-th pixel as the first neck starting point of the target mandibular neck contour curve.

[0025] Therefore, by using sine curve fitting on the left and right mandibular neck contour curves, the first neck starting point on the corresponding side can be determined, which can relatively accurately distinguish the neck from the face. When the first neck starting point cannot be determined by sine curve fitting, the pixels on the left or right mandibular neck contour curve can be traversed. The trend of the contour curve can be judged by the magnitude of the direction angle and the included angle, thereby determining the turning point at the junction of the neck and mandible, which can then be used as the first neck starting point of the left or right mandibular neck contour curve. In other words, this application, by combining sine curve fitting and angle calculation methods, can accurately determine the first neck starting point of the left and right neck, thereby distinguishing the neck from the face and improving the accuracy of face detection. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0027] Figure 1 A flowchart illustrating a method for determining the neck of a non-frontal face image according to an embodiment of this application is shown.

[0028] Figure 2 A schematic diagram of a human face image provided in an embodiment of this application is shown;

[0029] Figure 3 A schematic diagram of a skin tone contour curve provided in an embodiment of this application is shown;

[0030] Figure 4 This illustration shows a segmentation diagram of a skin tone contour curve provided in an embodiment of this application;

[0031] Figure 5 A schematic diagram of a left mandibular neck contour curve provided in an embodiment of this application is shown;

[0032] Figure 6 A schematic diagram of a left-side fitted sine curve provided in an embodiment of this application is shown;

[0033] Figure 7 This illustration shows a schematic diagram of the location of the neck starting point according to an embodiment of this application;

[0034] Figure 8 This illustration shows a schematic diagram of a neck starting point located on the right side, as provided in an embodiment of this application.

[0035] Figure 9 A schematic diagram of a right-side fitted sine curve provided in an embodiment of this application is shown;

[0036] Figure 10 This application illustrates a right mandibular neck contour curve provided by an embodiment of the present application;

[0037] Figure 11 This illustration shows a schematic diagram of a sine curve fitting method provided in an embodiment of this application.

[0038] Figure 12 This illustration shows a schematic diagram of the position of a pixel according to an embodiment of this application;

[0039] Figure 13 This illustration shows a schematic diagram of the location of a first neck starting point according to an embodiment of this application;

[0040] Figure 14 This illustration shows a schematic diagram of a human face image provided in an embodiment of this application;

[0041] Figure 15 A structural block diagram of a neck determination device for a non-frontal face image provided in an embodiment of this application;

[0042] Figure 16 This is a structural diagram of a computer device provided in an embodiment of this application. Detailed Implementation

[0043] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the specific embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0044] Many specific details are set forth in the following description in order to provide a full understanding of this application. However, this application may also be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the spirit of this application. Therefore, this application is not limited to the specific embodiments disclosed below.

[0045] For ease of understanding, the following detailed description, in conjunction with the accompanying drawings, provides a method, apparatus, device, and medium for determining the neck of a non-frontal face image according to embodiments of this application.

[0046] refer to Figure 1 The diagram shown is a flowchart illustrating a method for determining the neck of a non-frontal face image according to an embodiment of this application. The method may include the following steps.

[0047] S101, using color space and skin color model to detect the first face image, and obtain a binarized skin color region image.

[0048] In this embodiment, facial image acquisition can be performed, and the acquired facial image is recorded as the first facial image. Since the face may be facing the acquisition camera directly or not during facial image acquisition, the acquired first facial image is a non-frontal facial image. This application mainly focuses on identifying the neck starting point for non-frontal facial images. Color space and skin color model can be used to detect the acquired first facial image, thereby obtaining a binarized skin color region image.

[0049] In one possible implementation, the first face image can be converted based on the YCgCr color space to obtain a second face image in the YCgCr color space. The image color space conversion can be performed using the following formula:

[0050]

[0051] Wherein, RGB represents the first face image and YCgCr represents the second face image.

[0052] Next, the second face image is detected using a skin color model, and after morphological processing, a binarized skin color region image is obtained. The skin color model is also a mathematical relational model that can distinguish skin color from other colors in the color space. Skin color detection using the skin color model involves selecting skin color pixels in the second face image and segmenting the image. Because processing color features is simpler and faster than processing other features, and skin color information does not change with image shape, human pose, or external environment, the results of face detection using skin color are relatively stable.

[0053] refer to Figure 2 As shown, this is a schematic diagram of a face image provided in an embodiment of this application. (a) represents the first face image acquired, and (b) represents the binarized skin color region image obtained after skin color model detection.

[0054] S102, extract the contour of the skin region image to obtain the skin contour curve.

[0055] Specifically, since skin color detection directly detects both the face and neck regions as skin color areas, if these two parts are not distinguished and the neck region is also considered part of the face, it will affect subsequent face image detection. Therefore, contour extraction can be performed on the skin color region image to obtain the skin color contour curve. Contour extraction algorithms such as the Canny operator can be used for contour extraction. (Reference) Figure 3 The image shown is a schematic diagram of a skin tone contour curve provided in an embodiment of this application. The skin tone contour curve is... Figure 2The boundary contour line of the face image. It can be found that there is a turning point where the jaw and neck intersect in the skin contour curve. This point corresponds to the starting position of the neck in the face image. It is necessary to accurately determine this turning point in the subsequent steps.

[0056] S103, based on the preset horizontal and vertical lines, the skin contour curve is cut to obtain the left mandibular neck contour curve and the right mandibular neck contour curve.

[0057] In this embodiment, preset horizontal lines and preset vertical lines can be set in advance to cut the skin contour curve. The preset horizontal lines can remove the upper half of the face contour curve, and the preset vertical lines can distinguish the left and right sides of the neck, thereby obtaining the left mandibular neck contour curve and the right mandibular neck contour curve.

[0058] In one possible implementation, the direction of the preset horizontal line can be taken as the y-axis and the direction of the preset vertical line as the x-axis. That is, the horizontal direction is taken as the y-axis and the vertical direction is taken as the x-axis. Then, the x-axis coordinate of the preset horizontal line can be the midpoint of the skin contour curve in the x-axis direction, and the y-axis coordinate of the preset vertical line can be the midpoint of the skin contour curve in the y-axis direction. In this way, since the face occupies the upper two-thirds of the contour curve, setting the preset horizontal line at the midline of the x-axis direction can accurately distinguish the face and neck, and can also preserve the connection area between the face and neck. Setting the preset vertical line at the midline of the y-axis direction can distinguish the contour curves on the left and right sides.

[0059] The left mandibular-neck contour curve is a skin-toned contour curve located below the preset horizontal line and to the left of the preset vertical line, while the right mandibular-neck contour curve is a skin-toned contour curve located below the preset horizontal line and to the right of the preset vertical line. Extracting the left and right mandibular-neck contour curves from the skin-toned contour curves narrows the search area for the neck starting point, improving search efficiency and preventing the misidentification of facial transition points as neck starting points, thus improving the accuracy of the neck starting point. Furthermore, another horizontal line can be preset to remove the lowermost neck area, retaining the contour curve of the face and neck junction, further narrowing the search area.

[0060] refer to Figure 4 The diagram shown is a segmentation schematic of a skin contour curve provided in an embodiment of this application. MidY, MidX, and MaxX represent the midline position of the skin contour curve in the y-axis direction, the midline position in the x-axis direction, and the position of the maximum x-value, respectively. The curve located between the lines MidX and MaxX-15, to the left of the MidY line, represents the left mandibular-neck contour curve, and to the right of the MidY line, represents the right mandibular-neck contour curve. (Refer to...) Figure 5The image shown is a schematic diagram of a left mandibular neck contour curve provided in an embodiment of this application. Figure 5 and Figure 4 The left mandibular neck contour curve is consistent with the curve of the neck.

[0061] S104, perform sine curve fitting on the left and right mandibular neck contour curves respectively to obtain the left fitted sine curve and the right fitted sine curve.

[0062] In this embodiment, a sine curve can be fitted to the left mandibular neck contour curve to obtain a left-side fitted sine curve, and a sine curve can be fitted to the right mandibular neck contour curve to obtain a right-side fitted sine curve. By performing sine fitting, a smooth and continuous curve can be obtained, and the fitted sine curve will be closer to the actual mandibular neck contour curve. Moreover, the sine curve equation is simple and the computational load is small.

[0063] Specifically, refer to Figure 6 The diagram shown is a schematic representation of a left-side fitted sine curve provided in an embodiment of this application. This left-side fitted sine curve is compared with... Figure 5 The left mandibular neck contour curve corresponds to this.

[0064] The general expression for a sine curve is:

[0065] f(x) = a sin(bx + c)

[0066] The equation of the curve can be determined by any three points on the fitted sine curve on the left:

[0067] f(x)=311sin(0.003702x+6.384)

[0068] S105, determine whether the parameters of the target fitted sine curve conform to the preset curve parameters. If so, calculate the extreme points of the target fitted sine curve and use the extreme points as the first neck starting point of the target fitted sine curve.

[0069] In this embodiment of the application, preset curve parameters can be set in advance. By statistically analyzing the changes of parameter a after fitting multiple sets of mandibular and neck contour curves with different head postures, it is found that when the fitted sine curve includes the neck starting point, the value range of a is often between [150, 550]. That is, the preset curve parameters can be [150, 550].

[0070] It can be determined whether the parameters of the target fitted sine curve meet the preset curve parameters. The target fitted sine curve can be a left fitted sine curve or a right fitted sine curve. If the parameters of the target fitted sine curve are within [150, 550], it means that there is an obvious neck starting point in the corresponding mandibular neck contour curve. Then the extreme point of the target fitted sine curve can be calculated. The extreme point is the point where the first derivative is zero, and the extreme point is taken as the first neck starting point of the target fitted sine curve.

[0071] For f(x) = 311sin(0.003702x + 6.384), the coordinates of the extreme point in the interval (300, 450) are (397.08, 311). This extreme point is the starting point of the left side of the neck, i.e., the starting point of the first neck. (Reference) Figure 7 The diagram shown is a schematic representation of the location of the neck starting point according to an embodiment of this application. Figure 7 (a) in the figure shows the starting point (311, 397) of the left neck obtained by curve fitting, where x and y in the face image correspond to y and x in the skin contour curve, respectively. Figure 7 The starting point of the neck (397, 318) marked in (b) is the point on the skin contour curve that is closest to (397.08, 311).

[0072] refer to Figure 8 The image shown is a schematic diagram of the starting point of the neck located on the right side, according to an embodiment of this application. Figure 8 Image (a) is the first captured face image. Figure 8 (b) shows the corresponding skin tone contour curve. Figure 9 A schematic diagram of a right-side fitted sine curve provided in this application embodiment includes a right mandibular neck contour curve and a corresponding right-side fitted sine curve, the expression of which is:

[0073] f(x) = 532sin(0.197x + 1.618)

[0074] The extreme point of this expression in the interval x∈(300,450) is (368.33, 532), which is the corresponding right neck starting point, i.e. the first neck starting point, which is close to the actual neck starting position (358, 525) in the face image.

[0075] If the parameters of the target fitted sine curve do not conform to the preset curve parameters, and parameter a is not located in [150, 550], it means that there is no obvious neck starting point, and the neck starting point on this side cannot be determined.

[0076] Referring to Figure 10, a right mandibular neck contour curve is provided in an embodiment of this application. The curve in the boxed part of the figure has wrinkles. The two positions circled are far apart in the x direction, but have very close y minimum points. These will inevitably have a great impact on the calculation of the neck starting point.

[0077] refer to Figure 11 The diagram shown is a schematic representation of a sine curve fitting method provided in an embodiment of this application, including... Figure 10 The right mandibular neck contour curve and the corresponding right-side fitted sine curve are shown in the figure. The right-side fitted sine curve is approximately a straight line, and its expression is as follows:

[0078] f(x)=4681sin(8.292e-05x+9.289)

[0079] Since the value of parameter a in the formula is 4681, which is not within the range of [150, 550], it means that the starting point of the right neck cannot be obtained by curve fitting, and curve fitting is not applicable here.

[0080] S106, otherwise, traverse the target mandibular neck contour curve corresponding to the target fitted sine curve to determine the direction angle of the first vector and the angle between the first vector and the second vector.

[0081] When the parameters of the target fitted sine curve do not conform to the preset curve parameters, it means that the first neck starting point cannot be determined by fitting the sine curve. Considering that the target mandibular neck contour curve (left mandibular neck contour curve or right mandibular neck contour curve) will change its trend near the first neck starting point, and the mandibular neck contour curve will be concave inward, the first neck starting point can be determined according to the curve trend.

[0082] Specifically, the target mandibular neck contour curve contains a large number of pixels. Connecting each pair of pixels yields a vector, and the angle between these vectors is calculated. The magnitude of this angle is then determined to satisfy certain conditions, thus obtaining the first neck starting point. In other words, the target mandibular neck contour curve can be traversed to determine the direction angle of the first vector and the angle between the first and second vectors.

[0083] Wherein, the first vector points from the i-th pixel to the ij-th pixel, and the second vector points from the i-th pixel to the (i+j)-th pixel. The direction angle of the first vector can be the angle between the first vector and the horizontal direction. (Reference) Figure 12 The diagram shown is a schematic representation of the position of a pixel according to an embodiment of this application. The first vector can be derived from pixel A. i Pointing to pixel A i-j The vector, the second vector can be the vector of pixel A. iPointing to pixel A i+j The vector.

[0084] The orientation angle and vector angle can be calculated for each pixel, making the calculation results more accurate. Of course, to save computation, only a few pixels can be selected for calculation. Both the left and right mandibular neck contour curves contain many clustered pixels with the same y-coordinate value and extremely close positions, forming pixel groups. The number of pixels in different pixel groups is also different. Connecting such a row of pixels and calculating the angle is not very meaningful.

[0085] Then, at regular intervals, pixels can be selected to calculate the orientation angle and vector angle. For example, the extracted jaw and neck contour curve has an average of about 200 pixels, and similar pixel clusters appear approximately every 5 pixels. Therefore, pixels A can be selected every 5 pixels. i And select pixel A on both sides at intervals of 3. i-j and A i+j This saves on computation and does not affect the determination of the neck starting point.

[0086] S107, when the direction angle is within the preset direction angle range and the included angle is within the preset included angle range, the i-th pixel is taken as the first neck starting point of the target mandibular neck contour curve.

[0087] In this embodiment, a preset direction angle range and a preset included angle range can be preset. When the direction angle is within the preset direction angle range and the included angle is within the preset included angle range, it indicates that the curve turns at the i-th pixel. The i-th pixel can then be used as the first neck starting point of the target mandibular neck contour curve. Thus, when the first neck starting point cannot be determined by using sine curve fitting, the first neck starting point can be determined by judging the magnitude of the direction angle and the included angle of the vector.

[0088] In this way, the trend of the contour curve can be determined by the magnitude of the direction angle and the included angle, and then the turning point at the junction of the neck and mandible can be determined, thus serving as the first neck starting point of the left or right mandibular neck contour curve. In other words, by combining the sine curve fitting method and the angle calculation method, this application can accurately determine the first neck starting point of the left and right neck, thereby distinguishing the neck from the face and improving the accuracy of face detection.

[0089] In one possible implementation, when the target mandibular neck contour curve is the left mandibular neck contour curve, the preset direction angle range is (100°, 180°) and the preset included angle range is (90°, 170°). When the target mandibular neck contour curve is the right mandibular neck contour curve, the preset direction angle range is (0°, 80°) and the preset included angle range is (100°, 170°).

[0090] In other words, on the left mandibular neck contour curve, select pixel point A at intervals of 5 from top to bottom. i Select A at intervals of 3 on both sides of this point. i-j and A i+j Calculate the first vector Direction angle α ij The second vector and the first vector The angle β between the vectors formed ij If 100° < α ij <180° and 90° <β ij If the angle is less than 170°, then pixel A is considered to be... i This is the first starting point of the neck on the left side.

[0091] Similarly, on the right mandibular neck contour curve, select pixel point A′ from top to bottom at intervals of 5. i A′ is obtained by selecting points at intervals of 3 on both sides of the point. i-j A′ i+j Calculate the first vector. Direction angle α′ ij , second vector and the first vector The included angle β′ ij If 0° < α′ ij <80° and 100° <β′ ij If the angle is less than 170°, then pixel A′ is considered to be... i This is the first cervical starting point on the right side of the neck.

[0092] When iterating through and selecting pixels, if the coordinates of each pixel are known, then the coordinates of its vector can also be directly obtained. Taking the left contour as an example, suppose... The coordinates are (x1, y1). If the coordinates are (x2, y2), then the first vector... The expression for the direction angle is:

[0093]

[0094] First vector With the second vector The expression for the included angle is:

[0095]

[0096] Assuming the number of extracted curve pixels is n, then the value of i can be 5, 10, 15, ..., and the value of j can be 2, 7, 8, 13, ..., where i + j < n and ij > 0. If no pixel that satisfies the above angle range is found after traversing all pixels on the curve, then it is considered that no obvious neck starting position can be found on the curve.

[0097] for Figure 7 (b) The left mandibular-neck contour curve, through angle matching, yields the first neck starting point as (401, 317), which is close to the position of the first neck starting point (397.08, 311) obtained through sine curve fitting. The calculation result is relatively accurate. Furthermore, the first neck starting point obtained through this method is located on the mandibular-neck contour curve, making it even more precise. Reference Figure 13 The diagram shown is a schematic representation of the location of a first neck starting point according to an embodiment of this application. Figure 7 In (b), the coordinates of the starting point of the first neck can be determined by angle calculation as (430, 475), which is relatively accurate.

[0098] Furthermore, if the first neck starting point is not found even after traversing to the last pixel, it is determined that the first neck starting point cannot be found.

[0099] In this embodiment of the application, when there is only one first neck starting point, such as determining only the first neck starting point of the left side of the neck or the first neck starting point of the right side of the neck, it is necessary to estimate the first neck starting point of the other side based on the first neck starting point of one side.

[0100] The inventors discovered that in frontal portraits, the intersection of the face and neck—the starting point of the neck—can generally be fully displayed and its position is relatively stable. However, in non-frontal portraits, the number and position of the displayed intersection points are related to the head posture. (Reference) Figure 14 The image shown is a schematic diagram of a face image provided in an embodiment of this application. Figure 14 In (a), the area marked by the box represents the location of the two intersection points when the head is facing forward, i.e., the location of the first neck starting point. Due to different camera positions, the intersection points in the captured images may not be on the same horizontal line as in a frontal face. Figure 14(b) In the right-facing head posture, only the first neck starting point on the left side can be clearly identified. On the right side, the head and neck contours are almost a straight line, making it impossible to pinpoint the exact location of the intersection point on this side. Therefore, the first neck starting point on the right side cannot be determined. Furthermore, the head-neck intersection line varies significantly across different postures, making it impossible to fit using the same type of curve. However, the first neck starting points on the left and right sides are essentially on the same straight line. Therefore, the first neck starting point on the other side can be deduced based on the already determined first neck starting point.

[0101] Therefore, a pixel located on the horizontal line of the first neck starting point and on the skin contour curve can be used as a virtual neck starting point. In other words, the intersection of the horizontal line and the skin contour curve can be used as the first neck starting point on the other side, i.e., the virtual neck starting point. The line connecting the first neck starting point and the virtual neck starting point serves as the boundary line between the face and neck. This boundary line completely separates the face and neck, thus removing the neck region from the face image. Image recognition accuracy is higher for face images with the neck region removed.

[0102] When two first neck starting points are identified, that is, the first neck starting point on the left and the first neck starting point on the right have been determined, the line connecting the two first neck starting points can be used as the dividing line to completely separate the face and neck.

[0103] In another possible implementation, since the first neck starting point obtained by curve fitting may not be located on the actual skin contour curve, in order to improve the accuracy of the neck starting point, the pixel point on the skin contour curve that is closest to the first neck starting point can be determined as the second neck starting point. This second neck starting point is located on the skin contour curve and has relatively high accuracy.

[0104] When there is only one first neck starting point, that is, only the first neck starting point of the left neck or the first neck starting point of the right neck is determined, the pixel point located on the horizontal line of the second neck starting point and on the skin contour curve can be used as the virtual neck starting point. The line connecting the second neck starting point and the virtual neck starting point is used as the boundary line between the face and the neck. In this way, the neck starting points on the left and right sides, i.e. the second neck starting point and the virtual neck starting point, are all located on the skin contour curve. By segmenting the face and neck regions through this boundary line, the neck region can be removed more accurately, thereby more accurately determining the neck region and improving the accuracy of face image detection.

[0105] When there are two first neck starting points, that is, the neck starting points on the left and right sides have been determined, the line connecting the two second neck starting points can be used as a dividing line to distinguish the face and neck areas.

[0106] Based on the above method for determining the neck in non-frontal face images, this application also provides a device for determining the neck in non-frontal face images, referencing... Figure 15 The diagram shown is a structural block diagram of a neck determination device for a non-frontal face image provided in an embodiment of this application. The device may include:

[0107] The detection unit 201 is used to detect the first face image acquired using color space and skin color model to obtain a binarized skin color region image.

[0108] Extraction unit 202 is used to extract the contour of the skin color region image to obtain the skin color contour curve;

[0109] The cutting unit 203 is used to cut the skin contour curve according to the preset horizontal line and the preset vertical line to obtain the left mandibular neck contour curve and the right mandibular neck contour curve.

[0110] The fitting unit 204 is used to perform sine curve fitting on the left mandibular neck contour curve and the right mandibular neck contour curve respectively to obtain the left fitted sine curve and the right fitted sine curve.

[0111] The calculation unit 205 is used to determine whether the parameters of the target fitted sine curve conform to the preset curve parameters. If so, it calculates the extreme point of the target fitted sine curve and uses the extreme point as the first neck starting point of the target fitted sine curve. The target fitted sine curve is the left fitted sine curve or the right fitted sine curve.

[0112] The first determining unit 206 is used to otherwise traverse the target mandibular neck contour curve corresponding to the target fitted sine curve, determine the direction angle of the first vector, and the angle between the first vector and the second vector; the first vector is from the i-th pixel point to the ij-th pixel point, and the second vector is from the i-th pixel point to the (i+j)-th pixel point.

[0113] The second determining unit 207 is used to take the i-th pixel as the first neck starting point of the target mandibular neck contour curve when the direction angle is within a preset direction angle range and the included angle is within a preset included angle range.

[0114] Specifically, the direction of the preset horizontal line is taken as the y-axis direction, the direction of the preset vertical line is taken as the x-axis direction, the x-axis coordinate of the preset horizontal line is the midpoint of the skin contour curve in the x-axis direction, and the y-axis coordinate of the preset vertical line is the midpoint of the skin contour curve in the y-axis direction.

[0115] The left mandibular neck contour curve is a skin-colored contour curve located below the preset horizontal line and to the left of the preset vertical line, and the right mandibular neck contour curve is a skin-colored contour curve located below the preset horizontal line and to the right of the preset vertical line.

[0116] Specifically, the device further includes:

[0117] The third determining unit is used to, when the number of the first neck starting points is one, take the pixel point located on the horizontal line where the first neck starting point is located and located on the skin contour curve as the virtual neck starting point, and take the line connecting the first neck starting point and the virtual neck starting point as the dividing line between the face and the neck.

[0118] The fourth determining unit is used to determine the line connecting the two first neck starting points as the dividing line when there are two first neck starting points.

[0119] Optionally, the device further includes:

[0120] The fifth determining unit is used to determine, based on the first neck starting point, the pixel point on the skin contour curve that is closest to the first neck starting point, as the second neck starting point;

[0121] The sixth determining unit is used to, when the number of the first neck starting points is one, take the pixel point located on the horizontal line where the second neck starting point is located and located on the skin contour curve as the virtual neck starting point, and take the line connecting the second neck starting point and the virtual neck starting point as the dividing line between the face and the neck.

[0122] The seventh determining unit is used to take the line connecting the two second neck starting points as the dividing line when there are two first neck starting points.

[0123] Optionally, the detection unit is used for:

[0124] The first face image acquired is converted based on the YCgCr color space to obtain a second face image in the YCgCr color space;

[0125] The second face image is detected using the skin color model to obtain a binarized image of the skin color region.

[0126] Optionally, when the target mandibular neck contour curve is the left mandibular neck contour curve, the preset direction angle range is (100°, 180°) and the preset included angle range is (90°, 170°).

[0127] When the target mandibular neck contour curve is the right mandibular neck contour curve, the preset direction angle range is (0°, 80°) and the preset included angle range is (100°, 170°).

[0128] In another aspect, embodiments of this application provide a computer device, with reference to Figure 16 The diagram shown is a structural diagram of a computer device provided in an embodiment of this application. The computer device includes a processor 310 and a memory 320.

[0129] The memory 320 is used to store program code and transmit the program code to the processor 310;

[0130] The processor 310 is used to execute the method provided in the above embodiments according to the instructions in the program code.

[0131] The computer device may include a terminal device or a server, and the aforementioned apparatus may be configured in the computer device.

[0132] In another aspect, embodiments of this application also provide a storage medium for storing a computer program for executing the methods provided in the above embodiments.

[0133] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by program instructions in hardware. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium can be at least one of the following media: read-only memory (ROM), RAM, magnetic disk, or optical disk, etc., and other media capable of storing program code.

[0134] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on its differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0135] The above description is merely a preferred embodiment of this application. Although this application has disclosed preferred embodiments above, it is not intended to limit this application. Any person skilled in the art can make many possible variations and modifications to the technical solutions of this application using the methods and techniques disclosed above, or modify them into equivalent embodiments with equivalent changes, without departing from the scope of the technical solutions of this application. Therefore, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of this application without departing from the content of the technical solutions of this application shall still fall within the protection scope of the technical solutions of this application.

Claims

1. A method for determining the neck in a non-frontal face image, characterized in that, include: The first face image was detected using color space and skin color model to obtain a binarized skin color region image; Contour extraction is performed on the skin color region image to obtain the skin color contour curve; The skin contour curve is cut off according to the preset horizontal and vertical lines to obtain the left mandibular neck contour curve and the right mandibular neck contour curve. The left and right mandibular neck contour curves are fitted with sine curves to obtain the left fitted sine curve and the right fitted sine curve. The direction of the preset horizontal line is taken as the y-axis direction, and the direction of the preset vertical line is taken as the x-axis direction. The x-axis coordinate of the preset horizontal line is the midpoint of the skin contour curve in the x-axis direction, and the y-axis coordinate of the preset vertical line is the midpoint of the skin contour curve in the y-axis direction. The left mandibular neck contour curve is a skin-colored contour curve located below the preset horizontal line and to the left of the preset vertical line, and the right mandibular neck contour curve is a skin-colored contour curve located below the preset horizontal line and to the right of the preset vertical line. Determine whether the parameters of the target fitted sine curve conform to the preset curve parameters. If so, calculate the extreme points of the target fitted sine curve and use the extreme points as the first neck starting point of the target fitted sine curve. The target fitted sine curve is either the left fitted sine curve or the right fitted sine curve; Otherwise, the target mandibular neck contour curve corresponding to the target fitted sine curve is traversed to determine the direction angle of the first vector and the angle between the first vector and the second vector; the first vector is from the i-th pixel to the ij-th pixel, and the second vector is from the i-th pixel to the (i+j)-th pixel. When the direction angle is within a preset direction angle range and the included angle is within a preset included angle range, the i-th pixel is taken as the first neck starting point of the target mandibular neck contour curve; wherein, when the target mandibular neck contour curve is the left mandibular neck contour curve, the preset direction angle range is (100°, 180°) and the preset included angle range is (90°, 170°). When the target mandibular neck contour curve is the right mandibular neck contour curve, the preset direction angle range is (0°, 80°) and the preset included angle range is (100°, 170°).

2. The method according to claim 1, characterized in that, The method further includes: When there is only one first neck starting point, the pixel located on the horizontal line where the first neck starting point is located and on the skin contour curve is used as the virtual neck starting point, and the line connecting the first neck starting point and the virtual neck starting point is used as the dividing line between the face and the neck. When there are two first neck starting points, the line connecting the two first neck starting points is used as the dividing line.

3. The method according to claim 1, characterized in that, The method further includes: Based on the first neck starting point, determine the pixel point on the skin contour curve that is closest to the first neck starting point, and use it as the second neck starting point; When there is only one first neck starting point, the pixel located on the horizontal line of the second neck starting point and on the skin contour curve is used as the virtual neck starting point, and the line connecting the second neck starting point and the virtual neck starting point is used as the dividing line between the face and the neck. When there are two first neck starting points, the line connecting the two second neck starting points is used as the dividing line.

4. The method according to claim 1, characterized in that, The step of detecting the acquired first face image using color space and skin color model to obtain a binarized skin color region image includes: The first face image acquired is converted based on the YCgCr color space to obtain a second face image in the YCgCr color space; The second face image is detected using the skin color model to obtain a binarized image of the skin color region.

5. A neck determination device for non-frontal facial images, characterized in that, include: The detection unit is used to detect the first face image acquired using color space and skin color model, and obtain a binarized skin color region image. The extraction unit is used to extract the contour of the skin color region image to obtain the skin color contour curve; The cropping unit is used to crop the skin contour curve according to the preset horizontal line and the preset vertical line to obtain the left mandibular neck contour curve and the right mandibular neck contour curve. The fitting unit is used to perform sine curve fitting on the left mandibular neck contour curve and the right mandibular neck contour curve respectively to obtain the left fitted sine curve and the right fitted sine curve; the direction of the preset horizontal line is taken as the y-axis direction, the direction of the preset vertical line is taken as the x-axis direction, the x-axis coordinate of the preset horizontal line is the midpoint of the skin contour curve in the x-axis direction, and the y-axis coordinate of the preset vertical line is the midpoint of the skin contour curve in the y-axis direction; The left mandibular neck contour curve is a skin-colored contour curve located below the preset horizontal line and to the left of the preset vertical line, and the right mandibular neck contour curve is a skin-colored contour curve located below the preset horizontal line and to the right of the preset vertical line. The calculation unit is used to determine whether the parameters of the target fitted sine curve conform to the preset curve parameters. If so, the extreme point of the target fitted sine curve is calculated and the extreme point is used as the first neck starting point of the target fitted sine curve. The target fitted sine curve is either the left fitted sine curve or the right fitted sine curve; The first determining unit is used to otherwise traverse the target mandibular neck contour curve corresponding to the target fitted sine curve, determine the direction angle of the first vector, and the angle between the first vector and the second vector; the first vector is from the i-th pixel to the ij-th pixel, and the second vector is from the i-th pixel to the (i+j)-th pixel. The second determining unit is used to determine the i-th pixel as the first neck starting point of the target mandibular neck contour curve when the direction angle is within a preset direction angle range and the included angle is within a preset included angle range; wherein, when the target mandibular neck contour curve is the left mandibular neck contour curve, the preset direction angle range is (100°, 180°) and the preset included angle range is (90°, 170°). When the target mandibular neck contour curve is the right mandibular neck contour curve, the preset direction angle range is (0°, 80°) and the preset included angle range is (100°, 170°).

6. A computer device, characterized in that, The computer device includes a processor and memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the method described in any one of claims 1-4 according to the instructions in the program code.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program for performing the method according to any one of claims 1-4.

Citation Information

Patent Citations

  • Method for extracting front human face outline based on complexion model and shape constraining

    CN101650782A

  • Particles for imaging

    CN101868180A