CN111212233A - Method for automatically optimizing scanning path based on PTZ camera - Google Patents

Method for automatically optimizing scanning path based on PTZ camera Download PDF

Info

Publication number
CN111212233A
CN111212233A CN202010060747.1A CN202010060747A CN111212233A CN 111212233 A CN111212233 A CN 111212233A CN 202010060747 A CN202010060747 A CN 202010060747A CN 111212233 A CN111212233 A CN 111212233A
Authority
CN
China
Prior art keywords
ptz
path
scanning
face information
face
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010060747.1A
Other languages
Chinese (zh)
Other versions
CN111212233B (en
Inventor
罗章璞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu E Learning Technology Co ltd
Original Assignee
Chengdu E Learning Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu E Learning Technology Co ltd filed Critical Chengdu E Learning Technology Co ltd
Priority to CN202010060747.1A priority Critical patent/CN111212233B/en
Publication of CN111212233A publication Critical patent/CN111212233A/en
Application granted granted Critical
Publication of CN111212233B publication Critical patent/CN111212233B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/61Control of cameras or camera modules based on recognised objects
    • H04N23/611Control of cameras or camera modules based on recognised objects where the recognised objects include parts of the human body
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/695Control of camera direction for changing a field of view, e.g. pan, tilt or based on tracking of objects

Abstract

The invention provides a method for automatically optimizing a scanning path based on a PTZ camera, and belongs to the field of security and protection. In order to solve the problem that the face information is always detected in a space to be detected according to a fixed scanning path when the face information is acquired based on a PTZ camera at present, and the scanning time is wasted, the method comprises the following steps: firstly, determining an initial scanning path of a PTZ camera in a region to be detected, taking the initial scanning path as a current scanning path, and establishing a face information list; secondly, the PTZ camera moves along the current scanning path, and a face information list is updated according to the face information in the scanning picture; and then, updating the current scanning path according to the updated face information list, and enabling the PTZ camera to move along the updated scanning path. The invention can ensure that the PTZ camera collects the face information which is clear enough for each person, the arrangement limitation on the space to be detected can not be carried out, the route suitable for the arrangement of the people in the current room can be optimized, and the problem of scanning time waste is avoided.

Description

Method for automatically optimizing scanning path based on PTZ camera
Technical Field
The invention relates to the field of security and protection, in particular to a method for automatically optimizing a scanning path based on a PTZ camera.
Background
In some scenarios, for example, a student is in a classroom and a member of an organization is in a meeting in a room, it is necessary to identify the person in the room, such as roll calling. When all the personnel have a uniform facing direction, such as a wall (a blackboard and a projection screen) facing a room, the cameras are deployed at proper positions to collect facial images of all the personnel in the room, and roll calling can be efficiently and accurately realized by using a face recognition related algorithm so as to replace manual roll calling work. This is not done well with ordinary cameras for several reasons: the camera view is not wide enough to cover the entire room; the position of the person within the room may be different each time; the distant faces of large rooms are not clearly captured without zooming, and once zoomed, the field of view is further reduced.
Compared with an ordinary fixed camera, the PTZ camera provides mechanical motion capability in the horizontal direction and the vertical direction to adjust the shooting angle, and generally has stronger zooming capability so as to obtain a clear image at a farther distance. PTZ cameras offer the potential to address the above three issues.
Further, when the PTZ is deployed in the following scene, the shooting angle can be adjusted through mechanical movement and a clear image of any face in a room can be obtained through zooming:
1. the room is rectangular or trapezoidal, and the ground is flat;
2. the persons in the room have a uniform orientation, whether standing or sitting. The person who needs the PTZ scanning faces a wall in a room uniformly, and under the scene of a classroom, students face the wall surface on which the blackboard is arranged, and the wall is defined as the wall in front of the room. The PTZ is also deployed on the wall, and the height from the ground is not lower than the height from the ground, which is possibly generated by the human face;
3. PTZ cameras typically have a maximum detection range, e.g., 20 meters, with respect to a human face. The room is of moderate size, ensuring that the distance from the PTZ farthest point does not exceed this distance; the PTZ also has a minimum detection distance, e.g. 1.6 meters, with respect to the face, to which the range of people in the room to be distributed to the PTZ camera is not below;
4. the persons in the room are generally uniformly facing a small area of the front wall, such as the standing position that the teacher, speaker, is accustomed to in classroom and conference room scenarios, which is generally the position of the front wall centered or slightly off-centered horizontally. The PTZ is also deployed in this position so that the face of the person faces the presenter and thus also faces generally toward the PTZ.
PTZ provides mechanical motion functionality, but controlling the scanning of a room by PTZ generally relies on manual operations. Given that two faces in a room that are far apart cannot appear in the same frame, the PTZ camera provides a network interface to the operator. The operator adjusts the shooting direction and the magnification of the PTZ through the interface, rotates the PTZ to the position where the first face can be clearly observed, and defines the triple at the moment: (horizontal motor angle, vertical motor angle, picture magnification) is a PTZ path point. The operator then performs the same operation on a second face to determine a second PTZ waypoint. The PTZ camera may remember these two path points and connect the two points to form a scan path, i.e., move the horizontal/vertical motor to the positions defined by the two path points in sequence in the subsequent scan, and uniformly change the magnification of the picture from the magnification defined by the previous point to the magnification defined by the next point. More generally, PTZ cameras support defining multiple PTZ path points to generate more complex scan paths. When faces are then reappeared near and between these two locations in the room, the PTZ can automatically acquire clear images of these faces without human re-intervention. The problem with this strategy is that it is not efficient enough, in particular:
1. for different rooms, especially rooms with different sizes, the route for the rooms needs to be manually defined respectively;
2. the definition of PTZ waypoints is related to the layout height within the room: if the room is added with tables and chairs, the PTZ path point and the scanning route may need to be redefined
3. The scanning efficiency is low: the number of people in each scan may be different, for example, sometimes the number of people in a room is small and concentrated, a face cannot be detected at most positions on the scanning path of the PTZ, and the PTZ still passes through all the defined PTZ path points in sequence. The time to move on the path points where the face cannot be detected is wasted.
Disclosure of Invention
The invention aims to provide a method for automatically optimizing a scanning path based on a PTZ camera, which solves the problems that the face information is always detected in a space to be detected according to a fixed scanning path when the face information is collected based on the PTZ camera at present, the scanning time is wasted, and the working efficiency is low when the scanning behaviors are manually defined for different rooms.
The invention solves the technical problem, and adopts the technical scheme that: the method for automatically optimizing the scanning path based on the PTZ camera comprises the following steps:
step 1, determining an initial scanning path of a PTZ camera in a region to be detected, taking the initial scanning path as a current scanning path, and establishing a face information list;
step 2, the PTZ camera moves along the current scanning path, and a face information list is updated according to face information in a scanning picture;
and 3, updating the current scanning path according to the updated face information list, and returning to the step 2.
Further, in step 1, the method for determining the initial scanning path of the PTZ camera in the area to be detected is as follows:
using a scanning path prestored in the PTZ camera;
or calculating an initial scanning path of the PTZ camera according to the specific layout of the region to be detected;
or, using PTZ path points prestored in the PTZ camera, and calculating an initial scanning path according to the prestored PTZ path points.
Further, when an initial scanning path is calculated according to a pre-stored PTZ path point by using a PTZ path point pre-stored in the PTZ camera, the method specifically comprises the following steps:
firstly, determining a series of PTZ path points in the movable range of the PTZ camera, wherein one PTZ path point defines the motor control angles of the PTZ in the horizontal and vertical directions and the picture magnification when aiming at the direction;
then, a loop-free path connecting all PTZ path points is determined as an initial scan path.
Further, the generated path is a sequence of selected PTZ path points, and a loop-free path means that the same PTZ path point does not repeatedly appear in the sequence.
Further, the method of determining PTZ path points is as follows:
respectively selecting a series of values at equal intervals in the movable angle range of the motors in the two PTZ directions, taking the values as the control angles of the PTZ motors in the horizontal and vertical directions, and setting the magnification as a preset value, thereby determining each PTZ path point;
or, defining a prefabricated area layout to be detected and a deployment position of the PTZ camera, determining a PTZ path point at the position where each face possibly exists in the area to be detected, wherein the position where the face possibly exists in the area to be detected is determined by prefabricated parameters, calculating the direction angles of two motors when the PTZ camera aligns to the face position and the relative distance between the two motors according to the relative relationship of the two positions, and determining the image magnification times of the PTZ when the face position has a face with a preset size according to the relative distance.
Further, in step 2, the specific operation of updating the face information list according to the face picture in the scanned picture includes:
the PTZ camera moves along the current scanning path within a specified time period, the face detection is carried out on the video stream frame by frame, the PTZ coordinate of the detected face is calculated, and the face identity is recognized, wherein the PTZ coordinate refers to the following steps: the horizontal motor angle and the vertical motor angle form a PTZ;
judging whether the PTZ coordinates of the face appear in the face information list or not according to the PTZ coordinates of the face, if so, determining that the PTZ coordinates are within a certain distance from the coordinates recorded in a certain item in the face information list, if so, updating the face information list by using the face information in the frame, and if not, establishing a new item for the face information list and writing the face information into the face information list.
Further, in step 2, updating the face information list according to the face information in the PTZ video stream specifically further includes:
and after the scanning is finished, aging the items of the face information list, wherein the process specifically comprises the following steps: the PTZ camera scans one round from one end to the other end along the current scanning path completely, when any list item is updated to the face information list, the current round count is written into the list item when any list item is modified, after one round of scanning is finished and before the next round of scanning is started, the PTZ camera compares the round count of each item in the face information list with the current round count, if the round count of the face information list item is smaller than the current round count, the situation that a face is not detected at the position in a plurality of nearest rounds is shown, and if the difference value of the round count and the next round count is larger than a preset threshold value, the item is deleted from the face information list.
Further, in step 3, the process of updating the current scanning path according to the updated face information list specifically includes:
step 301, setting all PTZ path points to be not effective;
step 302, traversing a face information list, determining a row of PTZ path points closest to the PTZ coordinates of any face record, determining a pair of PTZ path points closest to the record on the row, and setting the two points as effective points;
step 303, traversing each row of the PTZ path, and marking all path points between the minimum x value and the maximum x value in the PTZ path points belonging to the row as effective, so as to generate a continuous PTZ path point distribution area in the PTZ path points in the row;
and step 304, selecting the effective parts in each row of PTZ path points, connecting the minimum x value to the maximum x value in the same row, alternately connecting the minimum x and maximum x path points in each row to form a loop-free path, starting from any end point of the loop-free path to another end point to form an access sequence of PTZ path points, and taking the sequence as the current scanning path.
Further, in step 3, the process of updating the current scanning path according to the updated face information list specifically further includes:
setting an expansion process of a counter and a path, wherein in the path expansion process, a PTZ camera calculates a PTZ coordinate area covered by the current scanning path and calculates a larger range on the basis, then PTZ selects PTZ path points in the area to be set to be effective, a loop-free path connecting all effective PTZ path points is generated to be used as the current scanning path, the counter is increased progressively every time the expansion process is carried out, and the larger the value of the counter in each expansion process is, the larger the increase amplitude of the expansion area generated on the basis of the PTZ coordinate area of the original path is.
Further, in step 3, the expansion process of updating the current scanning path according to the updated face information list occurs in the following two cases:
condition 1: giving a threshold value, deciding to perform one expansion when the scanning wheel count reaches the threshold value, and expanding the threshold value in a double mode after the expansion so as to reduce the occurrence frequency of the expansion process;
condition 2: comparing the current scanning path generated in the PTZ path updating process with the scanning path of the previous round, and if any one row of PTZ path points is changed from the original whole non-effective state to any one path point effective state, or the x value of the minimum x or the maximum x point of the row of PTZ path points is smaller or larger than the x value of the previous row of PTZ path points, determining to perform one expansion;
otherwise the expansion process is skipped to the next scan round.
The method has the advantages that through the method for automatically optimizing the scanning path based on the PTZ camera, firstly, the initial scanning path of the PTZ camera in the area to be detected is determined and is used as the current scanning path, and a face information list is established; secondly, the PTZ camera moves along the current scanning path, and a face information list is updated according to the face information in the scanning picture; and then, updating the current scanning path according to the updated face information list, and enabling the PTZ camera to move along the updated scanning path. Therefore, the invention can ensure that the PTZ camera can comprehensively acquire the face information which is clear enough for each person, reduces the limitation on the room layout, can optimize the route suitable for the current room personnel layout, avoids wasting the scanning time, and solves the problem of low working efficiency of manually defining the scanning route aiming at different room layouts.
Drawings
FIG. 1 is a flow chart of a method for automatically optimizing a scan path based on a PTZ camera in accordance with the present invention;
fig. 2 is a schematic view of an extended scanning range of a conventional PTZ camera in scene 3 of this embodiment;
fig. 3 is a schematic view of an extended scanning range of an improved PTZ camera in scene 3 of this embodiment;
fig. 4 is a schematic view of an extended scanning range of a conventional PTZ camera in scene 4 of this embodiment;
fig. 5 is a schematic view of an extended scanning range of the improved PTZ camera in scene 4 of this embodiment.
Detailed Description
The technical solution of the present invention is described in detail below with reference to the embodiments and the accompanying drawings.
The invention discloses a method for automatically optimizing a scanning path based on a PTZ camera, which has a flow chart shown in figure 1, wherein the method comprises the following steps:
step 1, determining an initial scanning path of a PTZ camera in a region to be detected, taking the initial scanning path as a current scanning path, and establishing a face information list;
step 2, the PTZ camera moves along the current scanning path, and a face information list is updated according to face information in a scanning picture;
and 3, updating the current scanning path according to the updated face information list, and returning to the step 2.
Among the above methods, as a further preferred method, in step 1, there are many methods for determining an initial scanning path of the PTZ camera in the area to be detected, and the method in the present application is as follows: a scanning path prestored in the PTZ camera can be used, wherein the prestored scanning path can be set according to the specific scene requirement of the area to be detected; or calculating an initial scanning path of the PTZ camera according to the specific layout of the region to be detected; or, using PTZ path points prestored in the PTZ camera, and calculating an initial scanning path according to the prestored PTZ path points. Here, different initial scanning paths may be calculated according to different specific scenes of the area to be detected, and when the PTZ scans along the determined initial scanning path, all the face information in the established face information list can be scanned.
Preferably, the method includes the following steps of using PTZ path points pre-stored in the PTZ camera, and calculating an initial scanning path according to the pre-stored PTZ path points:
firstly, determining a series of PTZ path points of a movable range of a PTZ camera, wherein one PTZ path point defines the motor control angles of the PTZ in the horizontal and vertical directions and the picture magnification factor when aiming at the direction;
then, a loop-free path connecting all PTZ path points is determined as an initial scan path.
The PTZ moves between two waypoints with a depth of field area that lines an area within the room. When a face appears in the region and faces in a specified direction, the PTZ can capture a sharp image of the face in a certain frame of the video stream.
It should be noted that the path generated in the present application is a sequence of selected PTZ path points, and a loop-free path means that the same PTZ path point does not repeatedly appear in the sequence.
Preferably, the method of determining PTZ path points is as follows:
respectively selecting a series of values at equal intervals in the movable angle range of the motors in the two PTZ directions, taking the values as the control angles of the PTZ motors in the horizontal and vertical directions, and setting the magnification as a preset value, thereby determining each PTZ path point;
or, defining a prefabricated area layout to be detected and a deployment position of the PTZ camera, determining a PTZ path point at the position where each face possibly exists in the area to be detected, wherein the position where the face possibly exists in the area to be detected is determined by prefabricated parameters, calculating the direction angles of two motors when the PTZ camera aligns to the face position and the relative distance between the two motors according to the relative relationship of the two positions, and determining the image magnification times of the PTZ when the face position has a face with a preset size according to the relative distance.
In step 2 of the method, the specific operation of updating the face information list according to the face picture in the scan picture may include:
the PTZ camera moves along the current scanning path within a specified time period, the face detection is carried out on the video stream frame by frame, the PTZ coordinate of the detected face is calculated, and the face identity is recognized;
judging whether the PTZ coordinates of the face appear in the face information list or not according to the PTZ coordinates of the face, if so, determining that the PTZ coordinates are within a certain distance from the coordinates recorded in a certain item in the face information list, if so, updating the face information list by using the face information in the frame, and if not, establishing a new item for the face information list and writing the face information into the face information list.
Preferably, in step 2, updating the face information list according to the face information in the PTZ video stream may further include:
and after the scanning is finished, aging the items of the face information list, wherein the process specifically comprises the following steps: the PTZ camera scans one round from one end to the other end along the current scanning path completely, when any list item is updated to the face information list, the current round count is written into the list item when any list item is modified, after one round of scanning is finished and before the next round of scanning is started, the PTZ camera compares the round count of each item in the face information list with the current round count, if the round count of the face information list item is smaller than the current round count, the situation that a face is not detected at the position in a plurality of nearest rounds is shown, and if the difference value of the round count and the next round count is larger than a preset threshold value, the item is deleted from the face information list.
In step 3 of the above method, the process of updating the current scanning path according to the updated face information list specifically includes:
step 301, setting all PTZ path points to be not effective;
step 302, traversing a face information list, determining a row of PTZ path points closest to the PTZ coordinate of any face record, determining a pair of PTZ path points closest to the record on the row, and setting the two points as effective points;
step 303, traversing each row of the PTZ path, and marking all path points between the minimum x value and the maximum x value in the PTZ path points belonging to the row as effective, so as to generate a continuous PTZ path point distribution area in the PTZ path points in the row;
and step 304, selecting the effective parts in each row of PTZ path points, connecting the minimum x value to the maximum x value in the same row, alternately connecting the minimum x and maximum x path points in each row to form a loop-free path, starting from any end point of the loop-free path to another end point to form an access sequence of PTZ path points, and taking the sequence as the current scanning path.
As a further preferred option, in step 3, the process of updating the current scanning path according to the updated face information list may further include:
setting an expansion process of a counter and a path, wherein in the path expansion process, a PTZ camera calculates a PTZ coordinate area covered by the current scanning path and calculates a larger range on the basis, then PTZ selects PTZ path points in the area to be set to be effective, a loop-free path connecting all effective PTZ path points is generated to be used as the current scanning path, the counter is increased progressively every time the expansion process is carried out, and the larger the value of the counter in each expansion process is, the larger the increase amplitude of the expansion area generated on the basis of the PTZ coordinate area of the original path is.
It should be noted that, in the step 3, the expansion process of updating the current scanning path according to the updated face information list occurs in the following two cases:
condition 1: giving a threshold value, deciding to perform one expansion when the scanning wheel count reaches the threshold value, and expanding the threshold value in a form of doubling and the like after the expansion so as to reduce the occurrence frequency of the expansion process;
condition 2: comparing the current scanning path generated in the PTZ path updating process with the scanning path of the previous round, and if any one row of PTZ path points is changed from the original whole non-effective state to any one path point effective state, or the x value of the minimum x or the maximum x point of the row of PTZ path points is smaller or larger than the x value of the previous row of PTZ path points, determining to perform one expansion;
otherwise the expansion process is skipped to the next scan round.
Therefore, the PTZ camera can acquire the sufficient clear face information of each person, the arrangement limitation of the detection space can not be carried out, the route suitable for the personnel layout of the current room can be optimized, and the problem of waste of scanning time is avoided.
Examples
The goal of this embodiment is to achieve PTZ to automatically control its own scanning behavior, minimizing external operations. The core is that a series of inaccurate initial paths are built in the PTZ camera, and then the paths are combined and automatically adjusted, and gradually approach to the optimal state in the execution process.
Specifically, the present embodiment may include the following steps:
1. PTZ calculates a series of substantially parallel, near-to-far, strip-like paths from the parameters. Together, these paths can cover a space much larger than the possible size of an actual room;
2. generating an initial scanning path covering the actual deployment room by combining the strip paths;
3. the position of each detected face is calculated in the scanning, compared with the scanning path and the scanning path is continuously optimized, which comprises deleting the part of the scanning path without the face, and expanding the scanning path until no found face is missed.
In practical application, when generating PTZ path points:
the PTZ path points define a static PTZ mechanical position: the angle of the horizontal motor, the angle of the vertical motor and the magnification of the picture. The PTZ defines a series of PTZ path points and ensures that the PTZ deployed room can be covered if the PTZ traverses these path points. The PTZ has built in a series of PTZ path points that have the following characteristics:
1. there are a series of rows generally parallel to the x-axis (horizontal motor running direction) with a number of PTZ path points on each row
2. Different rows have different y-coordinates (vertical motor running direction) covering the entire PTZ coordinate plane (x-y)
The work of generating PTZ path points is divided into two steps:
1. a room is prefabricated and the locations where the faces may be distributed are estimated by the dimensions of the room, and points are selected among these locations.
2. The absolute position of the point determined in 1 within the room is determined. Therefore, the position relation (distance in vertical, horizontal and other directions) relative to the PTZ can be calculated so as to derive the PTZ coordinate corresponding to the point.
The PTZ path point effect generated following the above steps is as follows: when the PTZ passes through the rows of PTZ path points, the lens focus of the PTZ passes through the complete scanning of the room from near to far.
When generating a scan path with PTZ path points:
PTZ path points are organized in a row/bar structure, which may be named l1,…,ln。liHaving a plurality of PTZ path points pi,j=(xi,j,yi,j) J is 1, …, and x is satisfiedi,j<xi,j+1PTZ path points in a row/bar are arranged from left to right according to mark numbers and have a sequential relation, and each PTZ path point has an additional attribute ei,jWhether the PTZ passes through it during the actual scan is described as true/false. There is a distinct lateral structure, i.e., the rows, between the PTZ path points.
Further, this "row" concept is also optional, and the PTZ path points may be connected together in any manner. The benefit of organizing the PTZ path points in this way is: the PTZ path points in the same row correspond to locations in the classroom at approximately the same distance from the PTZ so that the PTZ does not need to be zoomed heavily as it moves on the same row. This reduces the possibility of the PTZ picture being unclear.
For each row, if there are active path points on it, then all path points between the leftmost/right active PTZ path points on that row are marked as true.
The active PTZ path points are connected in rows to form a series of polylines, and the left/right end points of the polylines are alternately connected until an endless polyline is formed that connects all active PTZ path points. As a preferred scheme, the optimization algorithm can be used to adjust the connection rule of the left/right points of the effective segment, and the left/right end points do not need to be connected correspondingly all the time, so that the length of the generated broken line can be shortened.
During path adjustment during scanning:
the core is an adjustment algorithm that repeats multiple rounds, each round performing the same operating logic. In each round, three stages are divided:
1. scanning: the PTZ performs mechanical motion along a scanning path, processes and identifies the perceived identity and position of the face;
2. path updating: determining modification of PTZ path points according to the positions of the human faces scanned in the current round;
3. and (3) updating the state: clearing the calculated variables and according to the effective mark e of the PTZ path pointi,jThe scan path for the next round is calculated.
Wherein the PTZ maintains a series of PTZ path points pi,jThe path points being arranged substantially in transverse rows, pi,jRefers to the jth point of the ith row. The path scan-adjust algorithm maintains the following variables:
1. the counter k is initially 0, and counts each round; the variable n has an initial value of n0,n0A typical value of 2, controlling when the path is extended; the counter r is initially r0(ii) a An expansion mark expansion controls whether path expansion is carried out;
2. for each PTZ path point pi,jMaintenance validation flag ei,j
3. The face information list comprises a plurality of records bound with the face position, and each record comprises:
a. variable RiSaving a certain k value;
b. PTZ coordinate (x)pYp), the face image is a rectangular area, which corresponds to the PTZ coordinates of the center of the rectangle;
c. identity variable idiPossibly a single record, possibly a list of multiple matches;
4. generated scan path: generating each strip path in the strip information list for the next scanning;
5. list of scan results: and maintaining multiple rounds of face scanning results, wherein each round of results comprises the identity of the face detected in the current round of scanning and some additional information and provides the face identity and some additional information to an external system.
Of the above variables, k: record how many rounds of scanning, the value is updated to k +1 after each round of scanning. n: a threshold value, when k is n, performs an expansion. r: and one control variable, which controls the amplitude during expansion, and the value is updated to r +1 after the expansion.
The key to this expansion mechanism is as follows:
1. the expanded scanning path is very large, so the scanning efficiency is low, but the possibility of missing the face is reduced because the range is wider;
2. after multiple scans, the path is likely to completely cover all face positions, so that n is increased along with time, the expansion frequency is reduced, and the overall scanning efficiency is improved;
3. to balance the problems that mechanism 2 may cause: faces away from the face concentration region may not be detected because the scan path converges to the concentration region, and the magnitude of each expansion must be increased. The variable r is set for each increment to control the magnitude of the enlargement.
Therefore, an increase in n increases the efficiency of the scan, and r limits the tradeoff between efficiency and scan omission reduction achieved by this process.
In the present embodiment, the path scanning-adjusting algorithm is described in detail as follows:
firstly, scanning along a path: the PTZ scans along the generated scanning path, and can detect the face in the picture in real time and gradually calculate a face information list. Specifically, the PTZ coordinates (x, y) of the face are calculated, and whether the list has an existing item and the face position (x)pYp) is very close, and if not found, a new item is built on the list. For this item (new or matched):
1. r to be recordediSetting a variable to be a current k value;
2. if it is a new record, the record coordinate (x) is setp,yp) (x, y); for old records, update coordinates (x)i,yi) Is a new value (1- α) (x)p,yp) + α (x, y), α ∈ [0,1, α isA set constant;
3. identifying the face identity in the current picture, writing in idiA variable;
4. all R in the face information listiExtracting k items, and accumulating the id of the items into an identity scanning result of a cost wheel room, wherein if R is in the list, the identity scanning result is stored in a result listiK indicates that the face is detected in the current scanning round;
4. if PTZ reaches the end of the path, the stage ends.
Secondly, updating the path points: the method is divided into two stages according to the execution sequence, and the method specifically comprises the following steps:
1. and (3) reduction: the scanning result of the round is used for reducing the path, and unnecessary points of the path are reduced.
And deleting the faces which have not been detected in a plurality of rounds in the face information list. Specifically, find satisfying (k-R)i) And deleting the face records of more than or equal to t. Generally, t is a set parameter, satisfying 1 < t ≦ n0
Updating each e with face positioni,j: firstly, all ei,jSet to false; for items (x) in the face information listp,yp) Always has a row liNearest to it, two adjacent PTZ path points (x) on it can be determinedi,yj),(xi,yj+1) So that y isj≤yp<yj+1(ii) a I.e. the face position is between two PTZ path points seen laterally; e is to bei,j,ei,j+1Set to true;
in the above process, if one liFrom none of the previous PTZ path points being in effect to at least one of them, or oneiThe more left/right PTZ waypoints of the leftmost/right validation waypoint are set to validate and the expand flag is set to true.
2. And (3) expansion: the range of the current path is expanded to avoid over reduction, and the aim is to calculate an expanded scanning area and convert the scanning area into a scanning path consisting of strip paths. This step is performed in two cases: a. expand is marked true; b. and k is n.
When the expansion is carried out, the method specifically comprises the following steps:
1. calculating a basic region: selecting e in the reduction stagei,jSetting true PTZ path points, and constructing a quadrangle with upper and lower bottoms parallel to the x axis and left and right sides capable of containing all the path points;
2. calculating an expanded area: expanding four edges of the area outwards for a distance respectively, wherein the larger the r value is, the larger the distance is;
3. updating PTZ path points: marking the effective mark e corresponding to all PTZ path points in the expanded areai,jSet to true
4. Decision counter and variable change: different operations are performed in two cases: a. if expand is true, the face is found out of range in the scanning stage, and the r value is reset to r0Resetting the value of n to n0K and all R in the face information listiReset to 0. b. If expand is false, k is n, which means that increasing k triggers expansion through multi-scanning, but no face is found out of the range, and r is increased by 1; the value of n is doubled to be 2 n; k and all R in the face information listiReset to 0.
In practical application, when the state is updated: expand is set to false, the value of k is incremented by 1, and the PTZ path points are combined into the generated scan path as mentioned in this embodiment.
If expand occurs, the path before the explanation may not completely cover the room, the n value is reduced to ensure that the PTZ can be expanded again at a higher frequency, which is beneficial to finding out the missing human face, if expand does not occur for many times, the explanation path is likely to be stable, the r value is increased to reduce the expansion frequency of the PTZ, but the r value is increased to ensure that more comprehensive scanning can be carried out during the next expansion.
In this embodiment, in the scanning phase, expand may be set to true (finding a new face outside the region) because PTZ is centered on a waypoint as it passes through it. The picture "near" the center of the picture actually covers some additional area near the location in the room where the PTZ waypoint corresponds.
In addition, the present embodiment provides a scenario in which 4 path adjustment algorithms operate, and illustrates the actions of the n mechanism and the r mechanism. Wherein n is0=2,r0=1。
Scene 1: the current scanning path can cover all faces in a room, new faces cannot be found out in scanning outside the path and after an expansion stage, and the path is kept stable and unchanged after each round of updating. The following table illustrates the effect of 10 scans, with the variable expand being false all the time in runs 2 and 6 as the k value is incremented to k n. The frequency of expansion scans occurring in these 10 rounds is less and less, but the expansion range increases with increasing r. The advantages of this are: the operation of reducing the scanning efficiency is gradually reduced, and the PTZ performance is improved; each expansion is more sophisticated than the last one, thereby obtaining a compromise between performance and accuracy.
Actual wheel k n r Movement of
1 1 2 1 Not expanded
2 2 2 1 k is n, expanded
3 1 4 2 Not expanded
4 2 4 2 Not expanded
5 3 4 2 Not expanded
6 4 4 2 k is n, expanded
7 1 8 3 Not expanded
8 2 8 3 Not expanded
9 3 8 3 Not expanded
10 4 8 3 Not expanded
Scene 2: the current scan path cannot cover faces in the room, but missing faces are near the scan range, so the "afterglow" of the picture can capture faces in additional positions when the PTZ scans, setting expand to true. The following table illustrates the effect of 7 rounds of scanning, each round of the first 2 rounds of scanning finds a human face outside the scanning area covered by the scanning path, and 2 times of expansion caused by true expand continuously occur; starting from the 3 rd round, PTZ does not find a new face near the scan path coverage area, expand is false, and the stage of expansion triggered by k-n described in scene 1 is entered, at which time the scan path has already become stable. It can be seen that the expansion resulting from expand versus true leaves r and n at their initial values, helping to maintain a higher frequency, less paced expansion. The expanded variable mechanism enables the PTZ to keep a more frequent expansion frequency after a new face is found once, so that a face in a larger area can be quickly found from any small area, and the defect that the initial path is inaccurate is overcome. In expansion caused by expansion, the variable r is unchanged, and the amplitude of outward detection always keeps a small level, so that multiple large-scale expansion is avoided, and the efficiency is improved.
Actual wheel k n r Movement of Condition
1 1 2 1 expand true, expand Finding additional faces
2 1 2 1 expand true, expand Finding additional faces
3 1 2 1 Not expanded No extra faces are found
4 2 2 1 k is n, expanded No extra faces are found
5 1 4 2 Not expanded No extra faces are found
6 2 4 2 Not expanded No extra faces are found
7 3 4 2 Not expanded No extra faces are found
Scene 3: the current scanning path cannot cover the faces in the room, and the missing faces are far away from the scanning range. In this scenario, a schematic view of an extended scanning range of an existing PTZ camera is shown in fig. 2, and a schematic view of an extended scanning range of an improved PTZ camera is shown in fig. 3. By contrast, if the region growing amplitude is kept constant during each expansion, 3 times of expansion is required; whereas if the region growing amplitude increases with increasing r-value, 2 expansions are required. The following table shows the results of the first 8 scanning rounds in the second case, the last missing face is far away from the scanning path of each round, the variable expand is always false, and each expansion is triggered by k ═ n. If adopted, theIn the second strategy, 2+4+ 8-14 scanning rounds are required to find the missing faces in the third expansion. The mechanism of n-k trigger expansion allows PTZ to maintain the ability to find very distant faces in the case of a more stable scan path. Because r is increased every time, the times of detecting the remote faces and needing to be expanded are reduced, and the missing faces can be found more quickly. At the 8 th scan, the r and n values are reset to r since the previous scan triggered expansion by expand and true0And n0. The PTZ returns to a more frequent and small-amplitude expansion state, and is helpful for further discovering other possibly missed faces around the face discovered in the previous round.
Figure BDA0002374372810000121
Figure BDA0002374372810000131
Scene 4: in this scenario, a schematic diagram of an extended scanning range of an existing PTZ camera is shown in fig. 4, and a schematic diagram of an extended scanning range of an improved PTZ camera is shown in fig. 5, where "+" represents a path point and "-" represents a face position. Through the contrast, the current scanning path has a large amount of unmanned spaces, and through once reducing, the scanning path of next time will be simplified a lot to greatly improve scanning efficiency.
As can be seen from the description of the embodiment, the missing of the faces is few when the faces are scanned by PTZ, and it can be ensured that each face acquired is clear enough; and, there is no limitation on the arrangement in the room; moreover, after long-time operation, the PTZ can optimize a route suitable for the current room personnel layout, and waste of wave scanning time can be avoided.

