Face tracking method and device
By identifying and calculating the displacement and angle of the face, controlling the rotation of the camera, so that the face is always in the center of the image, solving the problem of not being able to recognize specific faces and distances in the prior art, and improving the accuracy and stability of face tracking.
Patent Information
- Application Number
- CN202010338582.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-26
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2040-04-26
AI Technical Summary
Existing face tracking technology cannot recognize and track specific faces, which may ignore important objects and ignore the distance between the face and the camera, resulting in poor tracking effect, especially when the distance is too close and the camera rotates at a speed that is too far. Can't keep up with the goal.
By receiving monitoring scene images, detecting and identifying the face of attention, calculating its displacement and angle relative to the center of the image, controlling the rotation of the camera, making it always at the center of the image, and filtering the face area and height to determine the qualified face, and according to the pre-order Suppose the feature match to determine the focus face.
It realizes efficient tracking of specific faces in the monitoring scene, avoids tracking of non-focused objects, optimizes the appropriate range of distance between the face and the camera, and improves tracking accuracy and stability.
Smart Images

Figure CN113553889B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video surveillance technology, and in particular to a face tracking method and device. Background Art
[0002] Face detection is to detect the position of the face in the picture, as well as the coordinates of the eyes, nose tip, and mouth corners. At present, when tracking a target, face detection is first used to detect the position of the face, and the face is marked with a rectangular frame, and then the camera is rotated along the center of the rectangular frame to ensure that the face is always in the center of the picture. Summary of the invention
[0003] The embodiments of the present invention provide a face tracking method and device to achieve tracking of a specific face in a monitoring scene.
[0004] The technical solution of the embodiment of the present invention is achieved as follows:
[0005] A face tracking method, the method comprising:
[0006] Receiving images of the surveillance scene captured by the camera;
[0007] Detect faces in each frame;
[0008] Searching for a face of interest among detected faces;
[0009] Calculating the horizontal displacement and vertical displacement of the focus face relative to the center point of the current frame image according to the position of the focus face in the current frame image;
[0010] According to the calculated horizontal displacement and vertical displacement, the horizontal angle and vertical angle that the camera needs to rotate in the horizontal and vertical directions when the face of interest is placed at the center point of the current frame image are calculated;
[0011] The horizontal steering motor and the vertical steering motor are controlled respectively according to the horizontal angle and the vertical angle, so that the horizontal steering motor and the vertical steering motor respectively control the rotatable head of the camera to rotate to a corresponding angle.
[0012] The calculating of the horizontal displacement and the vertical displacement of the focus face relative to the center point of the current frame image comprises:
[0013] Calculate the horizontal displacement dx and the vertical displacement dy of the nose tip of the focus face relative to the center point of the current frame image;
[0014] The calculation of the horizontal angle and the vertical angle that the camera needs to rotate in the horizontal and vertical directions when the focus face is placed at the center point of the current frame image includes:
[0015] Calculate hor=(dx / W)*α, ver=(dy / H)*β;
[0016] Wherein, W is the width of the current frame image, H is the height of the current frame image, α is the horizontal viewing angle of the camera, β is the vertical viewing angle of the camera, hor is the horizontal angle that the camera needs to rotate in the horizontal direction when the face of interest is placed at the center point of the current frame image, and ver is the vertical angle that the camera needs to rotate in the vertical direction when the face of interest is placed at the center point of the current frame image.
[0017] After the horizontal steering motor and the vertical steering motor are controlled according to the horizontal angle and the vertical angle respectively, the method further comprises:
[0018] Track the face of interest in subsequent frame images. If the face is tracked, return to the action of calculating the horizontal displacement and vertical displacement of the face of interest relative to the center point of the current frame image based on the position of the face of interest in the current frame image; if the face of interest is not tracked in a subsequent preset number of consecutive frame images, return to the action of detecting the face in each frame image.
[0019] After searching for a focus face among detected faces and before calculating the horizontal displacement and vertical displacement of the focus face relative to the center point of the current frame image, the method further includes:
[0020] If multiple attention faces are searched, selecting the attention face with the highest priority from among the multiple attention faces according to the preset priorities of the attention faces;
[0021] Furthermore, according to the position of the concerned face in the current frame image, the horizontal displacement and vertical displacement of the concerned face relative to the center point of the current frame image are calculated as follows:
[0022] Calculate the horizontal displacement and vertical displacement of the highest priority attention face relative to the center point of the current frame image according to the position of the highest priority attention face in the current frame image;
[0023] The calculation of the horizontal angle and the vertical angle that the camera needs to rotate in the horizontal and vertical directions when the focus face is placed at the center point of the current frame image includes:
[0024] The horizontal angle and the vertical angle that the camera needs to rotate in the horizontal and vertical directions when the highest priority focus face is placed at the center point of the current frame image are calculated.
[0025] After detecting the face in each frame of the image and before searching for the focus face among the detected faces, the method further includes:
[0026] For each detected face, determine whether the area s of the face satisfies: Smin≤s≤Smax. If so, determine that the face is a qualified face; otherwise, determine that the face is an unqualified face, where Smin and Smax are preset values;
[0027] The searching for the focus face among the detected faces comprises:
[0028] Search for the face of interest among the eligible faces.
[0029] The Smax is determined as follows:
[0030] In the monitoring scene, the distance between the face and the camera is gradually reduced, and the camera collects images containing the face in real time. When the face in the image collected by the camera begins to blur, the area of the face in the image at this time is taken as Smax;
[0031] The Smin is determined as follows:
[0032] In the monitoring scene, the distance between the face and the camera is gradually increased, and the face changes its position in the scene. The camera tracks the face in real time. When the camera's rotation speed begins to fail to track the face, the area of the face on the image at this time is taken as Smin.
[0033] After detecting the face in each frame of the image and before searching for the focus face among the detected faces, the method further includes:
[0034] For each detected face, perform the following steps: Calculate the height h of the face f , determine whether it satisfies: h f min≤h f ≤h f max, if yes, the face is determined to be a qualified face, otherwise, the face is determined to be an unqualified face, where h f min、h f max is a preset value; or further comprising: for each detected face, respectively executing: calculating the height h from the eyes to the mouth of the face e , determine whether it satisfies: h e min≤h e ≤h e max, if yes, the face is determined to be a qualified face, otherwise, the face is determined to be an unqualified face, where h e min、h e max is the preset value;
[0035] The searching for the focus face among the detected faces comprises:
[0036] Search for the face of interest among the eligible faces.
[0037] The h f min、h f max is determined as follows:
[0038] h f min=cot(β / 2)*H*h fd min / dmax
[0039] h f max=cot(β / 2)*H*h fd max / dmin
[0040] The h e min、h e max is determined as follows:
[0041] h e min=cot(β / 2)*H*h ed min / dmax
[0042] h e max=cot(β / 2)*H*h ed max / dmin
[0043] Where cot is the cotangent trigonometric operator, β is the vertical viewing angle of the camera, and H is the height of the image;
[0044] dmax is: in the monitoring scene, the distance between the face and the camera is gradually increased, and the face changes its position in the scene, and the camera tracks the face in real time. When the camera's rotation speed begins to fail to track the face, the distance between the camera and the face at this time is taken as dmax;
[0045] h fd min is the pre-calculated height of the face when the distance between the camera and the face is dmax;
[0046] h ed min is the pre-calculated height from the eyes to the mouth of the face when the distance between the camera and the face is dmax;
[0047] dmin is: in the monitoring scene, the distance between the face and the camera is gradually reduced, and the camera collects images containing the face in real time. When the face in the image collected by the camera begins to blur, the distance between the camera and the face at this time is taken as dmin;
[0048] h fd max is the pre-calculated height of the face when the distance between the camera and the face is dmin;
[0049] hed max is the pre-calculated height from the eyes to the mouth of the face when the distance between the camera and the face is dmin.
[0050] The searching for the focus face among the detected faces comprises:
[0051] Matching the features of the detected face with the features of the pre-extracted focus face, and if they match, determining that the detected face is the focus face; or,
[0052] If the face of interest is the face of an illegal intruder, the features of the detected face are matched one by one with the features of each legal face extracted in advance. If there is no match with the features of any legal face, the detected face is determined to be the face of interest.
[0053] A face tracking device, comprising: a camera, a rotatable head, a horizontal steering motor, a vertical steering motor and a main control chip, wherein:
[0054] The camera is fixedly connected to the rotatable head and is used to collect images of the monitoring scene in real time and send the images to the main control chip in real time;
[0055] The rotatable head is used to carry a camera and is connected to a horizontal steering motor and a vertical steering motor. The rotatable head can move in the horizontal direction when driven by the horizontal steering motor, and can move in the vertical direction when driven by the vertical steering motor.
[0056] A horizontal steering motor is used to drive the rotatable head to move in the horizontal direction according to the control of the main control chip;
[0057] A vertical steering motor is used to drive the rotatable head to move in the vertical direction according to the control of the main control chip;
[0058] The main control chip is used to execute the steps of any of the above methods, and control the horizontal steering motor and the vertical steering motor respectively according to the calculated horizontal angle and vertical angle that the camera needs to rotate in the horizontal and vertical directions when the face of interest is placed at the center point of the current frame image.
[0059] In an embodiment of the present invention, after a face is detected in the collected surveillance scene image, the face of interest is identified, and then the offset of the face of interest relative to the center point of the image is calculated, and the camera is controlled to rotate so that the face of interest is always in the center of the surveillance image, thereby achieving tracking of a specific face in the surveillance scene. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 A flow chart of a face tracking method provided by an embodiment of the present invention;
[0061] Figure 2 A flow chart of a face tracking method provided by another embodiment of the present invention;
[0062] Figure 3 A flow chart of a face tracking method provided by another embodiment of the present invention;
[0063] Figure 4 A schematic diagram of the structure of a face tracking device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0064] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0065] The inventor analyzed the existing face tracking solutions and found the following problems:
[0066] First, the existing solution only detects faces but does not identify their identities. As a result, the camera will rotate along with any face, which may cause the object that really needs attention to be ignored.
[0067] Second, regardless of the distance between the face and the camera, any detected face will be tracked. When the distance between the face and the camera is too close, the face will be blurry and the tracking effect will be poor. When the distance between the face and the camera is far, the camera rotation speed may not be able to keep up with the target movement speed, resulting in the target being lost.
[0068] 3. When there are multiple faces in a single-frame image, there is no logical way to determine the main face. Usually, the face with the largest area is tracked as the main face. However, in a specific scene, the face with the largest area is not necessarily the object of attention.
[0069] Figure 1 A flow chart of a face tracking method provided by an embodiment of the present invention, wherein the specific steps are as follows:
[0070] Step 101: receiving an image of a monitoring scene captured by a camera.
[0071] Step 102: Detect the face in each frame of image.
[0072] Step 103: Search for a focus face among the detected faces.
[0073] Step 104: Calculate the horizontal displacement and vertical displacement of the focused face relative to the center point of the current frame image according to the position of the focused face in the current frame image.
[0074] Step 105: Calculate the horizontal and vertical angles that the camera needs to rotate in the horizontal and vertical directions when the face of interest is placed at the center point of the current frame image based on the calculated horizontal displacement and vertical displacement.
[0075] Step 106: Control the horizontal steering motor and the vertical steering motor respectively according to the calculated horizontal angle and vertical angle, so that the horizontal steering motor and the vertical steering motor respectively control the rotatable head of the camera to rotate to corresponding angles.
[0076] In the above embodiment, after a face is detected in the collected surveillance scene image, the face of interest is identified, and then the offset of the face of interest relative to the center point of the image is calculated, and the camera is controlled to rotate so that the face of interest is always in the center of the surveillance image, thereby achieving tracking of a specific face in the surveillance scene.
[0077] Figure 2 A flow chart of a face tracking method provided by another embodiment of the present invention, wherein the specific steps are as follows:
[0078] Step 201: Receive an image of a surveillance scene captured by a camera.
[0079] Step 202: Detect the face in each frame of image.
[0080] Step 203: Search for a focus face among the detected faces.
[0081] In an optional embodiment, the features of the detected face are matched with the features of the pre-extracted face of interest, and if they match, the detected face is determined to be the face of interest;
[0082] Alternatively, if the face of interest is the face of an illegal intruder, the features of the detected face are matched one by one with the features of each legal face extracted in advance. If there is no match with the features of any legal face, the detected face is determined to be the face of interest.
[0083] Step 204: Calculate the horizontal displacement and vertical displacement of the focused face relative to the center point of the current frame image according to the position of the focused face in the current frame image.
[0084] In an optional embodiment, the horizontal displacement and vertical displacement of the nose tip of the focus face relative to the center point of the current frame image may be calculated according to the position of the nose tip of the focus face in the current frame image.
[0085] Step 205: Calculate the horizontal and vertical angles that the camera needs to rotate in the horizontal and vertical directions when the face of interest is placed at the center point of the current frame image based on the calculated horizontal displacement and vertical displacement.
[0086] In an optional embodiment, this step specifically includes:
[0087] Calculate hor=(dx / W)*α, ver=(dy / H)*β;
[0088] Among them, dx is the horizontal displacement of the nose tip of the focused face relative to the center point of the current frame image, dy is the vertical displacement of the nose tip of the focused face relative to the center point of the current frame image; W is the width of the current frame image, H is the height of the current frame image; α is the horizontal viewing angle of the camera, β is the vertical viewing angle of the camera; hor is the horizontal angle that the camera needs to rotate in the horizontal direction when the focused face is placed at the center point of the current frame image, and ver is the vertical angle that the camera needs to rotate in the vertical direction when the focused face is placed at the center point of the current frame image.
[0089] Step 206: Control the horizontal steering motor and the vertical steering motor respectively according to the calculated horizontal angle and vertical angle, so that the horizontal steering motor and the vertical steering motor respectively control the rotatable head of the camera to rotate to corresponding angles.
[0090] Step 207: Track the focus face in subsequent frame images. If the focus face is tracked, return to step 204.
[0091] In an optional embodiment, if the face of the person of interest is not tracked in a consecutive preset number of frame images, the process returns to step 202; or, if the face of the person of interest is not tracked in a consecutive preset number of frame images, the camera is rotated back to the initial position by controlling the horizontal steering motor and the vertical steering motor, and the process returns to step 202.
[0092] In the above embodiment, when a face of interest is detected in one frame image, the face of interest is continuously tracked in subsequent frame images. If the face of interest is tracked, the camera is controlled to rotate according to the displacement of the face of interest relative to the center point of the frame image so that the face of interest is always in the center of the image. If the face of interest is not tracked for a preset number of consecutive frames, face detection is restarted.
[0093] Figure 3 A flow chart of a face tracking method provided by another embodiment of the present invention, wherein the specific steps are as follows:
[0094] Step 301: When the face tracking device is started, the rotatable head of the device is in the initial position, and the camera starts to collect images of the monitored scene in real time and transmits each frame of the image to the main control chip in real time.
[0095] The face tracking device mainly includes a camera, a rotatable head, a horizontal steering motor, a vertical steering motor and a main control chip. Among them:
[0096] The rotatable head is used to carry a camera and is connected to a horizontal steering motor and a vertical steering motor. The rotatable head can be rotated in the horizontal direction when driven by the horizontal steering motor, and can be rotated in the vertical direction when driven by the vertical steering motor.
[0097] The horizontal steering motor is used to drive the rotatable head to rotate horizontally according to the horizontal angle sent by the main control chip;
[0098] The vertical steering motor is used to drive the rotatable head to rotate vertically according to the vertical angle sent by the main control chip;
[0099] The main control chip is used to execute subsequent steps 302-309.
[0100] The initial position of the rotatable head can be determined according to the position and range where the tracked object often appears, so that the initial field of view of the camera covers the position and range where the tracked object often appears.
[0101] Step 302: For each received frame of image, the main control chip detects the face in the frame of image in real time.
[0102] Step 303: For each human face detected in the frame image, the main control chip executes respectively: determining whether the area s of the human face satisfies: Smin≤s≤Smax; if so, determining that the human face is a qualified face and executing step 304; otherwise, determining that the human face is an unqualified face and discarding the face.
[0103] Smin and Smax can be obtained based on preliminary tests. Specifically:
[0104] In the monitoring scene, the distance between the face and the camera is gradually reduced, and the camera collects images containing the face in real time. When the face in the image collected by the camera begins to blur, the area of the face in the image at this time is taken as Smax;
[0105] In the monitoring scene, the distance between the face and the camera is gradually increased, and the face changes its position in the scene. The camera tracks the face in real time. When the camera's rotation speed begins to fail to track the face, the area of the face on the image at this time is taken as Smin.
[0106] Step 304: The main control chip searches for a focus face among all detected qualified faces.
[0107] If the features of the attention face can be extracted in advance, the features of the attention face are extracted in advance. In this step, the features of each qualified face are first extracted, and then the features of each qualified face are matched with the features of the attention face respectively. If they match, it is determined that the matched qualified face is the attention face;
[0108] If the features of the face of interest cannot be extracted, for example, the face of interest is the face of an illegal intruder, such as a stranger, then the features of all legal faces can be extracted in advance. In this step, the features of each qualified face are first extracted, and then the features of each qualified face are matched with the features of each legal face respectively. If a qualified face does not match any legal face, it is determined that the qualified face is the face of an illegal intruder, that is, the face of interest.
[0109] For example, in a family scenario, the object of attention is usually the person to be cared for, such as the elderly and children in the family. In addition, strangers are also objects of attention.
[0110] Since the features of strangers’ faces cannot be extracted in advance, it is necessary to extract the facial features of all family members in advance;
[0111] In this step, for each qualified face, the features of the qualified face are first matched with the features of the focus object whose features have been extracted. If they match, the qualified face is determined to be the focus face. Otherwise, the qualified face is continued to be matched with the facial features of other family members whose features have been extracted. If it matches with any family member, the qualified face is determined to be a legal face but not a focus face. If it does not match with any family member, the qualified face is determined to be a stranger face, that is, the focus face.
[0112] When multiple attention faces are preset, different priorities can be set for each attention face according to the importance of the multiple attention faces. If multiple attention faces are searched among the detected qualified faces, the attention face with the highest priority is used as the current attention face, and steps 305-309 are performed on the current attention face. For example: in a family scene, caregivers > strangers, or / and, close-up faces > distant faces.
[0113] Step 305: The main control chip calculates the horizontal displacement and vertical displacement of the nose tip of the focused face relative to the center point of the image according to the position of the nose tip of the focused face in the current frame image, and calculates the horizontal and vertical angles that the camera needs to rotate in the horizontal and vertical directions when the nose tip of the focused face is placed at the center point of the current frame image according to the horizontal displacement and vertical displacement.
[0114] Step 306: The main control chip sends the horizontal angle to the horizontal steering motor so that the horizontal steering motor drives the rotatable head to rotate horizontally by the horizontal angle; and sends the vertical angle to the vertical steering motor so that the vertical steering motor drives the rotatable head to rotate vertically by the vertical angle.
[0115] Step 307: The main control chip tracks the face of interest in subsequent frame images and determines whether it is tracked. If so, return to step 305; otherwise, execute step 308.
[0116] Step 308 : The main control chip determines whether the object of interest has not been tracked for a preset number of consecutive frames. If so, execute step 309 ; otherwise, return to step 307 .
[0117] Step 309: The main control chip controls the horizontal steering motor and the vertical steering motor to rotate the rotatable head back to the initial position, and returns to step 302.
[0118] In the above embodiment, not only the tracking of the focus face, i.e., the specific face, is achieved, but also after the face is detected, the faces that are too close or too far from the camera are screened out according to the face area, thereby optimizing the tracking effect.
[0119] In a specific application, step 303 may also be replaced by:
[0120] For each detected face, perform the following steps: Calculate the height h of the face f , determine whether it satisfies: h f min≤h f ≤h f max, if yes, the face is determined to be a qualified face, otherwise, the face is determined to be an unqualified face, where h f min、h f max is the preset value; or, for each detected face, respectively, perform: Calculate the height h from the eyes to the mouth of the face e , determine whether it satisfies: h e min≤h e ≤h e max, if yes, the face is determined to be a qualified face, otherwise, the face is determined to be an unqualified face, where h e min、h e max is the default value.
[0121] Among them, h f min、h f max is determined as follows:
[0122] h f min=cot(β / 2)*H*h fd min / dmax
[0123] h f max=cot(β / 2)*H*h fd max / dmin
[0124] The h e min、h e max is determined as follows:
[0125] h emin=cot(β / 2)*H*h ed min / dmax
[0126] h e max=cot(β / 2)*H*h ed max / dmin
[0127] Where cot is the cotangent trigonometric operator, β is the vertical viewing angle of the camera, and H is the height of the image;
[0128] dmax is: in the monitoring scene, the distance between the face and the camera is gradually increased, and the face changes its position in the scene, and the camera tracks the face in real time. When the camera's rotation speed begins to fail to track the face, the distance between the camera and the face at this time is taken as dmax;
[0129] h fd min is the pre-calculated height of the face when the distance between the camera and the face is dmax;
[0130] h ed min is the pre-calculated height from the eyes to the mouth of the face when the distance between the camera and the face is dmax;
[0131] dmin is: in the monitoring scene, the distance between the face and the camera is gradually reduced, and the camera collects images containing the face in real time. When the face in the image collected by the camera begins to blur, the distance between the camera and the face at this time is taken as dmin;
[0132] h fd max is the pre-calculated height of the face when the distance between the camera and the face is dmin;
[0133] h ed max is the pre-calculated height from the eyes to the mouth of the face when the distance between the camera and the face is dmin.
[0134] Figure 4 This is a schematic diagram of the structure of a face tracking device provided by an embodiment of the present invention. The device mainly includes: a camera 41, a rotatable head 42, a horizontal steering motor 43, a vertical steering motor 44 and a main control chip 45. Among them:
[0135] The camera 41 is fixedly connected to the rotatable head 42 and is used to collect images of the monitoring scene in real time and send the images to the main control chip 45 in real time.
[0136] The rotatable head 42 is used to carry the camera 41 and is connected to the horizontal steering motor 43 and the vertical steering motor 44. Under the drive of the horizontal steering motor 43, the rotatable head 42 can rotate in the horizontal direction. Under the drive of the vertical steering motor 44, the rotatable head 42 can rotate in the vertical direction.
[0137] The horizontal steering motor 43 is used to drive the rotatable head 42 to rotate in the horizontal direction according to the control of the main control chip 45.
[0138] The vertical steering motor 44 is used to drive the rotatable head 42 to rotate in the vertical direction according to the control of the main control chip 45.
[0139] The main control chip 45 is used to execute steps 101-106, or steps 201-207, or steps 302-309; and to control the horizontal steering motor 43 and the vertical steering motor 44 respectively according to the calculated horizontal angle and vertical angle that the camera needs to rotate in the horizontal and vertical directions when the face of interest is placed at the center point of the current frame image.
[0140] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A face tracking method, characterized in that: The method includes: Receiving images of the surveillance scene captured by the camera; Detect faces in each frame; Searching for a face of interest among detected faces; Calculating the horizontal displacement and vertical displacement of the focus face relative to the center point of the current frame image according to the position of the focus face in the current frame image; According to the calculated horizontal displacement and vertical displacement, the horizontal angle and vertical angle that the camera needs to rotate in the horizontal and vertical directions when the face of interest is placed at the center point of the current frame image are calculated; Controlling the horizontal steering motor and the vertical steering motor respectively according to the horizontal angle and the vertical angle, so that the horizontal steering motor and the vertical steering motor respectively control the rotatable head of the camera to rotate to a corresponding angle; After detecting the face in each frame of the image and before searching for the focus face among the detected faces, the method further includes: For each detected face, perform the following steps: Calculate the height h of the face f , determine whether it satisfies: h f min≤h f ≤h f max, if yes, the face is determined to be a qualified face, otherwise, the face is determined to be an unqualified face, where h f min、h f max is a preset value; or further comprising: for each detected face, respectively executing: calculating the height h from the eyes to the mouth of the face e , determine whether it satisfies: h e min≤h e ≤h e max, if yes, the face is determined to be a qualified face, otherwise, the face is determined to be an unqualified face, where h e min、h e max is the preset value; The searching for the focus face among the detected faces comprises: Searching for a face of interest among eligible faces; The h f min、h f max is determined as follows: h f min=cot(β / 2)*H*h fd min / dmax h f max=cot(β / 2)*H*h fd max / dmin The h e min、h e max is determined as follows: h e min=cot(β / 2)*H*h ed min / dmax h e max=cot(β / 2)*H*h ed max / dmin Where cot is the cotangent trigonometric operator, β is the vertical viewing angle of the camera, and H is the height of the image; dmax is: in the monitoring scene, the distance between the face and the camera is gradually increased, and the face changes its position in the scene, and the camera tracks the face in real time. When the camera's rotation speed begins to fail to track the face, the distance between the camera and the face at this time is taken as dmax; h fd min is the pre-calculated height of the face when the distance between the camera and the face is dmax; h ed min is the pre-calculated height from the eyes to the mouth of the face when the distance between the camera and the face is dmax; dmin is: in the monitoring scene, the distance between the face and the camera is gradually reduced, and the camera collects images containing the face in real time. When the face in the image collected by the camera begins to blur, the distance between the camera and the face at this time is taken as dmin; h fd max is the pre-calculated height of the face when the distance between the camera and the face is dmin; h ed max is the pre-calculated height from the eyes to the mouth of the face when the distance between the camera and the face is dmin.
2. The method according to claim 1, characterized in that The calculating of the horizontal displacement and the vertical displacement of the focus face relative to the center point of the current frame image comprises: Calculate the horizontal displacement dx and the vertical displacement dy of the nose tip of the focus face relative to the center point of the current frame image; The calculation of the horizontal angle and the vertical angle that the camera needs to rotate in the horizontal and vertical directions when the focus face is placed at the center point of the current frame image includes: Calculate hor=(dx / W)*α, ver=(dy / H)*β; Wherein, W is the width of the current frame image, H is the height of the current frame image, α is the horizontal viewing angle of the camera, β is the vertical viewing angle of the camera, hor is the horizontal angle that the camera needs to rotate in the horizontal direction when the face of interest is placed at the center point of the current frame image, and ver is the vertical angle that the camera needs to rotate in the vertical direction when the face of interest is placed at the center point of the current frame image.
3. The method according to claim 1, characterized in that After the horizontal steering motor and the vertical steering motor are controlled according to the horizontal angle and the vertical angle respectively, the method further comprises: Track the face of interest in subsequent frame images. If the face is tracked, return to the action of calculating the horizontal displacement and vertical displacement of the face of interest relative to the center point of the current frame image based on the position of the face of interest in the current frame image; if the face of interest is not tracked in a subsequent preset number of consecutive frame images, return to the action of detecting the face in each frame image.
4. The method according to claim 1, characterized in that: After searching for a focus face among detected faces and before calculating the horizontal displacement and vertical displacement of the focus face relative to the center point of the current frame image, the method further includes: If multiple attention faces are searched, selecting the attention face with the highest priority from among the multiple attention faces according to the preset priorities of the attention faces; Furthermore, according to the position of the concerned face in the current frame image, the horizontal displacement and vertical displacement of the concerned face relative to the center point of the current frame image are calculated as follows: Calculate the horizontal displacement and vertical displacement of the highest priority attention face relative to the center point of the current frame image according to the position of the highest priority attention face in the current frame image; The calculation of the horizontal angle and the vertical angle that the camera needs to rotate in the horizontal and vertical directions when the focus face is placed at the center point of the current frame image includes: The horizontal angle and the vertical angle that the camera needs to rotate in the horizontal and vertical directions when the highest priority focus face is placed at the center point of the current frame image are calculated.
5. The method according to claim 1, characterized in that After detecting the face in each frame of the image and before searching for the focus face among the detected faces, the method further includes: For each detected face, determine whether the area s of the face satisfies: Smin≤s≤Smax. If so, determine that the face is a qualified face; otherwise, determine that the face is an unqualified face, where Smin and Smax are preset values; The searching for the focus face among the detected faces comprises: Search for the face of interest among the eligible faces.
6. The method according to claim 5, characterized in that The Smax is determined as follows: In the monitoring scene, the distance between the face and the camera is gradually reduced, and the camera collects images containing the face in real time. When the face in the image collected by the camera begins to blur, the area of the face in the image at this time is taken as Smax; The Smin is determined as follows: In the monitoring scene, the distance between the face and the camera is gradually increased, and the face changes its position in the scene. The camera tracks the face in real time. When the camera's rotation speed begins to fail to track the face, the area of the face on the image at this time is taken as Smin.
7. The method according to claim 1, characterized in that The searching for the focus face among the detected faces comprises: Matching the features of the detected face with the features of the pre-extracted focus face, and if they match, determining that the detected face is the focus face; or, If the face of interest is the face of an illegal intruder, the features of the detected face are matched one by one with the features of each legal face extracted in advance. If there is no match with the features of any legal face, the detected face is determined to be the face of interest.
8. A face tracking device, characterized in that: The device includes: a camera, a rotatable head, a horizontal steering motor, a vertical steering motor and a main control chip, wherein: The camera is fixedly connected to the rotatable head and is used to collect images of the monitoring scene in real time and send the images to the main control chip in real time; The rotatable head is used to carry a camera and is connected to a horizontal steering motor and a vertical steering motor. The rotatable head can move in the horizontal direction when driven by the horizontal steering motor, and can move in the vertical direction when driven by the vertical steering motor. A horizontal steering motor is used to drive the rotatable head to rotate in the horizontal direction according to the control of the main control chip; A vertical steering motor is used to drive the rotatable head to rotate in the vertical direction according to the control of the main control chip; A main control chip, used to execute the steps of any method as described in claims 1 to 7, and control the horizontal steering motor and the vertical steering motor respectively according to the calculated horizontal angle and vertical angle that the camera needs to rotate in the horizontal and vertical directions when the face of interest is placed at the center point of the current frame image.
