Method and apparatus for detecting the integrity of human head

By obtaining the head bounding box of a human face through face detection and segmentation algorithms, and combining it with preset operators and cropping detection methods, the problem of incomplete detection and slow speed in existing technologies is solved, and comprehensive and rapid detection of the integrity of the human head is achieved.

CN114708244BActive Publication Date: 2025-10-28XIAMEN HUANLEGUANG TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210419507.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-20
Publication Date
2025-10-28
Estimated Expiration
2042-04-20

AI Technical Summary

Technical Problem

Existing methods for detecting the integrity of human heads are incomplete and slow, and cannot effectively determine whether the human head in a face image is complete.

Method used

By acquiring face images, face detection algorithms and portrait segmentation algorithms are used to obtain the head bounding box of the portrait, determine whether it exceeds the image boundary, and perform crop detection using preset operators, including judgment of horizontal, vertical and diagonal cropping. Convolution and Hough line judgment methods are used for integrity detection.

Benefits of technology

It enables more comprehensive integrity detection of human heads, improving detection speed and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114708244B_ABST
    Figure CN114708244B_ABST
Patent Text Reader

Abstract

This disclosure relates to a method and apparatus for detecting the integrity of a human head. The method includes: acquiring a face image; obtaining a head bounding box based on the face image; determining whether the head bounding box exceeds the boundary of the face image; if the head bounding box exceeds the boundary of the face image, determining that the head in the face image is incomplete; if the head bounding box does not exceed the boundary of the face image, performing cropping detection based on the head bounding box and a preset operator to obtain a head integrity detection result. The solution of this disclosure allows for more comprehensive head integrity detection and improves detection speed and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure generally relates to the field of image processing technology. More specifically, this disclosure relates to a method and apparatus for detecting the integrity of a human head. Background Technology

[0002] Currently, face image detection is being used in a wide range of fields. Face images can be presented in the form of pictures, photos, etc. Due to concerns about whether the head of the person in the image is complete, caution is needed when using these face images. It is necessary to detect the face image before use to determine whether the head of the person in the face image is complete.

[0003] Traditional methods for detecting the integrity of human heads suffer from problems such as incomplete detection, slow speed, and unclear extraction. Summary of the Invention

[0004] In order to at least partially solve the technical problems mentioned in the background art, the present disclosure provides a method and apparatus for detecting the integrity of a human head.

[0005] According to a first aspect of this disclosure, a method for detecting the integrity of a human head is provided. The method includes: acquiring a face image; obtaining a human head bounding box based on the face image; determining whether the human head bounding box exceeds the boundary of the face image; when the human head bounding box exceeds the boundary of the face image, determining that the human head in the face image is incomplete; when the human head bounding box does not exceed the boundary of the face image, performing cropping detection based on the human head bounding box and a preset operator to obtain a human head integrity detection result.

[0006] Optionally, obtaining the head bounding box based on the face image includes: obtaining a face bounding box using a face detection algorithm for the face image; obtaining a binarized image including the face outline and background using a face segmentation algorithm for the face image, and obtaining the top coordinates of the head using the face outline; and obtaining the head bounding box in the binarized image based on the face bounding box and the top coordinates of the head.

[0007] Optionally, determining whether the head bounding box of the portrait exceeds the boundary of the face image includes: obtaining the normalized coordinates of the head bounding box; and determining whether the head bounding box of the portrait exceeds the boundary of the face image based on the normalized coordinates.

[0008] Optionally, the preset operator includes a first preset operator and a second preset operator. When the head bounding box does not exceed the boundary of the face image, performing cropping detection based on the head bounding box and the preset operator to obtain a head integrity detection result includes: determining whether the head is horizontally cropped based on the head bounding box and the first preset operator; if the head is horizontally cropped, determining that the head in the face image is incomplete; if the head is not horizontally cropped, determining whether the head is vertically cropped based on the head bounding box and the second preset operator; if the head is vertically cropped, determining that the head in the face image is incomplete; if the head is not vertically cropped, determining whether the head is obliquely cropped, to obtain the head integrity detection result.

[0009] Optionally, determining whether a portrait head is horizontally cropped based on the portrait head bounding box and the first preset operator includes: enlarging the portrait head bounding box according to a preset rule; cropping the image within the enlarged portrait head bounding box to obtain a cropping detection image; performing convolution on the cropping detection image using the first preset operator to obtain a first response image; calculating the sum of gray values ​​of each row of pixels based on the first response image; calculating the proportion of the sum of gray values ​​of each row of pixels in the sum of gray values ​​of all pixels in the first response image; determining that the portrait head is horizontally cropped when any of the proportions is greater than a first preset threshold, and determining that the portrait head is not horizontally cropped when all the proportions are less than or equal to the first preset threshold.