Claims (10)

1. The method for automatically optimizing the scanning path based on the PTZ camera is characterized by comprising the following steps:
step 1, determining an initial scanning path of a PTZ camera in a region to be detected, taking the initial scanning path as a current scanning path, and establishing a face information list;
step 2, the PTZ camera moves along the current scanning path, and a face information list is updated according to face information in a scanning picture;
and 3, updating the current scanning path according to the updated face information list, and returning to the step 2.
2. The method for automatically optimizing the scanning path based on the PTZ camera as claimed in claim 1, wherein in the step 1, the method for determining the initial scanning path of the PTZ camera in the area to be detected is as follows:
using a scanning path prestored in the PTZ camera;
or calculating an initial scanning path of the PTZ camera according to the specific layout of the region to be detected;
or, using PTZ path points prestored in the PTZ camera, and calculating an initial scanning path according to the prestored PTZ path points.
3. The method for automatically optimizing a scanning path based on a PTZ camera as claimed in claim 2, wherein when using PTZ path points pre-stored in the PTZ camera and calculating an initial scanning path according to the pre-stored PTZ path points, specifically:
firstly, determining a series of PTZ path points in the movable range of the PTZ camera, wherein one PTZ path point defines the motor control angles of the PTZ in the horizontal and vertical directions and the picture magnification when aiming at the direction;
then, a loop-free path connecting all PTZ path points is determined as an initial scan path.
4. The method for automatically optimizing a scan path based on a PTZ camera as claimed in claim 3, wherein the generated path is a sequence of selected PTZ path points, and the loop-free path means that the same PTZ path point does not repeatedly appear in the sequence.
5. The method for automatically optimizing a scan path based on a PTZ camera as claimed in claim 3, wherein the method for determining PTZ path points is as follows:
respectively selecting a series of values at equal intervals in the movable angle range of the motors in the two PTZ directions, taking the values as the control angles of the PTZ motors in the horizontal and vertical directions, and setting the magnification as a preset value, thereby determining each PTZ path point;
or, defining a prefabricated area layout to be detected and a deployment position of the PTZ camera, determining a PTZ path point at the position where each face possibly exists in the area to be detected, wherein the position where the face possibly exists in the area to be detected is determined by prefabricated parameters, calculating the direction angles of two motors when the PTZ camera aligns to the face position and the relative distance between the two motors according to the relative relationship of the two positions, and determining the image magnification times of the PTZ when the face position has a face with a preset size according to the relative distance.
6. The method for automatically optimizing the scanning path based on the PTZ camera as claimed in claim 1 or 3, wherein the specific operation of updating the face information list according to the face picture in the scanning picture in the step 2 comprises:
the PTZ camera moves along the current scanning path within a specified time period, the face detection is carried out on the video stream frame by frame, the PTZ coordinate of the detected face is calculated, and the face identity is recognized, wherein the PTZ coordinate refers to the following steps: the horizontal motor angle and the vertical motor angle form a PTZ coordinate;
judging whether the PTZ coordinates of the face appear in the face information list or not according to the PTZ coordinates of the face, if so, determining that the PTZ coordinates are within a certain distance from the coordinates recorded in a certain item in the face information list, if so, updating the face information list by using the face information in the frame, and if not, establishing a new item for the face information list and writing the face information into the face information list.
7. The method for automatically optimizing a scan path based on a PTZ camera as claimed in claim 6, wherein in step 2, updating the face information list according to the face information in the PTZ video stream further comprises:
and after the scanning is finished, aging the items of the face information list, wherein the process specifically comprises the following steps: the PTZ camera scans one round from one end to the other end along the current scanning path completely, when any list item is updated to the face information list, the current round count is written into the list item when any list item is modified, after one round of scanning is finished and before the next round of scanning is started, the PTZ camera compares the round count of each item in the face information list with the current round count, if the round count of the face information list item is smaller than the current round count, the situation that a face is not detected at the position in a plurality of nearest rounds is shown, and if the difference value of the round count and the next round count is larger than a preset threshold value, the item is deleted from the face information list.
8. The method for automatically optimizing a scanning path based on a PTZ camera as claimed in claim 1, 6 or 7, wherein the step 3 of updating the current scanning path according to the updated face information list specifically comprises:
step 301, setting all PTZ path points to be not effective;
step 302, traversing a face information list, determining a row of PTZ path points closest to the PTZ coordinates of any face record, determining a pair of PTZ path points closest to the record on the row, and setting the two points as effective points;
step 303, traversing each row of the PTZ path, and marking all path points between the minimum x value and the maximum x value in the PTZ path points belonging to the row as effective, so as to generate a continuous PTZ path point distribution area in the PTZ path points in the row;
and step 304, selecting the effective parts in each row of PTZ path points, connecting the minimum x value to the maximum x value in the same row, alternately connecting the minimum x and maximum x path points in each row to form a loop-free path, starting from any end point of the loop-free path to another end point to form an access sequence of PTZ path points, and taking the sequence as the current scanning path.
9. The method for automatically optimizing a scanning path based on a PTZ camera as claimed in claim 8, wherein in step 3, the process of updating the current scanning path according to the updated face information list further comprises:
setting an expansion process of a counter and a path, wherein in the path expansion process, a PTZ camera calculates a PTZ coordinate area covered by the current scanning path and calculates a larger range on the basis, then PTZ selects PTZ path points in the area to be set to be effective, a loop-free path connecting all effective PTZ path points is generated to be used as the current scanning path, the counter is increased progressively every time the expansion process is carried out, and the larger the value of the counter in each expansion process is, the larger the increase amplitude of the expansion area generated on the basis of the PTZ coordinate area of the original path is.
10. The method for automatically optimizing a scanning path based on a PTZ camera as claimed in claim 9, wherein in step 3, the expansion process of updating the current scanning path according to the updated face information list occurs in two cases:
condition 1: giving a threshold value, deciding to perform one expansion when the scanning wheel count reaches the threshold value, and expanding the threshold value in a double mode after the expansion so as to reduce the occurrence frequency of the expansion process;
condition 2: comparing the current scanning path generated in the PTZ path updating process with the scanning path of the previous round, and if any one row of PTZ path points is changed from the original whole non-effective state to any one path point effective state, or the x value of the minimum x or the maximum x point of the row of PTZ path points is smaller or larger than the x value of the previous row of PTZ path points, determining to perform one expansion;
otherwise the expansion process is skipped to the next scan round.
CN202010060747.1A 2020-01-19 2020-01-19 Method for automatically optimizing scanning path based on PTZ camera Active CN111212233B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010060747.1A CN111212233B (en) 2020-01-19 2020-01-19 Method for automatically optimizing scanning path based on PTZ camera

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010060747.1A CN111212233B (en) 2020-01-19 2020-01-19 Method for automatically optimizing scanning path based on PTZ camera

