Face tracking method, device, equipment and storage device
By performing face detection and priority determination on monitoring equipment, combined with the rotation and lens zoom functions of the camera device, intelligent tracking of fast-moving faces is realized, solving the problem of inaccurate face tracking in the existing technology, and improving the effect of monitoring.
Patent Information
- Application Number
- CN202010642764.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-06
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2040-07-06
AI Technical Summary
Existing surveillance equipment cannot effectively track fast-moving faces, resulting in important information being missed.
Through face detection on the images captured by the camera device, the target face is determined, and the priority is determined based on the characteristic value and position change of the face, and the camera device is controlled for tracking, including rotation and lens zoom, to ensure that the face is Continuous monitoring.
It realizes intelligent tracking of human faces, improves the accuracy and effectiveness of monitoring, and avoids losing faces.
Smart Images

Figure CN111815676B
Abstract
Description
Technical Field
[0001] The present application relates to the field of video surveillance technology, and in particular to a face tracking method, device, equipment and storage device. Background Art
[0002] At present, monitoring technology is being used more and more widely. However, existing monitoring equipment, such as monitoring equipment installed in shopping malls and office areas, is fixed in a certain position and monitors a limited field of view.
[0003] Based on the above situation, fast-moving faces cannot be monitored, so it is easy to miss important information. Summary of the invention
[0004] The main technical problem solved by the present application is to provide a face tracking method, device, equipment and storage device, which can realize intelligent tracking of faces.
[0005] In order to solve the above technical problems, a technical solution adopted in the first aspect of the present application is: to provide a face tracking method, the method comprising: performing face detection on a first image captured by a camera device; based on the result of the face detection, determining a target face in the first image; and controlling the camera device to track the target face.
[0006] Optionally, based on the result of face detection, determining the target face in the first image includes:
[0007] If the result of face detection includes multiple faces, the priorities of the multiple faces are determined, and a target face is selected from the multiple faces according to the priorities; if the result of face detection includes a single face, the single face is used as the target face.
[0008] Furthermore, the priorities of multiple faces are determined, including:
[0009] Analyze whether each face is a stranger, and / or obtain multiple frames of second images captured by the camera device and analyze the position changes of the faces in the multiple frames of second images; determine the priority of the multiple faces based on the analysis results;
[0010] Among them, the priority of the stranger's face is higher than the priority of the non-stranger's face; the greater the position change of the face in the multiple frames of the second image, the higher the priority.
[0011] Furthermore, the result of face detection includes the feature value of each face; analyzing whether each face is a stranger includes:
[0012] The feature value of each face is matched with the preset feature library; if the match is not successful, the feature value of the face is saved in the preset feature library, and the face is determined to be a stranger.
[0013] Further, analyzing the position change of the face in the plurality of frames of the second image includes:
[0014] Obtaining position information of the human face in multiple frames of the second image, and obtaining a position deviation value of the human face in each of two adjacent frames of the second image;
[0015] The sum of all position deviation values of the human face is taken as the position change of the human face in the multiple frames of the second image.
[0016] Optionally, controlling the camera device to track the target face includes:
[0017] Acquire a third image captured by the camera device in a timed / real-time manner; control the camera device to rotate based on the position of the target face in the third image, and / or control the camera device to change the lens magnification based on the size of the target face in the third image.
[0018] The total rotation amount of the camera device is accumulated, and it is determined whether the total rotation amount is greater than a preset threshold; if so, after the target face tracking is completed or after a preset time, the camera device is controlled to restart so that the lens of the camera device self-checks.
[0019] Furthermore, the total rotation amount includes a total horizontal rotation angle and a total vertical rotation angle;
[0020] Determining whether the total rotation amount is greater than a preset threshold includes:
[0021] It is determined whether the total horizontal rotation angle is greater than a preset horizontal threshold, or whether the total vertical rotation angle is greater than a preset vertical threshold.
[0022] Further, based on the position of the target face in the third image, controlling the camera device to rotate includes:
[0023] Determine a first preset point position of the third image and a second preset point position of the target face in the third image, and control the camera device to rotate based on a deviation between the first preset point position and the second preset point position;
[0024] Further, based on the size of the target face in the third image, controlling the camera device to change the lens magnification includes:
[0025] If it is detected that the size of the target face in the third image is not within the preset size range, the camera device is controlled to perform lens magnification change based on the difference between the size of the target face and the preset size range.
[0026] Further, the first preset point position is the center point position of the third image, and the second preset point position is the center point position of the target face;
[0027] Further, based on the deviation between the first preset point position and the second preset point position, controlling the camera device to rotate includes:
[0028] Determine a horizontal rotation angle and a vertical rotation angle of the pan / tilt head of the imaging device based on a horizontal displacement difference and a vertical displacement difference between the first preset point position and the second preset point position;
[0029] The pan / tilt platform of the camera device is controlled to rotate a horizontal rotation angle in the horizontal direction and a vertical rotation angle in the vertical direction.
[0030] Optionally, the method further comprises:
[0031] After it is determined that the tracking of the target face is completed, the movement duration of the target face and the number of tracking times of the target face within a preset time are counted, and the movement duration and the number of tracking times are fed back to the user.
[0032] Optionally, after acquiring the third image captured by the imaging device in a timed / real-time manner, the method further includes:
[0033] If no human face is detected in the third image, the camera device is controlled to enter a search mode to capture at least one fourth image; and the target human face is searched using the at least one fourth image.
[0034] Furthermore, the search mode includes: the lens of the camera device is zoomed to a wide angle; the camera device rotates back and forth within a preset angle range; the search mode is executed for a preset time;
[0035] Further, searching for the target face using at least one fourth image includes:
[0036] Performing face detection on the fourth image; if a face is detected in the fourth image, determining whether the face in the fourth image is a target face; if the face in the fourth image is the target face, continuing to control the camera device to track the target face; if the face in the fourth image is not the target face, re-executing the target face in the first image based on the result of face detection and subsequent steps: if no face is present in the fourth image, resetting the camera device, and re-executing face detection on the first image captured by the camera device and subsequent steps;
[0037] When there is no face in the fourth image and / or the face in the fourth image is not the target face, it is determined that the tracking of the target face is ended.
[0038] Further, determining whether the face in the fourth image is a target face includes:
[0039] Performing feature matching between the face in the fourth image and the target face to obtain feature similarity between the face in the fourth image and the target face;
[0040] If the feature similarity is greater than the preset similarity, the face in the fourth image is determined to be the target face; otherwise, it is determined that the face in the fourth image is not the target face.
[0041] Further, if no human face is detected in the third image, the camera device is controlled to enter a search mode to capture at least one fourth image, including:
[0042] If no human face is detected in the third image, controlling the camera device to continue shooting in the current position state to obtain at least one fifth image;
[0043] If no human face is detected in at least one frame of the fifth image, the camera device is controlled to enter a search mode to capture at least one frame of the fourth image.
[0044] To solve the above technical problems, a technical solution adopted in the second aspect of the present application is: to provide a face tracking device, which includes: a detection module, used to perform face detection on a first image captured by a camera device; a determination module, used to determine a target face in the first image based on the result of face detection; and a tracking module, used to control the camera device to track the target face.
[0045] In order to solve the above technical problems, a technical solution adopted in the third aspect of the present application is: providing a face tracking device, the device comprising a memory and a processor coupled to each other; the processor is used to execute program instructions stored in the memory to implement the face tracking method provided in the first aspect, and control the camera device to track the target face. The face tracking device includes a camera device.
[0046] In order to solve the above technical problems, a technical solution adopted in the third aspect of the present application is: providing a storage device, which stores program instructions that can be executed by a processor, and the program instructions are used to implement the face tracking method provided in the first aspect of the present application.
[0047] The above scheme performs face detection on the first image captured by the camera device; determines the target face in the first image based on the result of the face detection; and controls the camera device to track the target face, thereby realizing intelligent tracking of the face. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 is a flow chart of a face tracking method provided by the first embodiment of the present application;
[0049] Figure 2 is a flowchart of a method for determining face priority provided in the first embodiment of the present application;
[0050] Figure 3This is a partial flow chart of a face tracking method provided in the second embodiment of the present application;
[0051] Figure 4 is a flow chart of a face tracking method provided in the third embodiment of the present application;
[0052] Figure 5 is a flow chart of a face tracking method provided in the fourth embodiment of the present application;
[0053] Figure 6 It is a structural schematic diagram of an embodiment of the face tracking device of the present application;
[0054] Figure 7 This is a structural diagram of an embodiment of a face tracking device of the present application;
[0055] Figure 8 It is a structural diagram of an embodiment of a storage device of the present application. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0057] The terms "first", "second", and "third" in this application are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first", "second", and "third" can explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products, or devices.
[0058] Reference to "embodiment" herein means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. It should be noted that for the following method embodiments, if there are substantially the same results, the method of the present application is not limited to the illustrated process sequence.
[0059] See also Figure 1 , Figure 1 This is a flowchart of a face tracking method provided by the first embodiment of the present application. The method of this embodiment can be executed by an electronic device, for example, a device equipped with a camera device, or a device connected to the camera device wirelessly or by wire. The device equipped with the camera device can be a monitoring device with a camera. The electronic device can execute the face tracking method of this embodiment by default, or execute the method of this embodiment only when a preset trigger event is detected, such as turning on the tracking mode. Specifically, Figure 1 As shown, the face tracking method of this embodiment includes:
[0060] S110: Performing face detection on a first image captured by the imaging device.
[0061] In order to achieve face tracking, the present embodiment first processes the first image currently captured by the camera device to determine the target face to be tracked. Specifically, the first image currently captured by the camera device is acquired, and face detection is performed on the first image to obtain a face detection result. In some embodiments, the face detection result may include feature values of the face and / or position information of the face in the first image, and the position information may specifically be coordinate information in the first image.
[0062] Optionally, before executing step S110, the following steps may also be included:
[0063] First, determine the starting tracking parameters, such as receiving the tracking starting point set by the user for any position and magnification; and save the current device state parameters, where the current device state parameters can be the coordinates, focus value, magnification value, etc. of the two-dimensional direction of the gimbal of the camera device.
[0064] S120: Determine a target face in the first image based on the result of face detection.
[0065] The result of face detection obtained in step S110 may be that the first portrait includes a single face or multiple faces, and then a target face to be tracked is determined from the detected faces.
[0066] Specifically, if it is detected that the first image includes a single face, the face can be directly used as the target face; if it is detected that the first image includes multiple faces, one or more faces can be selected from the multiple faces as the target face according to a preset selection strategy, wherein the preset selection strategy can be but is not limited to random selection, or selection according to the clarity order of the faces in the image, or selection according to the priority order of the faces in the image.
[0067] Please refer to Figure 2 , an example is given to illustrate the determination of the priority of the face in the first image. Figure 2 As shown, determining the priorities of multiple faces in the first image in step S120 specifically includes the following sub-steps:
[0068] Sub-step S221: Analyze whether each face is a stranger.
[0069] Specifically, the result of the face detection in the above step 110 includes the feature value of each face, so the feature value of each face can be matched with the feature value in the preset feature library; if the match is successful, the face is considered to be a non-stranger; if the match is not successful, the feature value of the face is saved in the preset feature library, and the face is determined to be a stranger.
[0070] In this embodiment, the similarity between the feature value of each face and the feature value of the face stored in the preset feature library can be calculated. If the calculated similarity is greater than or equal to the preset reference value, it is considered that the face and the face in the preset feature library are the same person, that is, it is considered that the feature value of the face and the feature value in the preset feature library match successfully. If the similarity between the feature value of the face and the feature values of all faces stored in the preset feature library is less than the preset reference value, it is considered that the feature value of the face and the feature value in the preset feature library do not match successfully.
[0071] Sub-step S222: obtaining a plurality of frames of second images captured by the camera device and analyzing the position change of the face in the plurality of frames of second images.
[0072] Specifically, the position information of the detected face in multiple frames of the second image can be obtained, and the position deviation value of the face in each two adjacent frames of the second image can be obtained; the sum of all the position deviation values of the face is used as the position change of the face in the multiple frames of the second image. For example, the corresponding face in the multiple frames of the second image is found using the feature value of the face, and the coordinate information of the face in each frame of the second image is obtained. The coordinate information of the face in each frame of the second image is used to determine the position deviation value of the face in each two adjacent frames of the second image, and the absolute values of all the position deviation values are added up as the position change of the face in the multiple frames of the second image.
[0073] It can be understood that the second image can be an image taken by the camera device before or after the first image, and the number of frames of the second image can be set according to actual conditions, for example, it can be 3, 5, 10, etc.
[0074] Sub-step S223: Determine the priorities of the multiple faces based on the analysis results.
[0075] Among them, the priority of the stranger's face is higher than the priority of the non-stranger's face; the greater the position change of the face in the multiple frames of the second image, the higher the priority.
[0076] In this embodiment, the priority of strangers is higher than the priority of position changes, that is, the priority is sorted according to strangers first. If they are both strangers or both non-strangers, they are sorted according to the position changes. If the position changes are the same, the order of detection is used as the priority order. For example, the first image is detected to include face A, face B, face C and face D in sequence. Among them, face A and face C are strangers, face B and face D are non-strangers, the total position deviation value of face A in the 5 second images is 10, the total position deviation value of face B in the 5 second images is 12, the total position deviation value of face C in the 5 second images is 7, and the total position deviation value of face D in the 5 second images is 12. Therefore, the priority from high to low can be obtained as follows: face A, face C, face B, face D.
[0077] It is understandable that the priority of the face can be determined only according to whether it is a stranger or the position change in the multiple frames of the second image. For example, only steps S2021 and S2023 can be performed to determine the priority of the face; or only steps S2022 and S2023 can be performed to determine the priority of the face.
[0078] Through the above sub-steps, the priority of each face in the image can be determined, and then the target face can be determined according to the priority, realizing the determination and subsequent tracking of the target face among multiple faces in the image. In addition, the priority of the target face is determined by whether it is a stranger and the position change of the face in multiple frames of images, that is, the target face is determined by the frequency of appearance of the face and the movement range in a short period of time, which can improve the detection accuracy of the target face.
[0079] S130: Control the camera device to track the target face.
[0080] In this embodiment, after determining the target face, the parameters of the camera device are controlled to track the target face, and the parameters may include rotation parameters and / or lens magnification. Specifically, the third image currently captured by the camera device may be obtained, and based on the position of the target face in the third image, the camera device may be controlled to rotate, and / or, based on the size of the target face in the third image, the camera device may be controlled to change the lens magnification. The rotation of the camera device may include at least one of the horizontal and vertical directions. If the camera device is set on a pan-tilt platform, the rotation of the pan-tilt platform in the corresponding direction is controlled to drive the camera device to rotate.
[0081] In this embodiment, face detection is performed on the image captured by the camera device to determine the target face, and then the target face is tracked by the camera device, thereby realizing intelligent tracking of the face by the camera device.
[0082] See also Figure 3 , Figure 3 This is a partial flow chart of a face tracking method provided in the second embodiment of the present application. Figure 1 In addition to the steps, it also includes:
[0083] S340: accumulating the total rotation amount of the imaging device and determining whether the total rotation amount is greater than a preset threshold. If so, executing step S350.
[0084] In this embodiment, the preset threshold includes a preset horizontal threshold and a preset vertical threshold. Therefore, the total rotation amount includes a total horizontal rotation angle and a total vertical rotation angle. For example, the rotation angle of the camera device in the horizontal direction is accumulated to obtain the total horizontal rotation angle; the rotation angle of the camera device in the vertical direction is accumulated to obtain the total vertical rotation angle. It is determined whether the total horizontal rotation angle is greater than the preset horizontal threshold, or whether the total vertical rotation angle is greater than the preset vertical threshold. If it is determined that the total horizontal rotation angle is greater than the preset horizontal threshold, or the total vertical rotation angle is greater than the preset vertical threshold, step S350 is executed.
[0085] S350: After the target face tracking is completed or after a preset time, the camera device is controlled to restart so that the lens of the camera device performs self-check.
[0086] It is understandable that during the horizontal and vertical rotation of the gimbal, its mechanical structure will collide, which will gradually accumulate errors, causing the camera lens to lose step and cause out-of-focus problems. Therefore, the angles degHZ and degVT of each horizontal and vertical rotation of the camera gimbal can be accumulated and counted. When degHZ> the preset horizontal threshold T_HZ or degVT> the preset vertical threshold T_HZ, wait for the target face tracking to end or start counting down for a certain time, such as 3 minutes, and then control the camera to restart, so that the camera lens can be self-checked.
[0087] Through the above method, after determining that the total rotation amount of the camera device is greater than the preset threshold, the camera device is controlled to restart to achieve self-check of the camera device lens, which can avoid the problem of out-of-focus of the camera device lens and improve the tracking accuracy.
[0088] See also Figure 4 : is a flow chart of a face tracking method provided in the third embodiment of the present application. The method in this embodiment includes:
[0089] S410: Performing face detection on a first image captured by the imaging device.
[0090] S420: Determine a target face in the first image based on the result of face detection.
[0091] The specific description of steps S410 and S420 may refer to the description of steps S110 and S120 above, which will not be repeated here.
[0092] S430: Acquire a third image captured by the imaging device in a timed or real-time manner.
[0093] The third image may be captured by a camera device in a timed or real-time manner. If the third image is captured by a camera device in real-time, it means that the electronic device tracks the target face according to the real-time image of the camera device, and can achieve real-time and fast tracking of the target face, and it is not easy to lose the target face tracking.
[0094] In this step, the electronic device continuously acquires the third image, and performs face detection on the third image acquired each time; if the target face is detected in the third image, the following S440 is executed to implement tracking of the target face by the camera device; if the target face is not detected in the third image, the following S450-S460 is executed to implement searching for the target face, and continue tracking the target face after the target face is searched and obtained.
[0095] It is understandable that in order to avoid the search operation of the target face being triggered by mistake, if the target face is not detected in the currently obtained third image, the camera device may not move for a certain period of time, stay at the current position, and continue to determine whether the camera device has detected the target face. For example, if the third image does not detect the face, the camera device is controlled to continue to shoot at least one fifth image at the current position; if the target face is not detected in at least one fifth image, the following S450-S460 is executed to control the camera device to enter the search mode to shoot at least one fourth image; if the target face is detected in the fifth image, the following S440 is continued.
[0096] S440: Based on the position of the target face in the third image, control the camera device to rotate, and / or, based on the size of the target face in the third image, control the camera device to change the lens magnification.
[0097] With respect to the position of the target face in the third image, the camera device is controlled to rotate. The rotation of the camera device may include at least one of the horizontal and vertical directions. If the camera device is set on a pan-tilt platform, the rotation of the pan-tilt platform in the corresponding direction is controlled to drive the camera device to rotate. In addition, this step may specifically include determining the first preset point position of the third image and the second preset point position of the target face in the third image, and controlling the camera device to rotate based on the deviation between the first preset point position and the second preset point position. Therefore, the camera device can be controlled to rotate by referring to the position deviation of the same definition point (such as the center point) in the third image and the target face. Specifically, the first preset point may be, but is not limited to, the center point position of the third image, and the second preset point position is the center point position of the target face. Based on the deviation between the first preset point position and the second preset point position, the camera device is controlled to rotate, which may specifically include: determining the horizontal rotation angle and the vertical rotation angle of the pan / tilt of the camera device based on the horizontal displacement difference and the vertical displacement difference between the first preset point position and the second preset point position; controlling the pan / tilt of the camera device to rotate the horizontal rotation angle in the horizontal direction and the vertical rotation angle in the vertical direction. Among them, the conversion relationship between the preset displacement difference and the corresponding rotation angle can be preset, so the corresponding rotation angle can be converted based on the determined position difference. For example, at the current magnification, the pan / tilt of the camera device rotates horizontally by 2°, and the corresponding horizontal displacement difference is m. If the calculated horizontal displacement difference between the first preset point position and the second preset point position is n, the horizontal rotation angle is determined to be 2*n / m.
[0098] With respect to the above-mentioned method of controlling the camera device to change the lens magnification based on the size of the target face in the third image, it may specifically include: detecting the size of the target face in the third image; if it is detected that the size of the target face in the third image is not within a preset size range, then based on the difference between the size of the target face and the preset size range, controlling the camera device to change the lens magnification.
[0099] S450: Control the imaging device to enter a search mode to capture at least one fourth image frame.
[0100] The search mode may include at least one of the following: the camera lens is zoomed to a wide angle; the camera rotates back and forth within a preset angle range; the search mode is executed for a preset time. The preset angle range may be horizontal ±θ, and θ may be any angle value between 30 and 60 degrees, such as 30 degrees, 45 degrees, and 60 degrees. The wide angle may be a lens field of view within 90-100 degrees, and the coverage range formed by the field of view plus the preset angle range may be 150-220 degrees. Generally speaking, the coverage range may reach 180 degrees.
[0101] For example, if no face is detected in the third image acquired at a certain time, the lens of the camera device is zoomed to a wide angle, and the gimbal of the camera device is controlled to move to 0° in the vertical direction and rotate back and forth within a preset horizontal angle range for a preset time, so as to continuously capture multiple frames of the fourth image during the rotation process.
[0102] It can be understood that when this embodiment is combined with the above-mentioned second embodiment, the rotation angle in the search mode is also within the angle range accumulated in the above-mentioned step S340.
[0103] S460: Searching for a target face using at least one fourth image frame.
[0104] Specifically, face detection is performed on each frame of the fourth image obtained in step S450 to determine whether the target face exists in the fourth image. If the target face is detected in the fourth image during the search process, the fourth image is used as the third image, and the above-mentioned step S430 and subsequent steps are continued to control the camera device to track the target face. If the target face is not detected in the fourth image during the search process, it is determined that the current tracking of the target face is completed.
[0105] S470: After determining that the target face tracking is completed, counting the movement duration of the target face and the number of times the target face is tracked within a preset time, and feeding back the movement duration and the number of times of tracking to the user.
[0106] Specifically, the target face movement duration and tracking times can be determined according to the target face tracking duration and the number of times the target face is not detected. In addition, the form of feedback to the user includes but is not limited to text messages. For example, after it is determined that the target face tracking is completed, the target face movement duration and the number of times the target face is tracked within a preset time are sent to the user's mobile phone in the form of text messages, so that the user can receive tracking information anytime and anywhere.
[0107] After the target face is not detected, the present embodiment can control the camera device to enter the search mode to search for the target face, so as to avoid losing the target face due to the sudden large-scale movement of the target face; in addition, after determining that the target face tracking is completed, information can be pushed according to the tracking times and movement duration of the target face, and the movement duration and number of appearances of the target face can be determined according to the duration of the target face tracking process and the number of times the target face is not detected, so the target face related information can be more accurately counted. It is understandable that in other embodiments, the above steps S450-S460 or S470 can be selectively performed.
[0108] See also Figure 5 4 is a flowchart of a face tracking method provided in the fourth embodiment of the present application. The method in this embodiment includes:
[0109] S510: Perform face detection on a first image captured by the imaging device.
[0110] S520: Determine a target face in the first image based on the result of face detection.
[0111] S530: Acquire a third image captured by the imaging device in a timed or real-time manner.
[0112] After the third image is obtained, face detection is performed on the third image. If a target face is detected, S540 is executed; if no face is detected, S550 is executed.
[0113] S540: Based on the position of the target face in the third image, control the camera device to rotate, and / or, based on the size of the target face in the third image, control the camera device to change the lens magnification.
[0114] S550: If no human face is detected in the third image, control the camera device to enter a search mode to capture at least one fourth image.
[0115] Among them, the specific instructions of the present steps S510-S550 can refer to the description of the above steps S410-S450, which will not be repeated here.
[0116] S561: Perform face detection on the fourth image.
[0117] If a face is detected in the fourth image, S562 is executed to determine whether the face is the target face; if no face is detected in the fourth image, it is determined that the current target face tracking is ended, and another face is currently detected, so the camera device is reset, and the above step S410 and subsequent steps are re-executed. Resetting the camera device may be restoring the camera device to the above starting tracking parameters.
[0118] The process of performing face detection on the fourth image is the same as the face detection process in the above step S101, and will not be described in detail here.
[0119] S562: Determine whether the face in the fourth image is a target face.
[0120] If the face in the fourth image is the target face, the fourth image is used as the third image, and the above step S430 and subsequent steps are continued to be executed to control the camera device to track the target face; if the face in the fourth image is not the target face, it is determined that the current target face tracking is completed. Since other faces have been detected, the above step S420 and subsequent steps are directly re-executed.
[0121] This step S562 may specifically include: performing feature matching on the face in the fourth image and the target face to obtain the feature similarity between the face in the fourth image and the target face; if the feature similarity is greater than the preset similarity, determining that the face in the fourth image is the target face, otherwise determining that the face in the fourth image is not the target face.
[0122] Specifically, the similarity between the feature value of each face in the fourth image and the feature value of the target face can be calculated. If the calculated similarity is greater than or equal to a preset reference value, it is considered that the face and the target face are the same person, that is, it is considered that the feature value of the face matches the feature value of the target face successfully. If the similarity between the feature value of the face and the feature value of the target face is less than the preset reference value, it is considered that the feature value of the face does not match the feature value of the target face successfully. Among them, the preset reference value can be set according to actual conditions and is not limited here.
[0123] Through the above S561-S562, searching for the target face using at least one frame of the fourth image is achieved.
[0124] See also Figure 6 , Figure 6 FIG. 1 is a schematic diagram of the structure of an embodiment of the face tracking device of the present application. Figure 6 As shown, the device 610 includes a detection module 611 , a determination module 612 and a tracking module 613 .
[0125] The detection module 611 is used to perform face detection on the first image captured by the capturing device to obtain a face detection result.
[0126] The determination module 612 is used to determine the target face in the first image based on the result of face detection.
[0127] The tracking module 613 is used to control the camera device to track the target face.
[0128] In some embodiments, the determination module 612 is specifically used to determine the priorities of the multiple faces when the face detection result is multiple faces, and select a target face from the multiple faces according to the priorities; when the face detection result includes a single face, the single face is used as the target face.
[0129] In some embodiments, the determination module 612 includes: an analysis unit, configured to analyze whether each face is a stranger, and / or obtain multiple frames of second images captured by the camera device and analyze the position change of the face in the multiple frames of second images; a determination unit, configured to determine the priority of the multiple faces based on the analysis results. Among them, the priority of the stranger's face is higher than the priority of the non-strangers' faces; the greater the position change of the face in the multiple frames of second images, the higher its priority.
[0130] Among them, the analysis unit can be specifically used to: match the feature value of each face with a preset feature library; if the match is not successful, save the feature value of the face in the preset feature library, and determine the face as a stranger; obtain the position information of the face in multiple frames of the second image, and obtain the position deviation value of the face in each two adjacent frames of the second image; take the sum of all position deviation values of the face as the position change of the face in multiple frames of the second image.
[0131] In some embodiments, the tracking module 613 includes: an acquisition unit for acquiring a third image captured by the camera device in a timed / real-time manner; a control unit for controlling the camera device to rotate based on the position of the target face in the third image, and / or controlling the camera device to change the lens magnification based on the size of the target face in the third image.
[0132] Among them, the control unit is specifically used to: determine the first preset point position of the third image and the second preset point position of the target face in the third image, and control the camera device to rotate based on the deviation between the first preset point position and the second preset point position; and / or, when it is detected that the size of the target face in the third image is not within the preset size range, control the camera device to change the lens magnification based on the difference between the size of the target face and the preset size range.
[0133] In some embodiments, the first preset point position is the center point position of the third image, and the second preset point position is the center point position of the target face;
[0134] Among them, the control unit is specifically used to: determine the horizontal rotation angle and vertical rotation angle of the pan / tilt of the camera device based on the horizontal displacement difference and vertical displacement difference between the first preset point position and the second preset point position; control the pan / tilt of the camera device to rotate the horizontal rotation angle in the horizontal direction and the vertical rotation angle in the vertical direction.
[0135] The tracking module 613 can also be specifically used for: after acquiring the third image captured by the camera device in a timed / real-time manner, if no face is detected in the third image, controlling the camera device to enter a search mode to capture at least one fourth image.
[0136] In some embodiments, the tracking module 613 further includes: a search unit, configured to search for a target face using at least one frame of the fourth image.
[0137] The search mode includes: the lens of the camera device is zoomed to a wide angle; the camera device rotates back and forth within a preset angle range; and the search mode is executed for a preset time.
[0138] In some embodiments, the search unit may be specifically used to: perform face detection on the fourth image. When there is a face in the fourth image, when determining whether the face in the fourth image is a target face, continue to control the camera device to track the target face; when the face in the fourth image is not the target face, re-determine the target face in the first image based on the result of face detection, and perform subsequent tracking in combination with other modules / units.
[0139] When no human face exists in the fourth image, the camera device is reset, and the other modules / units are combined to re-execute the human face detection and tracking on the first image captured by the camera device;
[0140] When there is no face in the fourth image and / or the face in the fourth image is not the target face, tracking of the target face ends.
[0141] In some embodiments, the search unit can also be specifically used to: perform feature matching on the face in the fourth image and the target face to obtain the feature similarity between the face in the fourth image and the target face; when the feature similarity is greater than a preset similarity, determine that the face in the fourth image is the target face, otherwise determine that the face in the fourth image is not the target face.
[0142] The tracking module 613 can also be specifically used for: when it is detected that no face is detected in the third image, controlling the camera device to enter a search mode to capture at least one frame of the fourth image; when no face is detected in the third image, controlling the camera device to continue capturing at the current position to obtain at least one frame of the fifth image; when no face is detected in at least one frame of the fifth image, controlling the camera device to enter a search mode to capture at least one frame of the fourth image.
[0143] In some embodiments, the device 610 also includes: a statistical module (not shown) for accumulating the total rotation amount of the camera device, and when the total rotation amount is greater than a preset threshold, after the target face tracking is completed or after a preset time, the camera device is controlled to restart to enable the camera device lens to self-check.
[0144] Among them, the total rotation amount includes the total horizontal rotation angle and the total vertical rotation angle; the statistical module can be specifically used for: when the horizontal rotation angle is greater than the preset horizontal threshold, or the total vertical rotation angle is greater than the preset vertical threshold, controlling the camera device to restart so that the lens of the camera device can self-check.
[0145] In some embodiments, the device 610 also includes: a feedback module (not shown), which is used to count the movement duration of the target face and the number of tracking times of the target face within a preset time after determining that the tracking of the target face is completed, and to feed back the movement duration and tracking times to the user.
[0146] The specific execution of each module of the above-mentioned device can refer to the corresponding steps of the above-mentioned method embodiment, which will not be described in detail here.
[0147] See also Figure 7 , Figure 7 FIG. 1 is a schematic diagram of the structure of an embodiment of the face tracking device of the present application. Figure 7 As shown, the face tracking device 710 includes a memory 711 and a processor 712 coupled to each other.
[0148] The memory 711 stores program instructions. The processor 712 is used to execute the program instructions stored in the memory 711 to execute the face tracking method of any of the above embodiments.
[0149] The processor 712 may also be referred to as a CPU (Central Processing Unit). The processor 712 may be an integrated circuit chip having signal processing capabilities. The processor 712 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0150] The above-mentioned face tracking device may also include a camera device.
[0151] See also Figure 8 , Figure 8It is a structural diagram of an embodiment of the storage device of the present application. The storage device 810 of the embodiment of the present application stores program instructions 811 that can implement all the above methods, wherein the program instructions 811 can be stored in the above storage device in the form of a software product, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage device includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes, or terminal devices such as computers, servers, mobile phones, tablets, etc.
[0152] The above scheme performs face detection on the first image captured by the camera device; determines the target face in the first image based on the result of face detection; and controls the camera device to track the target face, thereby realizing intelligent tracking of the face.
[0153] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0154] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0155] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0156] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
Claims
1. A face tracking method, characterized in that: include: Performing face detection on the first image captured by the camera device; Based on the result of the face detection, determining a target face in the first image; Acquire a third image captured by the imaging device in a timed / real-time manner; If the target face is not detected in the third image, controlling the camera device to enter a search mode to capture at least one fourth image; Searching for the target face using the at least one fourth image frame; Controlling the camera device to perform movement tracking on the target face; If the target face is not detected in the third image, the camera is controlled to enter a search mode to capture at least one fourth image, including: If the target face is not detected in the third image, controlling the camera device to continue shooting in the current position state to obtain at least one fifth image; If the target face is not detected in the at least one fifth image, controlling the camera device to enter a search mode to capture at least one fourth image; The search mode includes: the lens of the camera device is zoomed to a wide angle; the camera device rotates back and forth within a preset angle range; the search mode is executed for a preset time; the use of the at least one fourth image frame to search for the target face includes: Performing face detection on the fourth image; If the human face in the fourth image is the target human face, the step of controlling the imaging device to perform movement tracking on the target human face continues.
2. The method according to claim 1, characterized in that The step of determining a target face in the detected image based on a result of the face detection includes: If the face detection result includes multiple faces, determining the priorities of the multiple faces, and selecting the target face from the multiple faces according to the priorities; If the result of the face detection includes a single face, the single face is used as the target face.
3. The method according to claim 2, characterized in that The determining the priorities of the multiple faces includes: Analyze whether each of the human faces is a stranger, and / or obtain multiple frames of second images captured by the camera device and analyze the position change of the human face in the multiple frames of second images; Determining priorities of the multiple faces based on a result of the analyzing; Among them, the priority of the stranger's face is higher than the priority of the non-strangers' faces; the greater the position change of the face in the multiple frames of the second image, the higher the priority.
4. The method according to claim 3, characterized in that The result of the face detection includes a feature value of each face; The analyzing whether each face is a stranger includes: Matching the feature value of each face with the feature value in a preset feature library; If the match is unsuccessful, the feature value of the face is saved in the preset feature library, and the face is determined to be a stranger.
5. The method according to claim 3, characterized in that: The analyzing the position change of the face in the plurality of frames of second images includes: Acquire position information of the human face in the plurality of frames of the second image, and obtain a position deviation value of the human face in each two adjacent frames of the second image; The sum of all the position deviation values of the human face is taken as the position change of the human face in the multiple frames of second images.
6. The method according to claim 1, characterized in that The step of controlling the camera device to perform movement tracking on the target face includes: If the target face is detected in the fourth image, the camera device is controlled to rotate based on the position of the target face in the fourth image, and / or the camera device is controlled to change the lens magnification based on the size of the target face in the fourth image.
7. The method according to claim 6, characterized in that The method further comprises: Accumulating the total rotation amount of the imaging device, and determining whether the total rotation amount is greater than a preset threshold; If yes, after the target face movement tracking is completed or after a preset time, the camera device is controlled to restart so that the lens of the camera device performs a self-check.
8. The method according to claim 7, characterized in that The total rotation amount includes a total horizontal rotation angle and a total vertical rotation angle; The determining whether the total rotation amount is greater than a preset threshold comprises: It is determined whether the total horizontal rotation angle is greater than a preset horizontal threshold, or whether the total vertical rotation angle is greater than a preset vertical threshold.
9. The method according to claim 6, characterized in that The controlling the camera device to rotate based on the position of the target face in the fourth image includes: Determine a first preset point position of the fourth image and a second preset point position of the target face in the fourth image, and control the camera device to rotate based on a deviation between the first preset point position and the second preset point position; The step of controlling the imaging device to change the lens magnification based on the size of the target face in the fourth image includes: If it is detected that the size of the target face in the fourth image is not within the preset size range, the camera device is controlled to perform lens magnification change based on the difference between the size of the target face and the preset size range.
10. The method according to claim 9, characterized in that The first preset point position is the center point position of the fourth image, and the second preset point position is the center point position of the target face; The step of controlling the imaging device to rotate based on the deviation between the first preset point position and the second preset point position comprises: Determining a horizontal rotation angle and a vertical rotation angle of the pan / tilt head of the imaging device based on a horizontal displacement difference and a vertical displacement difference between the first preset point position and the second preset point position; The pan / tilt platform of the imaging device is controlled to rotate the horizontal rotation angle in the horizontal direction and the vertical rotation angle in the vertical direction.
11. The method according to claim 1, characterized in that: The method further comprises: After determining that the movement tracking of the target face is finished, the movement duration of the target face and the number of tracking times of the target face within a preset time are counted, and the movement duration and the number of tracking times are fed back to the user.
12. The method according to claim 1, characterized in that The method further comprises: If a face is detected in the fourth image, determining whether the face in the fourth image is a target face; If the face in the fourth image is not the target face, re-execute the step of determining the target face in the first image based on the result of the face detection and the subsequent steps; If there is no face in the fourth image, resetting the imaging device, and re-performing the face detection on the first image captured by the imaging device and subsequent steps; When there is no human face in the fourth image and / or the human face in the fourth image is not the target human face, it is determined that the movement tracking of the target human face is ended.
13. The method according to claim 12, characterized in that The determining whether the face in the fourth image is a target face includes: Performing feature matching on the face in the fourth image and the target face to obtain a feature similarity between the face in the fourth image and the target face; If the feature similarity is greater than a preset similarity, it is determined that the face in the fourth image is the target face; otherwise, it is determined that the face in the fourth image is not the target face.
14. A face tracking device, characterized in that: include: A detection module, used for performing face detection on the first image captured by the camera device; A determination module, configured to determine a target face in the first image based on a result of the face detection; A tracking module is used to obtain a third image captured by the camera device in a timed / real-time manner; if the target face is not detected in the third image, control the camera device to enter a search mode to capture at least one fourth image; use the at least one fourth image to search for the target face; and control the camera device to perform movement tracking on the target face; If the target face is not detected in the third image, the camera is controlled to enter a search mode to capture at least one fourth image, including: If the target face is not detected in the third image, controlling the camera device to continue shooting in the current position state to obtain at least one fifth image; If the target face is not detected in the at least one fifth image, controlling the camera device to enter a search mode to capture at least one fourth image; The search mode includes: the lens of the camera device is zoomed to a wide angle; the camera device rotates back and forth within a preset angle range; the search mode is executed for a preset time; the use of the at least one fourth image frame to search for the target face includes: Performing face detection on the fourth image; If the human face in the fourth image is the target human face, the step of controlling the imaging device to perform movement tracking on the target human face continues.
15. A face tracking device, characterized in that: comprising a memory and a processor coupled to each other; The processor is used to execute the program instructions stored in the memory to implement the method described in any one of claims 1 to 13, and control the camera device to perform movement tracking on the target face.
16. The device according to claim 15, characterized in that The face tracking device includes the camera device.
17. A storage device, characterized in that: Program instructions that can be executed by a processor are stored, and the program instructions are used to implement the method according to any one of claims 1 to 13.