[0010] Optionally, determining whether the portrait head is vertically cropped based on the portrait head bounding box and the second preset operator includes: performing convolution on the image to be cropped using the second preset operator to obtain a second response map; calculating the sum of gray values ​​of each column of pixels based on the second response map; calculating the proportion of the sum of gray values ​​of each column of pixels in the sum of gray values ​​of all pixels in the second response map; determining that the portrait head is vertically cropped when any of the proportions is greater than a second preset threshold, and determining that the portrait head is not vertically cropped when all the proportions are less than or equal to the second preset threshold.

[0011] Optionally, determining whether the portrait head is obliquely cropped to obtain the portrait head integrity detection result includes: adding the first response image and the second response image to form a composite image; searching for a straight line using the Hough line method on the composite image; when no straight line is found, the portrait head is not obliquely cropped, and the portrait head in the face image is determined to be complete; when a straight line is found, the length of the straight line is obtained based on the coordinates of its endpoints; when the ratio of the length of the straight line to the width of the face frame is greater than a third preset threshold, the portrait head is obliquely cropped, and the portrait head in the face image is determined to be incomplete; when the ratio of the length of the straight line to the width of the face frame is less than or equal to the third preset threshold, the portrait head is not obliquely cropped, and the portrait head in the face image is determined to be complete.

[0012] According to a second aspect of this disclosure, a human head integrity detection device is provided, wherein the device includes: a first acquisition module for acquiring a face image; a second acquisition module for obtaining a human head bounding box based on the face image; an over-boundary judgment module for determining whether the human head bounding box exceeds the boundary of the face image, and determining that the human head in the face image is incomplete when the human head bounding box exceeds the boundary of the face image; and a cropping detection module for performing cropping detection based on the human head bounding box and a preset operator when the human head bounding box does not exceed the boundary of the face image, thereby obtaining a human head integrity detection result.

[0013] Optionally, the second acquisition module is used to obtain a head bounding box based on the face image in the following manner: for the face image, a face bounding box is obtained by a face detection algorithm; for the face image, a binary image including the face outline and background is obtained by a face segmentation algorithm, and the top coordinates of the face head are obtained by the face outline; the head bounding box is obtained in the binary image based on the face bounding box and the top coordinates of the face head.

[0014] Optionally, the boundary judgment module is used to determine whether the portrait head frame exceeds the boundary of the face image by: obtaining the normalized coordinates of the portrait head frame; and determining whether the portrait head frame exceeds the boundary of the face image based on the normalized coordinates.

[0015] Optionally, the preset operator includes a first preset operator and a second preset operator. The cropping detection module is used to perform cropping detection based on the portrait head frame when the portrait head frame does not exceed the boundary of the face image, thereby obtaining a portrait head integrity detection result: based on the portrait head frame and the first preset operator, it is determined whether the portrait head is horizontally cropped. If the portrait head is horizontally cropped, it is determined that the portrait head in the face image is incomplete. If the portrait head is not horizontally cropped, it is determined whether the portrait head is vertically cropped based on the portrait head frame and the second preset operator. If the portrait head is vertically cropped, it is determined that the portrait head in the face image is incomplete. If the portrait head is not vertically cropped, it is determined whether the portrait head is obliquely cropped, thereby obtaining the portrait head integrity detection result.

[0016] Optionally, the cropping detection module is used to determine whether the portrait head is horizontally cropped based on the portrait head frame and the first preset operator in the following manner: enlarging the portrait head frame according to a preset rule; cropping the image within the enlarged portrait head frame to obtain a cropping detection image; performing convolution on the cropping detection image using the first preset operator to obtain a first response image; calculating the sum of gray values ​​of each row of pixels based on the first response image; calculating the proportion of the sum of gray values ​​of each row of pixels in the sum of gray values ​​of all pixels in the first response image; determining that the portrait head is horizontally cropped when any of the proportions is greater than a first preset threshold, and determining that the portrait head is not horizontally cropped when all the proportions are less than or equal to the first preset threshold.

[0017] Optionally, the cropping detection module is used to determine whether the portrait head is vertically cropped based on the portrait head bounding box and the second preset operator in the following manner: using the second preset operator to perform convolution on the image to be cropped to obtain a second response map; according to the second response map, the sum of gray values ​​of each column of pixels is calculated; the proportion of the sum of gray values ​​of each column of pixels in the sum of gray values ​​of all pixels in the second response map is calculated; when any of the proportions is greater than the second preset threshold, it is determined that the portrait head is vertically cropped, and when all the proportions are less than or equal to the second preset threshold, it is determined that the portrait head is not vertically cropped.

[0018] Optionally, the cropping detection module is used to determine whether the portrait head is obliquely cropped in the following manner to obtain the portrait head integrity detection result: the first response image and the second response image are added together to form a composite image; for the composite image, a straight line is searched using the Hough line judgment method; when no straight line is found, the portrait head is not obliquely cropped, and the portrait head in the face image is determined to be complete; when a straight line is found, the length of the straight line is obtained according to the coordinates of the endpoints of the straight line; when the ratio of the length of the straight line to the width of the face frame is greater than a third preset threshold, the portrait head is obliquely cropped, and the portrait head in the face image is determined to be incomplete; when the ratio of the length of the straight line to the width of the face frame is less than or equal to the third preset threshold, the portrait head is not obliquely cropped, and the portrait head in the face image is determined to be complete.

