This application claims the priority benefit of Taiwanese application no. 111146885, filed on Dec. 7, 2022. The entirety of the above-mentioned patent application is hereby incorporated by reference herein and made a part of this specification.
The disclosure relates to a device and a method for calculating a swinging direction of a human face in an obscured human face image.
Currently, non-obscured face detection technology may be used to calculate a swinging direction of a human face. However, when the human face is obscured by a mask, sunglasses, or a hat, non-obscured face detection technology cannot correctly calculate the swinging direction of the human face. On the other hand, although obscured face detection technology may be used to detect an obscured human face, it cannot calculate the swinging direction of the human face.
According to an embodiment of the disclosure, a device for calculating a swinging direction of a human face in an obscured human face image includes an image capturing device, a storage medium, and a processor. The storage medium stores a three-dimensional model. The processor is coupled to the image capturing device and the storage medium. The processor is configured to: capture an obscured human face image including a human face through the image capturing device; use non-obscured face detection technology to obtain a feature anchor point to be replaced in the obscured human face image, use obscured face detection technology to obtain a plurality of candidate feature anchor points in the obscured human face image, and use the plurality of candidate feature anchor points to determine an updated feature anchor point corresponding to the feature anchor point to be replaced; perform an adjustment operation on a three-dimensional model to obtain an adjusted three-dimensional model; and use the updated feature anchor point and the adjusted three-dimensional model to calculate a swinging direction of the human face.
According to an embodiment of the disclosure, a method for calculating a swinging direction of a human face in an obscured human face image includes the following. An obscured human face image including a human face is captured. Non-obscured face detection technology is used to obtain a feature anchor point to be replaced in the obscured human face image, obscured face detection technology is used to obtain a plurality of candidate feature anchor points in the obscured human face image, and the plurality of candidate feature anchor points are used to determine an updated feature anchor point corresponding to the feature anchor point to be replaced. An adjustment operation is performed on a three-dimensional model to obtain an adjusted three-dimensional model. The updated feature anchor point and the adjusted three-dimensional model are used to calculate a swinging direction of the human face.
Several exemplary embodiments accompanied with figures are described in detail below to further describe the disclosure in details.
The accompanying drawings are included to provide further understanding, and are incorporated in and constitute a part of this specification. The drawings illustrate exemplary embodiments and, together with the description, serve to explain the principles of the disclosure.
The image capturing device 110 is a camera, a video camera, or other devices suitable for capturing an image, for example.
The storage medium 120 is any type of fixed or removable random access memory (RAM), read-only memory (ROM), flash memory, hard disk drive (HDD), solid state drive (SSD), or a similar element or a combination of elements above, for example, and is configured to store a plurality of modules or various application programs that may be executed by the processor 130. In this embodiment, the storage medium 120 may store a three-dimensional model, which will be further described in subsequent embodiments.
The processor 130 is a central processing unit (CPU), or any other programmable general-purpose or special-purpose micro control unit (MCU), microprocessor, digital signal processor (DSP), programmable controller, application specific integrated circuit (ASIC), graphics processing unit (GPU), image signal processor (ISP), image processing unit (IPU), arithmetic logic unit (ALU), complex programmable logic device (CPLD), field programmable gate array (FPGA), or any other similar element or a combination of elements above, for example. The processor 130 may access and execute the modules and various application programs stored in the storage medium 120.
The output device 140 is configured to output a swinging direction of a human face calculated by the processor 130. The output device 140 is a display, for example.
In step S210, the processor 130 may capture an obscured human face image including a human face through the image capturing device 110. Specifically, in this embodiment, the human face in the obscured human face image is obscured by a mask, sunglasses, or a hat, for example. In an embodiment, the obscured human face image may include a color image or an infrared image.
In step S220, the processor 130 may use non-obscured face detection technology to obtain a feature anchor point to be replaced in the obscured human face image, use obscured face detection technology to obtain a plurality of candidate feature anchor points in the obscured human face image, and use the plurality of candidate feature anchor points to determine an updated feature anchor point corresponding to the feature anchor point to be replaced. The disclosure does not limit the number of feature anchor points to be replaced and/or the number of the plurality of candidate feature anchor points. For convenience of description below, the number of feature anchor points to be replaced being 68 and the number of the plurality of candidate feature anchor points being 468 will be taken as an example.
In an embodiment, each of the plurality of candidate feature anchor points may correspond to a weight, and each of the plurality of candidate feature anchor points may correspond to candidate coordinates. The processor 130 may use the weight and the candidate coordinates to calculate updated coordinates of the updated feature anchor point. For example, according to Formula 1 and Formula 2 below, the processor 130 may use the candidate coordinates and the weights of the 468 candidate feature anchor points to determine X-axis coordinates Xj and Y-axis coordinates Yj of 68 updated feature anchor points respectively corresponding to the 68 feature anchor points to be replaced. As shown in Formula 3, the sum of the weights of the 468 candidate feature anchor points is 1. In other words, the weights of the 468 candidate feature anchor points may be positive, negative, or 0.
X
j=Σi=1468 Wi×Xi (Formula 1)
Y
j=Σi=1468 Wi×Yi (Formula 2)
Σi=1468 Wi=1 (Formula 3)
where Wi is the weight of the i-th candidate feature anchor point, Xi is the candidate X-axis coordinate of the i-th candidate feature anchor point, Yi is the candidate Y-axis coordinate of the i-th candidate feature anchor point, the value of i ranges from 1, 2, . . . , to 468, and the value of j ranges from 0, 1, 2, . . . , to 67.
In an embodiment, the processor 130 may obtain M candidate feature anchor points from the plurality of candidate feature anchor points, and a distance between each of the M candidate feature anchor points and the feature anchor point to be replaced is less than a distance threshold. Then, the processor 130 may use the weight and the candidate coordinates of each of the M candidate feature anchor points to calculate the updated coordinates, where M is a non-zero natural number. The description will be continued below.
Then, according to Formula 4 and Formula 5 below, the processor 130 may use the weights and the candidate coordinates of the candidate feature anchor point C127, the candidate feature anchor point C139, the candidate feature anchor point C162, the candidate feature anchor point C34, and the candidate feature anchor point C156 to calculate the updated coordinates of the updated feature anchor point. Specifically, the updated coordinates may include an updated X-axis coordinate UX0 and an updated Y-axis coordinate UY0.
UX
0
=W
127
×X
127
+W
139
×X
139
+W
162
×X
162
+W
34
×X
34
+W
156
×X
156 (Formula 4)
UY
0
=W
127
×Y
127
+W
139
×Y
139
+W
162
×Y
162
+W
34
×Y
34
+W
156
×Y
156 (Formula 5)
where X127 is the candidate X-axis coordinate of the candidate feature anchor point C127, X139 is the candidate X-axis coordinate of the candidate feature anchor point C139, X162 is the candidate X-axis coordinate of the candidate feature anchor point C162, X34 is the candidate X-axis coordinate of the candidate feature anchor point C34, and X156 is the candidate X-axis coordinate of the candidate feature anchor point C156; Y127 is the candidate Y-axis coordinate of the candidate feature anchor point C127, Y139 is the candidate Y-axis coordinate of the candidate feature anchor point C139, Y162 is the candidate Y-axis coordinate of the candidate feature anchor point C162, Y34 is the candidate Y-axis coordinate of the candidate feature anchor point C34, and Y156 is the candidate Y-axis coordinate of the candidate feature anchor point C156.
In an embodiment, the M candidate feature anchor point may include a first candidate feature anchor point and a second candidate feature anchor point. The first candidate feature anchor point corresponds to a first weight, and the second candidate feature anchor point corresponds to a second weight. A distance between the first candidate feature anchor point and the feature anchor point to be replaced is a first distance, and a distance between the second candidate feature anchor point and the feature anchor point to be replaced is a second distance. The first weight may be associated with the first distance and the second distance, and the second weight may be associated with the first distance and the second distance. The description will be continued below.
In other embodiments, the weight of the candidate feature anchor point may be a fixed value. For example, further to
In an embodiment, M may be 1. In other words, to calculate the updated coordinates of the updated feature anchor point, the processor 130 may select the (one) candidate feature anchor point at a “closest” distance to the feature anchor point to be replaced P0 from the 468 candidate feature anchor points. Next, the processor 130 may use the weight and the candidate coordinates of this candidate feature anchor point to calculate the updated coordinates of the updated feature anchor point. Since there is one candidate feature anchor point at this time, the processor 130 may set the weight thereof to 100%. In other words, the processor 130 may directly take the candidate coordinates of the (one) candidate feature anchor point as the updated coordinates (of the updated feature anchor point).
With reference back to
X
j_after=Xj_before−X27_before (Formula 10)
Y
j_after=Yj_before−Y27_before (Formula 11)
Z
j_after=Zj_before−Z27_before (Formula 12)
where X27_before is the original X-axis coordinate of the point location M27 before translated, Y27_before is the original Y-axis coordinate of the point location M27 before translated, and Z27_before is the original Z-axis coordinate of the point location M27 before translated; Xj_before is the original X-axis coordinate of each point location except the point location M27 among the 68 point locations, Xj_after is the updated X-axis coordinate of each point location except the point location M27 among the 68 point locations, Yj_before is the original Y-axis coordinate of each point location except the point location M27 among the 68 point locations, Yj_after is the updated Y-axis coordinate of each point location except the point location M27 among the 68 point locations, Zj_before is the original Z-axis coordinate of each point location except the point location M27 among the 68 point locations, and Zj_after is the updated Z-axis coordinate of each point location except the point location M27 among the 68 point locations; the value of j ranges from 0, 1, 2, . . . , to 26, 28, 29, . . . , to 67 (i.e., j is not 27).
In an embodiment, the plurality of point locations may include a central axis point location and a non-central axis point location. The processor 130 may set an updated X-axis coordinate of the central axis point location to 0. For example, as shown in
X8_after=X27_after=X28_after=X29_after=X30_after=X33_after =X51_after=X57_after=X62_after=X66_after=0 (Formula 13)
where X8_after is the updated X-axis coordinate of the point location M8, X27_after is the updated X-axis coordinate of the point location M27, X28_after is the updated X-axis coordinate of the point location M28, X29_after is the updated X-axis coordinate of the point location M29, X30_after is the updated X-axis coordinate of the point location M30, X33_after is the updated X-axis coordinate of the point location M33, X51_after is the updated X-axis coordinate of the point location M51, X57_after is the updated X-axis coordinate of the point location M57, X62_after is the updated X-axis coordinate of the point location M62, and X66_after is the updated X-axis coordinate of the point location M66.
Further, the non-central axis point location may include a first point location and a second point location, and the first point location and the second point location are relative to the central axis of the three-dimensional model. The processor 130 may use original coordinates of the first point location and original coordinates of the second point location to calculate update coordinates of the first point location and calculate update coordinates of the second point location. Specifically, as shown in
where Y0_after is the updated Y-axis coordinate of the point location M0, Y16_after is the updated Y-axis coordinate of the point location M16, Y0_before is the original Y-axis coordinate of the point location M0, and Y16_before is the original Y-axis coordinate of the point location M16.
where Z0_after is the updated Z-axis coordinate of the point location M0, Z16_after is the updated Z-axis coordinate of the point location M16, Z0_before is the original Z-axis coordinate of the point location M0, and Z16_before is the original Z-axis coordinate of the point location M16.
Next, the processor 130 may use Formula 16 and Formula 17 to calculate the updated X-axis coordinate of the point location M0 and the updated X-axis coordinate of the point location M16. In other words, the sum of the updated X-axis coordinate of the point location M0 and the updated X-axis coordinate of the point location M16 is 0.
where X0_after is the updated X-axis coordinate of the point location M0, X16_after is the updated X-axis coordinate of the point location M16, X0_before is the original X-axis coordinate of the point location M0, and X16_before is the original X-axis coordinate of the point location M16.
After the adjustment operation of Formulae 10 to 17 above is performed on each point location in the three-dimensional model as shown in
With reference back to
In an embodiment, the updated feature anchor point may correspond to a glabella of the human face. The processor 130 may translate the updated feature anchor point to a central position in the obscured human face image. The description will be continued below.
In an embodiment, the swinging direction may include a first swinging direction at a first time point and may include a second swinging direction at a second time point. The processor 130 may use a moving average algorithm to display the first swinging direction and the second swinging direction through the output device 140.
In summary of the foregoing, according to the embodiment of the disclosure, in the device and the method for calculating a swinging direction of a human face in an obscured human face image, non-obscured face detection technology may first be used on the obscured human face image to obtain the feature anchor point to be replaced. Then, obscured face detection technology may be used to obtain the plurality of candidate feature anchor points. In addition, the plurality of candidate feature anchor points may be used to determine the updated feature anchor point corresponding to the feature anchor point to be replaced. In this way, the updated feature anchor point and the three-dimensional model may be used to calculate a swinging direction of the human face. Further, according to the embodiment of the disclosure, in the device and the method for calculating a swinging direction of a human face in an obscured human face image, the adjustment operation may also be performed on the three-dimensional model to make the three-dimensional model be symmetrical in the left-right direction, so that the swinging direction of the obscured human face could be correctly calculated.
It will be apparent to those skilled in the art that various modifications and variations can be made to the structure of the disclosed embodiments without departing from the scope or spirit of the disclosure. In view of the foregoing, it is intended that the disclosure cover modifications and variations of this disclosure provided they fall within the scope of the following claims and their equivalents.
Number | Date | Country | Kind |
---|---|---|---|
111146885 | Dec 2022 | TW | national |