Publications (2)

Publication Number Publication Date
CN111212233A true CN111212233A (en) 2020-05-29
CN111212233B CN111212233B (en) 2021-08-31

Family

ID=70787595

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010060747.1A Active CN111212233B (en) 2020-01-19 2020-01-19 Method for automatically optimizing scanning path based on PTZ camera

Country Status (1)

Country Link
CN (1) CN111212233B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050280707A1 (en) * 2004-02-19 2005-12-22 Sezai Sablak Image stabilization system and method for a video camera
US20060203098A1 (en) * 2004-02-19 2006-09-14 Henninger Paul E Iii Method and apparatus for producing frame accurate position data in a PTZ dome camera with open loop control
CN101819687A (en) * 2010-04-16 2010-09-01 阜新力兴科技有限责任公司 Face recognition student attendance device and method
CN104639908A (en) * 2015-02-05 2015-05-20 华中科技大学 Control method of monitoring ball machine
US20160132722A1 (en) * 2014-05-08 2016-05-12 Santa Clara University Self-Configuring and Self-Adjusting Distributed Surveillance System
CN109034030A (en) * 2018-07-17 2018-12-18 深圳市巨龙创视科技有限公司 One kind being based on embedded multi-trace recognition of face statistic algorithm
CN110460778A (en) * 2019-08-26 2019-11-15 广州视源电子科技股份有限公司 A kind of cruise method of camera, device, computer equipment and storage medium
CN110599129A (en) * 2019-09-16 2019-12-20 世纪海航(厦门)科技有限公司 Campus attendance checking method, device, identification terminal and system based on image tracking

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050280707A1 (en) * 2004-02-19 2005-12-22 Sezai Sablak Image stabilization system and method for a video camera
US20060203098A1 (en) * 2004-02-19 2006-09-14 Henninger Paul E Iii Method and apparatus for producing frame accurate position data in a PTZ dome camera with open loop control
CN101819687A (en) * 2010-04-16 2010-09-01 阜新力兴科技有限责任公司 Face recognition student attendance device and method
US20160132722A1 (en) * 2014-05-08 2016-05-12 Santa Clara University Self-Configuring and Self-Adjusting Distributed Surveillance System
CN104639908A (en) * 2015-02-05 2015-05-20 华中科技大学 Control method of monitoring ball machine
CN109034030A (en) * 2018-07-17 2018-12-18 深圳市巨龙创视科技有限公司 One kind being based on embedded multi-trace recognition of face statistic algorithm
CN110460778A (en) * 2019-08-26 2019-11-15 广州视源电子科技股份有限公司 A kind of cruise method of camera, device, computer equipment and storage medium
CN110599129A (en) * 2019-09-16 2019-12-20 世纪海航(厦门)科技有限公司 Campus attendance checking method, device, identification terminal and system based on image tracking