[0019] According to a third aspect of this disclosure, an electronic device is provided, wherein the electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method of the first aspect of this disclosure described above.

[0020] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided, wherein the storage medium stores a computer program that, when executed, implements the method of the first aspect of this disclosure.

[0021] The present invention discloses a method and apparatus for detecting the integrity of human heads, which enables more comprehensive integrity detection of human heads and improves detection speed and accuracy. Attached Figure Description

[0022] The above and other objects, features, and advantages of this disclosure will become readily apparent from the following detailed description of exemplary embodiments with reference to the accompanying drawings. In the drawings, several embodiments of this disclosure are illustrated by way of example and not limitation, and like or corresponding reference numerals denote like or corresponding parts, wherein:

[0023] Figure 1 This is a flowchart illustrating a method for detecting the integrity of a human head according to an embodiment of the present disclosure;

[0024] Figure 2 This is a schematic block diagram illustrating a human head integrity detection device according to an embodiment of the present disclosure. Detailed Implementation

[0025] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.

[0026] The specific embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.

[0027] This disclosure provides a method for detecting the integrity of a human head. (Refer to...) Figure 1 , Figure 1 This is a flowchart illustrating a method for detecting the integrity of a human head according to an embodiment of the present disclosure. Figure 1 As shown, the portrait head integrity detection method includes the following steps S101-S104. Step S101: Acquire a face image. Step S102: Obtain a portrait head bounding box based on the face image. Step S103: Determine whether the portrait head bounding box exceeds the boundary of the face image. If the portrait head bounding box exceeds the boundary of the face image, it is determined that the portrait head in the face image is incomplete. Step S104: When the portrait head bounding box does not exceed the boundary of the face image, perform cropping detection based on the portrait head bounding box and a preset operator to obtain a portrait head integrity detection result.

[0028] According to embodiments of this disclosure, to detect whether the head of a person in a face image is complete, it can first be determined whether the head exceeds the boundary of the face image. If it does not exceed the boundary, a preset operator is used to detect whether the head is incomplete due to cropping. In practical applications, for example, sometimes when shooting a portrait, due to various reasons, the head is not fully captured, resulting in part of the head not being within the image. If reshooting is not possible, computer technology may be used to adjust the position of the portrait, placing the incomplete head in the middle of the image or in another position within the image. In this case, the head will form a straight-line cropping effect. Of course, the incompleteness of the head can also be caused by various other reasons. This disclosure aims to detect any straight-line incompleteness of the head.

[0029] The portrait head integrity detection method disclosed herein can achieve more comprehensive integrity detection by detecting beyond the boundary and cropping, and improves detection speed and accuracy by using preset operators.

[0030] In step S101, a face image can be acquired.

[0031] According to embodiments of this disclosure, in order to detect whether the head of a person in a face image is complete, it is first necessary to acquire the face image to be detected. The face image can be a photograph or picture containing at least a portion of a human head.

[0032] In step S102, a head outline of the human face can be obtained based on the face image.

[0033] According to embodiments of this disclosure, after obtaining a face image, a head bounding box can be obtained from the face image.

[0034] Specifically, obtaining the head bounding box of the face image may include: obtaining a face bounding box from the face image using a face detection algorithm; obtaining a binarized image including the face outline and background from the face image using a face segmentation algorithm, and obtaining the top coordinates of the head from the face outline; and obtaining the head bounding box from the binarized image based on the face bounding box and the top coordinates of the head.

[0035] In this embodiment, the head bounding box of a person can be obtained using the face bounding box and the coordinates of the top of the head. The face bounding box can be obtained from the face image using a face detection algorithm. This face detection algorithm can include general object detection algorithms, such as the YOLO series algorithms, CenterNet, etc., or specialized face detection algorithms, such as MTCNN, CenterFace, PCN, etc., without limitation. The coordinates of the top of the head can be obtained using image segmentation algorithms such as Mask R-CNN, DeepLabv3, BiSeNet, UNet, etc. Specifically, a binary image including the face contour and background can be obtained using an image segmentation algorithm, and the coordinates of the top of the head can be obtained using the face contour and the coordinate system of the binary image. The origin of the coordinate system of the binary image is the top-left corner vertex of the image, and the coordinates of each pixel can be obtained by moving right and down from the origin, using a single pixel as the coordinate gradient. It is worth noting that the image segmentation algorithm described above separates the human face contour from the background in the face image and forms a binary image. The grayscale value of the pixels within the human face contour is 255, while the grayscale value of the background pixels outside the human face contour is 0. Finally, the obtained face bounding box is transferred to the binary image, and the x and y coordinates of each corresponding pixel of the face bounding box can be obtained. The face bounding box includes four borders: top, bottom, left, and right. The y coordinate of the top border of the face bounding box is changed to the y coordinate of the top of the human head to form a new top border. The left and right borders are extended or shortened and combined with the new top border to form the human head bounding box on the binary image.

[0036] It should be understood that the bounding box obtained by face detection algorithms can extend beyond the face image, while the portrait contour obtained by image segmentation algorithms is limited to the face image and will not extend beyond it. If the top of the portrait's head extends beyond the upper boundary of the image, meaning that part of the top of the portrait's head does not exist in the face image, the image segmentation algorithm will directly use part of the upper edge of the face image corresponding to the portrait's head as part of the portrait contour. In this case, the coordinates of the upper edge of the face image are the coordinates of the top of the portrait's head, i.e., the ordinate is 0. Thus, the upper edge of the face image is used as the upper bounding line of the portrait's head bounding box. If the portrait's face extends beyond the side and lower boundaries of the image, meaning that part of the portrait's face does not exist in the face image, the image segmentation algorithm will directly use part of the side or lower edge of the face image corresponding to the portrait's head as part of the portrait contour. However, since the bounding box can extend beyond the face image and the bounding box itself includes the face, the side and lower bounding lines of the bounding box are used as the side and lower bounding lines of the portrait's head bounding box.

[0037] In step S103, it can be determined whether the head frame of the portrait exceeds the boundary of the face image. When the head frame of the portrait exceeds the boundary of the face image, it is determined that the head of the portrait in the face image is incomplete.

[0038] According to embodiments of this disclosure, after obtaining the head bounding box in the binarized image, the head bounding box can be transferred to the corresponding position in the face image, and then the head bounding box can be used to determine whether the head exceeds the boundary of the face image. In fact, the binarized image is obtained from the face image without any changes to the number or arrangement of pixels; therefore, it is also possible to determine whether the head exceeds the boundary of the binarized image, which is equivalent to determining whether the head exceeds the boundary of the face image.

[0039] Specifically, determining whether the head bounding box of the portrait exceeds the boundary of the face image may include: obtaining the normalized coordinates of the head bounding box; and determining whether the head bounding box of the portrait exceeds the boundary of the face image based on the normalized coordinates.

[0040] In this embodiment, normalized coordinates refer to coordinates with values ​​ranging from [0,1]. Based on the coordinate system of the face image, the coordinates of each pixel in the face image are normalized. Therefore, the coordinates of the top-left vertex (origin) of the face image are (0,0), and the coordinates of the bottom-right vertex are (1,1). Since the coordinates of the face bounding box and the top of the head can be obtained using various algorithms, the final coordinates of the head bounding box can be either normalized or unnormalized. If the coordinates of the head bounding box are unnormalized, they are normalized first.

[0041] After obtaining the normalized coordinates of the head bounding box, when the ordinate of the top bounding box is equal to 0, the x-coordinate of the left bounding box is less than or equal to 0, the x-coordinate of the right bounding box is greater than or equal to 1, or the ordinate of the bottom bounding box is greater than or equal to 1, it can be determined that the head bounding box exceeds the boundary of the face image, thus determining that the head is incomplete in the face image.

[0042] In step S104, when the head frame does not exceed the boundary of the face image, cropping detection is performed based on the head frame and a preset operator to obtain the head integrity detection result.

[0043] According to an embodiment of this disclosure, when the head frame does not exceed the boundary of the face image, a further detection step is required, namely, cropping detection based on the head frame and a preset operator.

[0044] Furthermore, the preset operator may include a first preset operator and a second preset operator. Therefore, when the head bounding box does not exceed the boundary of the face image, performing cropping detection based on the head bounding box and the preset operator to obtain a head integrity detection result may include: determining whether the head is horizontally cropped based on the head bounding box and the first preset operator; if the head is horizontally cropped, determining that the head in the face image is incomplete; if the head is not horizontally cropped, determining whether the head is vertically cropped based on the head bounding box and the second preset operator; if the head is vertically cropped, determining that the head in the face image is incomplete; and if the head is not vertically cropped, determining whether the head is obliquely cropped, to obtain the head integrity detection result.

[0045] In this embodiment, when the head bounding box does not exceed the boundary of the face image, horizontal, vertical, and diagonal cropping detections can be performed sequentially on the head in the face image. Detection stops as soon as any one of these cropping conditions is detected, and the result of incomplete head detection in the face image is directly obtained. Only after all three cropping detections have been completed and no cropping condition exists will a result of complete head detection be obtained. In this way, a comprehensive and rapid determination of whether the head is complete can be made.