Also Published As

Publication number Publication date
CN111212233B (en) 2021-08-31

Similar Documents

Publication Publication Date Title
CN1298601A (en) Automatic determining preset position corresponding to television conference attendance
US9961438B2 (en) Directivity control apparatus, directivity control method, storage medium and directivity control system
US20090033745A1 (en) Method and apparatus for video frame sequence-based object tracking
US8355046B2 (en) Object tracing device, object tracing system, and object tracing method
US7860276B2 (en) Image processing device and method
EP1472870A1 (en) Method and apparatus for video frame sequence-based object tracking
CN104639908A (en) Control method of monitoring ball machine
CN110443175A (en) Clean robot control system and control method based on separate type vision-based detection
JP2012151848A (en) System and method for switching scene state based on dynamic detection of region of interest
CN105721767B (en) The method for handling video flowing
CN110572570B (en) Intelligent recognition shooting method and system for multi-person scene and storage medium
US10122984B2 (en) Pan/tilt/zoom camera based video playing method and apparatus
CN111026115A (en) Robot obstacle avoidance control method and device based on deep learning
CN111212233B (en) Method for automatically optimizing scanning path based on PTZ camera
CN113747121B (en) Method and system for automatically establishing cruising track, electronic equipment and medium
US20190244047A1 (en) Video processing using topological map
CN104539893B (en) Realize the method, apparatus and system of virtual head monitoring effect
JP6715217B2 (en) Video processing device, video processing method, and video processing program
JP2017049686A (en) Image processing device
JP2012004630A (en) Monitor system
JP2005309740A (en) Method and program for tracking moving body, recording medium therefor, and moving body tracking apparatus
CN114302226A (en) Intelligent cutting method for video picture
CN111259825B (en) PTZ scanning path generation method based on face recognition
CN115150600B (en) Method and device for determining display area of projection picture and projector
CN113689466B (en) Feature point-based plane tracking method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A method of automatically optimizing scanning path based on PTZ camera

Effective date of registration: 20220811

Granted publication date: 20210831

Pledgee: Bank of Chengdu science and technology branch of Limited by Share Ltd.

Pledgor: CHENGDU YINENG SCI&TECH Co.,Ltd.

Registration number: Y2022510000241

PE01 Entry into force of the registration of the contract for pledge of patent right