[0046] For detecting horizontal cropping, determining whether a portrait head is horizontally cropped based on the portrait head bounding box and the first preset operator may include: enlarging the portrait head bounding box according to a preset rule; cropping the image within the enlarged portrait head bounding box to obtain a cropping detection image; performing convolution on the cropping detection image using the first preset operator to obtain a first response image; calculating the sum of gray values ​​of each row of pixels based on the first response image; calculating the proportion of the sum of gray values ​​of each row of pixels in the sum of gray values ​​of all pixels in the first response image; determining that the portrait head is horizontally cropped when any of the proportions is greater than a first preset threshold, and determining that the portrait head is not horizontally cropped when all the proportions are less than or equal to the first preset threshold.

[0047] According to this embodiment, to determine whether a portrait head is horizontally cropped, the portrait head bounding box in the binarized image is first enlarged. This can be done by enlarging the portrait head bounding box by 10% vertically and 10% horizontally. When the portrait head bounding box expands by 10% in any direction (vertical, horizontal, or vertical) beyond the edge of the binarized image, that edge is used as the enlarged bounding box line. Then, the image within the enlarged portrait head bounding box is extracted as the binarized image to be cropped and detected. This image includes the portrait head outline and the background; the grayscale value within the portrait head outline is 255, and the grayscale value of the background is 0.

[0048] After obtaining the image to be cropped, a first preset operator is used to perform convolution on the image, that is, convolution is performed using the first preset operator and the gray value matrix composed of all pixel gray values ​​in the image to be cropped. The first preset operator is... The grayscale matrix contains elements of 0 and 255. To obtain an image of the same size as the image to be cropped after convolution, the grayscale matrix is ​​expanded by extending it vertically and horizontally by one row, forming a new first row and a new last row. The pixel grayscale values ​​in the new first row are the same as those in the original first row, and the pixel grayscale values ​​in the new last row are the same as those in the original last row. After convolution, elements with negative values ​​in the resulting matrix are set to 0, thus obtaining a response map with the same number of pixel rows and columns as the image to be cropped. This response map also contains only 0 and 255 pixel grayscale values.

[0049] After obtaining the response image, the sum of the grayscale values ​​of each row of pixels in the response image is calculated, and the sum of the grayscale values ​​of all pixels in the response image is also calculated. Then, the proportion of the sum of the grayscale values ​​of each row of pixels in the total sum of the grayscale values ​​of all pixels in the response image is calculated. When any of the proportions is greater than a first preset threshold, it is determined that the portrait head is horizontally cropped; when all the proportions are less than or equal to the first preset threshold, it is determined that the portrait head is not horizontally cropped. The first preset threshold can be, for example, 60%.

[0050] For detecting vertical cropping, determining whether the portrait head has vertical cropping based on the portrait head bounding box and the second preset operator includes: performing convolution on the grayscale image using the second preset operator to obtain a second response map; calculating the sum of grayscale values ​​of each column of pixels based on the second response map; calculating the proportion of the sum of grayscale values ​​of each column of pixels in the sum of grayscale values ​​of all pixels in the second response map; determining that the portrait head has vertical cropping when any of the proportions is greater than a second preset threshold, and determining that the portrait head does not have vertical cropping when all the proportions are less than or equal to the second preset threshold.

[0051] According to this embodiment, a first preset operator is used to perform convolution on the image to be cropped obtained above, that is, convolution is performed using a second preset operator with a grayscale value matrix composed of all pixel grayscale values ​​in the image to be cropped. The second preset operator is [-1 2 -1], and the second preset operator and the first preset operator are transposes of each other. The elements in the grayscale value matrix include 0 and 255. In order to obtain an image of the same size as the image to be cropped after convolution, the grayscale value matrix is ​​expanded, that is, expanded by one column on each side to form a new first column and a new last column. The pixel grayscale values ​​in the new first column are the same as those in the original first column, and the pixel grayscale values ​​in the new last column are the same as those in the original last column. After convolution, the elements with negative values ​​in the obtained matrix are set to 0, thereby obtaining a response map with the same number of pixel rows and columns as the image to be cropped. The pixel grayscale values ​​in this response map also only include 0 and 255.

[0052] After obtaining the response image, the sum of the grayscale values ​​of each column of pixels in the response image is calculated, and the sum of the grayscale values ​​of all pixels in the response image is also calculated. Then, the proportion of the sum of the grayscale values ​​of each column of pixels in the sum of the grayscale values ​​of all pixels in the response image is calculated. When any of the proportions is greater than a second preset threshold, it is determined that the portrait head has vertical cropping. When all the proportions are less than or equal to the second preset threshold, it is determined that the portrait head does not have vertical cropping. The second preset threshold can be the same as the first preset threshold, which is 60%.

[0053] According to embodiments of this disclosure, convolution is performed on the binarized image to be cropped using a preset operator to obtain a response map reflecting abrupt changes in grayscale values, thereby obtaining white pixels against a black background. Especially in the case of linear cropping, a white straight line can be obtained. Therefore, the grayscale ratio of this white straight line can be used to determine whether a person's head has been cropped. Thus, integrity detection using the preset operator is more accurate and faster.

[0054] For detecting oblique cropping, determining whether the portrait head is obliquely cropped to obtain a portrait head integrity detection result may include: adding the first response image and the second response image to form a composite image; searching for a straight line using the Hough line method on the composite image; if no straight line is found, the portrait head is not obliquely cropped, and the portrait head in the face image is determined to be complete; if a straight line is found, the length of the straight line is obtained based on the coordinates of its endpoints; if the ratio of the length of the straight line to the width of the face frame is greater than a third preset threshold, the portrait head is obliquely cropped, and the portrait head in the face image is determined to be incomplete; if the ratio of the length of the straight line to the width of the face frame is less than or equal to the third preset threshold, the portrait head is not obliquely cropped, and the portrait head in the face image is determined to be complete.

[0055] According to this embodiment, the first response image and the second response image are overlapped and added together to obtain a composite image, wherein the grayscale values ​​of the pixels in the composite image include 0, 255 and 510.

[0056] For the composite image, the Hough line method can be used to search for straight lines in the composite image. When no straight line is found, the head of the face is not obliquely cropped, and the head of the face image is considered complete. When a straight line is found, its length is calculated based on the coordinates of its endpoints, and the length of the straight line can be used to determine whether the head of the face is obliquely cropped.

[0057] Specifically, when the ratio of the length of the straight line to the width of the face frame is greater than a third preset threshold, the head of the face is obliquely cropped, and the head in the face image is determined to be incomplete. When the ratio of the length of the straight line to the width of the face frame is less than or equal to the third preset threshold, the head of the face is not obliquely cropped, and the head in the face image is determined to be complete. The third preset threshold can be, for example, 50%.

[0058] According to embodiments of this disclosure, by superimposing and synthesizing the response maps obtained from horizontal and vertical cut detection, the white grayscale value can be made more obvious, which is more advantageous for the Hough line judgment method to search for oblique lines.

[0059] This disclosure also provides a device for detecting the integrity of a human head. This device is used to perform the above-mentioned combination. Figure 1 The steps described in an embodiment of a method for detecting the integrity of a human head.

[0060] Reference Figure 2 , Figure 2 This is a schematic block diagram illustrating a human head integrity detection device according to an embodiment of the present disclosure. Figure 2 As shown, the portrait head integrity detection device 100 includes a first acquisition module 101, a second acquisition module 102, an over-boundary judgment module 103, and a cropping detection module 104. The first acquisition module 101 is used to acquire a face image. The second acquisition module 102 is used to obtain a portrait head bounding box based on the face image. The over-boundary judgment module 103 is used to determine whether the portrait head bounding box exceeds the boundary of the face image; when the portrait head bounding box exceeds the boundary of the face image, it is determined that the portrait head in the face image is incomplete. The cropping detection module 104 is used to perform cropping detection based on the portrait head bounding box and a preset operator when the portrait head bounding box does not exceed the boundary of the face image, thereby obtaining a portrait head integrity detection result.

[0061] According to an embodiment of this disclosure, the second acquisition module 102 is used to obtain a head bounding box of a human face based on the face image in the following manner: for the face image, a face bounding box is obtained by a face detection algorithm; for the face image, a binary image including the human face contour and background is obtained by a human face segmentation algorithm, and the top coordinates of the human face are obtained by the human face contour; the head bounding box of the human face is obtained in the binary image based on the face bounding box and the top coordinates of the human face.

[0062] According to an embodiment of this disclosure, the super-boundary judgment module 103 is used to determine whether the portrait head frame exceeds the boundary of the face image by: obtaining the normalized coordinates of the portrait head frame; and determining whether the portrait head frame exceeds the boundary of the face image based on the normalized coordinates.

[0063] According to embodiments of this disclosure, the preset operator includes a first preset operator and a second preset operator. The cropping detection module 104 is used to perform cropping detection based on the portrait head frame when the portrait head frame does not exceed the boundary of the face image, thereby obtaining a portrait head integrity detection result: based on the portrait head frame and the first preset operator, it is determined whether the portrait head is horizontally cropped; when the portrait head is horizontally cropped, it is determined that the portrait head in the face image is incomplete; when the portrait head is not horizontally cropped, it is determined whether the portrait head is vertically cropped based on the portrait head frame and the second preset operator; when the portrait head is vertically cropped, it is determined that the portrait head in the face image is incomplete; when the portrait head is not vertically cropped, it is determined whether the portrait head is obliquely cropped, thereby obtaining the portrait head integrity detection result.

[0064] According to an embodiment of this disclosure, the cropping detection module 104 is used to determine whether a portrait head is horizontally cropped based on the portrait head frame and the first preset operator in the following manner: enlarging the portrait head frame according to a preset rule; cropping the image within the enlarged portrait head frame to obtain a cropping detection image; performing convolution on the cropping detection image using the first preset operator to obtain a first response image; calculating the sum of gray values ​​of each row of pixels based on the first response image; calculating the proportion of the sum of gray values ​​of each row of pixels in the sum of gray values ​​of all pixels in the first response image; determining that the portrait head is horizontally cropped when any of the proportions is greater than a first preset threshold, and determining that the portrait head is not horizontally cropped when all the proportions are less than or equal to the first preset threshold.

[0065] According to an embodiment of this disclosure, the cropping detection module 104 is used to determine whether the portrait head is vertically cropped based on the portrait head frame and the second preset operator in the following manner: performing convolution on the image to be cropped using the second preset operator to obtain a second response map; calculating the sum of gray values ​​of each column of pixels based on the second response map; calculating the proportion of the sum of gray values ​​of each column of pixels in the sum of gray values ​​of all pixels in the second response map; determining that the portrait head is vertically cropped when any of the proportions is greater than a second preset threshold, and determining that the portrait head is not vertically cropped when all the proportions are less than or equal to the second preset threshold.

[0066] According to an embodiment of this disclosure, the cropping detection module 104 is used to determine whether the portrait head is obliquely cropped in the following manner to obtain the portrait head integrity detection result: the first response image and the second response image are added together to form a composite image; for the composite image, a straight line is searched using the Hough line judgment method; when no straight line is found, the portrait head is not obliquely cropped, and the portrait head in the face image is determined to be complete; when a straight line is found, the length of the straight line is obtained according to the coordinates of the endpoints of the straight line; when the ratio of the length of the straight line to the width of the face frame is greater than a third preset threshold, the portrait head is obliquely cropped, and the portrait head in the face image is determined to be incomplete; when the ratio of the length of the straight line to the width of the face frame is less than or equal to the third preset threshold, the portrait head is not obliquely cropped, and the portrait head in the face image is determined to be complete.

[0067] It is understandable that the above references Figure 2 The human head integrity detection device described in the embodiments, wherein the specific manner in which each module performs its operation has been incorporated into the embodiment. Figure 1 The embodiments of the described method for detecting the integrity of a human head have been described in detail, and will not be elaborated upon here.

[0068] This disclosure also provides an electronic device, wherein the electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the combination... Figure 1 The described method for detecting the integrity of a human head.

[0069] It is understood that the steps implemented by the processor when executing the computer program are basically the same as the implementation of each step in the above method. The specific implementation has been described in detail in the embodiments of the method for detecting the integrity of human head, and will not be elaborated here.

[0070] In another aspect, this disclosure provides a computer-readable storage medium storing a computer program that, when executed, implements the combination... Figure 1 The described method for detecting the integrity of a human head.

[0071] It is understood that the steps implemented by the processor when executing the computer program are basically the same as the implementation of each step in the above method. The specific implementation has been described in detail in the embodiments of the method for detecting the integrity of human head, and will not be elaborated here.

[0072] The embodiments of this disclosure have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this disclosure. The description of the above embodiments is only for the purpose of helping to understand the methods and core ideas of this disclosure. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this disclosure. Therefore, the content of this specification should not be construed as a limitation of this disclosure.

[0073] It should be understood that the terms "first" and "second," etc., in the claims, specification, and drawings of this disclosure are used to distinguish different objects, not to describe a specific order. The terms "comprising" and "including" as used in the specification and claims of this disclosure indicate the presence of the described features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof.

[0074] It should also be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this disclosure. As used in this disclosure and claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this disclosure and claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations.

[0075] The embodiments of this disclosure have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this disclosure. The descriptions of the embodiments above are only for the purpose of helping to understand the methods and core ideas of this disclosure. Furthermore, any changes or modifications made by those skilled in the art based on the ideas of this disclosure, and on the specific implementation methods and application scope of this disclosure, are all within the scope of protection of this disclosure. Therefore, the content of this specification should not be construed as a limitation of this disclosure.

Claims

1. A method for detecting the integrity of a human head, wherein, The method includes: Acquire facial images; Based on the facial image, obtain the head bounding box of the portrait; Determine whether the head frame of the portrait exceeds the boundary of the face image. When the head frame of the portrait exceeds the boundary of the face image, determine that the head of the portrait in the face image is incomplete. When the head bounding box does not exceed the boundary of the face image, cropping detection is performed based on the head bounding box and a preset operator to obtain the head integrity detection result. The preset operator includes a first preset operator and a second preset operator. When the head bounding box does not exceed the boundary of the face image, cropping detection is performed based on the head bounding box and the preset operator to obtain the head integrity detection result, including: Based on the portrait head frame and the first preset operator, it is determined whether the portrait head is horizontally cropped. When the portrait head is horizontally cropped, it is determined that the portrait head in the face image is incomplete. When the portrait head is not horizontally cropped, the portrait head frame and the second preset operator are used to determine whether the portrait head is vertically cropped. When the portrait head is vertically cropped, the portrait head in the face image is determined to be incomplete. When the portrait head is not vertically cut, determine whether the portrait head is obliquely cut to obtain the integrity detection result of the portrait head.

2. The method for detecting the integrity of a human head according to claim 1, wherein, The step of obtaining the head bounding box based on the face image includes: For the aforementioned face image, a face bounding box is obtained using a face detection algorithm; For the face image, a binary image including the face outline and background is obtained by a face segmentation algorithm, and the coordinates of the top of the face are obtained by the face outline; The head bounding box of the human face is obtained in the binarized image based on the face bounding box and the coordinates of the top of the human head.

3. The method for detecting the integrity of a human head according to claim 1, wherein, The step of determining whether the head frame of the portrait exceeds the boundary of the face image includes: Obtain the normalized coordinates of the head bounding box of the human figure; Based on the normalized coordinates, determine whether the head frame of the portrait exceeds the boundary of the face image.

4. The method for detecting the integrity of a human head according to claim 1, wherein, The step of determining whether the portrait head is horizontally cropped based on the portrait head frame and the first preset operator includes: The frame of the human head is enlarged according to a preset rule; The image within the enlarged bounding box of the human head is cropped to obtain the image to be detected. The first preset operator is used to perform convolution on the image to be cropped to obtain a first response map; Based on the first response image, the sum of the gray values ​​of each row of pixels is calculated; Calculate the proportion of the sum of gray values ​​of each row of pixels in the sum of gray values ​​of all pixels in the first response image; When any of the stated proportions is greater than the first preset threshold, it is determined that the portrait head has been horizontally cropped; when all the stated proportions are less than or equal to the first preset threshold, it is determined that the portrait head does not have been horizontally cropped.

5. The method for detecting the integrity of a human head according to claim 4, wherein, The step of determining whether the portrait head has a vertical cut based on the portrait head frame and the second preset operator includes: The second preset operator is used to perform convolution on the image to be cropped to obtain a second response map; Based on the second response map, the sum of the gray values ​​of each column of pixels is calculated; Calculate the proportion of the sum of gray values ​​of each column of pixels in the sum of gray values ​​of all pixels in the second response image; When any of the stated proportions is greater than the second preset threshold, it is determined that the portrait head has been vertically cropped; when all the stated proportions are less than or equal to the second preset threshold, it is determined that the portrait head does not have been vertically cropped.

6. The method for detecting the integrity of a human head according to claim 5, wherein, The step of determining whether the portrait head is obliquely cropped in order to obtain the integrity detection result of the portrait head includes: The first response map and the second response map are added together to form a composite map; For the composite image, a straight line is searched using the Hough line judgment method. When no straight line is found, the head of the human face is not obliquely cropped, thus determining that the head of the human face in the face image is complete. When a straight line is found, the length of the straight line is obtained based on the coordinates of its endpoints. When the ratio of the length of the straight line to the width of the portrait head frame is greater than a third preset threshold, the portrait head is obliquely cropped, and it is determined that the portrait head in the face image is incomplete. When the ratio of the length of the straight line to the width of the portrait head frame is less than or equal to the third preset threshold, the portrait head is not obliquely cropped, and the portrait head in the face image is determined to be complete.

7. A device for detecting the integrity of a human head, wherein, The device comprises: The first acquisition module is used to acquire face images; The second acquisition module is used to obtain the head outline of the face based on the face image; The boundary judgment module is used to determine whether the head frame of the portrait exceeds the boundary of the face image. When the head frame of the portrait exceeds the boundary of the face image, it is determined that the head of the portrait in the face image is incomplete. The cropping detection module is used to perform cropping detection based on the head bounding box and a preset operator when the head bounding box does not exceed the boundary of the face image, and to obtain the head integrity detection result. The preset operator includes a first preset operator and a second preset operator. When the head bounding box does not exceed the boundary of the face image, cropping detection is performed based on the head bounding box and the preset operator to obtain the head integrity detection result, including: Based on the portrait head frame and the first preset operator, it is determined whether the portrait head is horizontally cropped. When the portrait head is horizontally cropped, it is determined that the portrait head in the face image is incomplete. When the portrait head is not horizontally cropped, the portrait head frame and the second preset operator are used to determine whether the portrait head is vertically cropped. When the portrait head is vertically cropped, the portrait head in the face image is determined to be incomplete. When the portrait head is not vertically cut, determine whether the portrait head is obliquely cut to obtain the integrity detection result of the portrait head.

8. An electronic device, wherein, The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the human head integrity detection method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, wherein, The storage medium stores a computer program, which, when executed, implements the human head integrity detection method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Image detection method and device for face recognition, electronic equipment and medium

    CN110909568A

  • Image screening method and device, electronic equipment and storage medium

    CN112489020A