CN110610150B - Tracking method, device, computing equipment and medium of target moving object - Google Patents
Tracking method, device, computing equipment and medium of target moving object Download PDFInfo
- Publication number
- CN110610150B CN110610150B CN201910837354.4A CN201910837354A CN110610150B CN 110610150 B CN110610150 B CN 110610150B CN 201910837354 A CN201910837354 A CN 201910837354A CN 110610150 B CN110610150 B CN 110610150B
- Authority
- CN
- China
- Prior art keywords
- video frame
- moving object
- current video
- motion
- candidate
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/40—Scenes; Scene-specific elements in video content
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/40—Scenes; Scene-specific elements in video content
- G06V20/41—Higher-level, semantic clustering, classification or understanding of video scenes, e.g. detection, labelling or Markovian modelling of sport events or news items
- G06V20/42—Higher-level, semantic clustering, classification or understanding of video scenes, e.g. detection, labelling or Markovian modelling of sport events or news items of sport video content
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/40—Scenes; Scene-specific elements in video content
- G06V20/48—Matching video sequences
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/40—Scenes; Scene-specific elements in video content
- G06V20/44—Event detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V2201/00—Indexing scheme relating to image or video recognition or understanding
- G06V2201/07—Target detection
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Image Analysis (AREA)
- Studio Devices (AREA)
Abstract
The invention discloses a method, a device, a computing device and a medium for tracking a target moving object, wherein the method comprises the following steps: acquiring a video frame acquired by a camera in real time, and detecting alternative motion pixel points in the current video frame by using an inter-frame image difference algorithm; acquiring a shooting scene corresponding to the current video frame, selecting an identification strategy matched with the shooting scene, and identifying at least one target moving object included in the current video frame according to the candidate motion pixel points; and controlling the tracking direction of the camera according to the deviation direction of the center of gravity of the at least one target moving object relative to the center of the current video frame. The technical scheme of the embodiment effectively identifies the target moving object in the video image, reduces the operation amount of the detection algorithm, and realizes accurate and rapid tracking of the target moving object.
Description
Technical Field
The embodiment of the invention relates to the field of digital image processing, in particular to a method, a device, a computing device and a medium for tracking a target moving object.
Background
The visual analysis of motion is a leading edge direction which is of great interest in the field of computer vision in recent years, and the tracking of target moving objects is applied to the fields of robot navigation, intelligent visual monitoring systems, industrial detection, video image analysis, video image compression and the like.
In recent decades, scholars at home and abroad propose a plurality of methods for detecting and tracking a moving target in a video image, and the common methods include a background difference method, an image difference method, a characteristic-based method, an optical flow field-based method and the like. Under the condition that the camera moves, a background difference method does not have a stable background, and the moving target detection performance is poor; in the case of camera motion, the image difference method can only detect the edges of all objects in an image sequence and cannot distinguish moving and static targets; the characteristic-based method is difficult to distinguish characteristic points among different targets, and a relatively universal algorithm for quickly matching the characteristic points does not exist; the method based on the optical flow field has quite complex calculation process, huge calculation amount and is easy to be interfered by noise.
The existing methods generally assume that a camera for acquiring a video image is static, and for the situation of camera motion, due to different environmental characteristics, a universal detection method is difficult to obtain, and the tracking method of a target moving object proposed by the video images under different backgrounds is not perfect.
Disclosure of Invention
The embodiment of the invention provides a method, a device, a computing device and a medium for tracking a target moving object, which are used for reducing the operation amount of moving object detection and improving the tracking efficiency of the moving object.
In a first aspect, an embodiment of the present invention provides a method for tracking a target moving object, where the method includes:
acquiring a video frame acquired by a camera in real time, and detecting alternative motion pixel points in the current video frame by using an interframe image difference algorithm;
acquiring a shooting scene corresponding to the current video frame, selecting an identification strategy matched with the shooting scene, and identifying at least one target moving object included in the current video frame according to the alternative motion pixel points;
and controlling the tracking direction of the camera according to the deviation direction of the gravity center of the at least one target moving object relative to the center of the current video frame.
In a second aspect, an embodiment of the present invention further provides a device for tracking a target moving object, where the device includes:
the candidate motion pixel point detection module is used for acquiring a video frame acquired by a camera in real time and detecting a candidate motion pixel point in the current video frame by utilizing an interframe image difference algorithm;
the target moving object identification module is used for acquiring a shooting scene corresponding to the current video frame, selecting an identification strategy matched with the shooting scene, and identifying at least one target moving object included in the current video frame according to the alternative motion pixel points;
and the tracking direction control module of the camera is used for controlling the tracking direction of the camera according to the deviation direction of the gravity center of the at least one target moving object relative to the center of the current video frame.
In a third aspect, an embodiment of the present invention further provides a computing device, where the computing device includes:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the method for tracking a target moving object provided by any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the storage medium, and when the computer program is executed by a processor, the computer program implements the tracking method for the target moving object provided in any embodiment of the present invention.
The method comprises the steps of firstly obtaining a video frame collected by a camera in real time, detecting candidate motion pixel points in the current video frame by utilizing an interframe image difference algorithm, then obtaining a shooting scene corresponding to the current video frame, selecting an identification strategy matched with the shooting scene, identifying at least one target moving object included in the current video frame according to the candidate motion pixel points, and finally controlling the tracking direction of the camera according to the deviation direction of the gravity center of the at least one target moving object relative to the center of the current video frame. The embodiment of the invention reduces the operation amount of the detection of the moving object, has the advantages of rapidness, accuracy and conciseness in the aspect of tracking the target moving object, and has great practical significance and application value.
Drawings
FIG. 1 is a flowchart of a method for tracking a target moving object according to a first embodiment of the present invention;
FIG. 2 is a flowchart of a tracking method of a target moving object according to a second embodiment of the present invention;
fig. 3 is a flowchart of an embodiment of a method for tracking a target moving object according to a third embodiment of the present invention;
fig. 4 is a structural diagram of a tracking apparatus of a target moving object in a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computing device in the fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a tracking method of a target moving object according to an embodiment of the present invention, which is applicable to a situation of video image analysis, and the method may be executed by a tracking apparatus of a target moving object, and the apparatus may be implemented by software and/or hardware, and may be generally integrated in a moving object tracking device configured with a camera, or integrated in a server, and the server is used in cooperation with a camera for collecting video frames, and specifically includes the following steps:
optionally, the video frame acquired by the camera in real time may be acquired by internal bus transmission, or the video frame acquired by the camera configured at the far end in real time may be acquired by wireless or wired transmission.
In this embodiment, the candidate moving pixel points refer to pixel points included in a moving object that needs to be processed and analyzed and is detected in the current video frame. The interframe image difference algorithm firstly acquires a previous video frame and a next video frame corresponding to a current video frame, then calculates the difference between the gray value of each pixel point in the current video frame and the gray value of the pixel point at the corresponding position in the previous video frame or the next video frame, and finally identifies the candidate motion pixel point in the current video frame.
And 120, acquiring a shooting scene corresponding to the current video frame, selecting an identification strategy matched with the shooting scene, and identifying at least one target moving object included in the current video frame according to the alternative motion pixel points.
In this step, the shooting scene corresponding to the current video frame is divided into two types, the first type is object motion and the lens is still, and the second type is object motion and the lens is rotated. The target moving object refers to a moving object which has accurate position parameters and needs to be processed and analyzed.
And step 130, controlling the tracking direction of the camera according to the deviation direction of the center of gravity of the at least one target moving object relative to the center of the current video frame.
In this step, if the centers of gravity of most of the moving objects are located at the left side of the current video frame, the tracking direction of the camera is controlled to deflect to the left side, and if the centers of gravity of most of the moving objects are located at the right side of the current video frame, the tracking direction of the camera is controlled to deflect to the right side, so that the most of the moving objects are always located in the central area of the image. If the gravity center of most moving objects is in the central area of the current video frame, the camera does not need to perform tracking action.
The technical scheme of the embodiment of the invention comprises the steps of firstly obtaining a video frame collected by a camera in real time, and detecting alternative motion pixel points in the current video frame by utilizing an inter-frame image difference algorithm; then acquiring a shooting scene corresponding to the current video frame, selecting an identification strategy matched with the shooting scene, and identifying at least one target moving object included in the current video frame according to the candidate motion pixel points; and finally, controlling the tracking direction of the camera according to the deviation direction of the gravity center of the at least one target moving object relative to the center of the current video frame. The technical scheme of the embodiment effectively identifies the target moving object in the video image, reduces the operation amount of the detection algorithm, and realizes accurate and rapid tracking of the target moving object.
Example two
The present embodiment is refined based on the above embodiments, and provides an implementation manner for performing noise reduction processing on a video frame before detecting a candidate motion pixel in a current video frame by using an inter-frame image difference algorithm. The same or corresponding terms as those of the above-described embodiments are explained, and the description of the present embodiment is omitted.
Fig. 2 is a flowchart of a tracking method for a target moving object according to a second embodiment of the present invention, and as shown in fig. 2, the method includes the following steps:
and step 210, acquiring a video frame acquired by a camera in real time, and performing noise reduction processing on the video frame.
In this step, the embodiment of the present invention performs noise reduction processing on the video frame by using a median filtering algorithm, where the processing procedure is as follows: firstly, selecting a preset window and carrying out raster scanning along the video frame by using the window; then reading the pixel values of corresponding positions under the window, and sequencing the pixel values in the window after moving the window every time; finally, the middle one of the pixel values is found, and the obtained median value is used for replacing the original pixel value at the center of the window.
In this step, in the embodiment of the present invention, a previous video frame and a next video frame corresponding to a current video frame are first obtained, and then the candidate motion pixel point is detected in the current video frame according to a difference between a gray value of each pixel point in the current video frame and a gray value of a pixel point at a corresponding position in the previous video frame or the next video frame.
Firstly, judging whether the absolute value of the difference between the gray values of the pixel points at the corresponding positions of the current video frame and the previous video frame is greater than or equal to a preset threshold, if so, setting the first gray value of each pixel point of the current video frame to be 255, and otherwise, setting the first gray value of each pixel point of the current video frame to be 0; then judging whether the absolute value of the difference between the gray values of the pixel points at the corresponding positions of the current video frame and the next video frame is greater than or equal to a preset threshold value, if so, setting a second gray value of each pixel point of the current video frame to be 255, otherwise, setting the second gray value of each pixel point of the current video frame to be 0; and finally, setting the gray value of each pixel point in the current video frame as the sum operation result of the first gray value and the second gray value to obtain a binary image corresponding to the current video frame, and acquiring each pixel point with the gray value of 255 in the binary image to serve as the candidate motion pixel point.
Specifically, the first gray value is a gray value of a pixel point at a position corresponding to a binary difference image between a current video frame and a previous video frame, and the second gray value is a gray value of a pixel point at a position corresponding to a binary difference image between the current video frame and a next video frame.
Preferably, the preset threshold in this step is set to 15.
And step 230, acquiring a shooting scene corresponding to the current video frame.
The shooting scenes corresponding to the current video frames are divided into two types, the first type is object motion and the lens is static, and the second type is object motion and the lens rotates.
The embodiment of the invention firstly divides the current video frame into a plurality of primary blocks by taking a first preset pixel point as a unit, wherein the first preset pixel point is preferably 320 × 320; then, dividing each primary block into a plurality of secondary blocks by taking a second preset pixel point as a unit, preferably selecting the second preset pixel point as 80 x 80, calculating the number of the alternative motion pixel points in each secondary block, and calculating the ratio of the number of the secondary blocks with the number of the alternative motion pixel points smaller than a preset value to the total number of the secondary blocks, wherein the preset value is preferably 5; and finally, judging whether the ratio is greater than or equal to a preset threshold value, wherein the preset threshold value is set to be 0.73, if so, determining that the shooting scene is an object motion scene and a lens is static, otherwise, determining that the shooting scene is an object motion scene and a lens rotation scene.
And 240, selecting an identification strategy matched with the shooting scene, and identifying at least one target moving object included in the current video frame according to the candidate motion pixel points.
If the shooting scene is a first kind of scene, namely an object moves and a lens is static, the embodiment of the invention firstly calculates the number of alternative motion pixel points included in each primary block, and determines the primary block of which the number of the alternative motion pixel points is greater than or equal to a preset threshold value as a moving object candidate block, wherein the preset threshold value is preferably 56; then, dividing each secondary block into a plurality of tertiary blocks by taking a third preset pixel point as a unit, wherein the third preset pixel point is preferably 40 × 40, constructing a search region matched with the image of the moving object candidate block according to the image position of each moving object candidate block, and determining the moving object candidate block corresponding to the search region as an independent candidate moving object if each tertiary block in the search region does not comprise any alternative moving pixel point; and finally, calculating the gravity center, the width and the height of each candidate moving object, calculating the motion severity of the candidate moving object according to the number, the width and the height of the candidate moving pixels of the candidate moving object, and judging the candidate moving object as a target moving object according to the motion severity.
If the shooting scene is a second kind of scene, namely, the object moves and the lens rotates, the embodiment of the invention firstly takes the gray value of the pixel point at the position of the target moving object in the previous video frame as a reference value, and determines the search range according to the position of the target moving object in the previous video frame, wherein the search radius is preferably 9 pixel points; then, motion estimation is carried out according to the reference value and the gray value of the pixel point of the current video frame in the searching range, and a plurality of matching points are obtained; and finally, determining the gravity center, the width and the height of a target moving object of the current video frame according to the matching points, and determining the target moving object in the current video frame according to the gravity center, the width and the height of the target moving object.
And step 250, controlling the tracking direction of the camera according to the deviation direction of the gravity center of the at least one target moving object relative to the center of the current video frame.
In this step, the tracking direction of the camera depends on the direction of the center of gravity deviation of most of the target moving objects. And if the gravity centers of most of the moving objects are positioned at the left side of the current video frame, controlling the tracking direction of the camera to deflect to the left side, and if the gravity centers of most of the moving objects are positioned at the right side of the current video frame, controlling the tracking direction of the camera to deflect to the right side, so that the most of the moving objects are always positioned in the central area of the image. If the gravity center of most moving objects is in the central area of the current video frame, the camera does not need to perform tracking action.
According to the technical scheme of the embodiment, firstly, a video frame acquired by a camera in real time is acquired, and noise reduction processing is performed on the video frame, so that interference pixel points caused by noise in the video frame are eliminated; then detecting alternative motion pixel points in the current video frame by utilizing an interframe image difference algorithm to provide conditions for determining a target moving object at the back; then, acquiring a shooting scene corresponding to the current video frame, selecting an identification strategy matched with the shooting scene, and identifying at least one target moving object included in the current video frame according to the alternative motion pixel points; and finally, controlling the tracking direction of the camera according to the deviation direction of the center of gravity of the at least one target moving object relative to the center of the current video frame. According to the technical scheme, the target moving object in the video image is accurately identified, the problem of high complexity of a detection algorithm is solved, and the target moving object is effectively tracked in real time.
On the basis of the above technical solution, in step 230, in the embodiment of the present invention, the current video frame is first divided into a plurality of first-level blocks by taking 320 × 320 pixels as a unit; then, dividing each primary block into a plurality of secondary blocks by taking 80-by-80 pixels as a unit, calculating the number of candidate motion pixels in each secondary block, and calculating the ratio of the number of the secondary blocks with the number of the candidate motion pixels smaller than 5 to the total number of the secondary blocks; and finally, judging whether the ratio is greater than or equal to 0.73, if so, determining that the shooting scene is an object motion scene and a lens is static, otherwise, determining that the shooting scene is an object motion scene and a lens rotation scene.
In step 240, if the shooting scene is a first-class scene, i.e. the object moves and the lens is still, in the embodiment of the present invention, the number of candidate motion pixel points included in each primary block is first calculated, and the primary block in which the number of the candidate motion pixel points is greater than or equal to 56 is determined as a candidate block of the moving object; and then, dividing each secondary block into a plurality of tertiary blocks by taking 40-by-40 pixel points as a unit, wherein the moving object candidate block is an independent candidate moving object as long as no candidate moving pixel point exists in each tertiary block of a circle around the moving object candidate block. The barycentric coordinates of the candidate moving object can be calculated by superposing and averaging the coordinates of each candidate moving pixel point in the candidate moving object, so that the width and the height of the candidate moving object are calculated, and the motion severity corresponding to the candidate moving object is calculated according to the number, the width and the height of the candidate moving pixel points of the candidate moving object. And if the intensity of the strenuous exercise is greater than or equal to 1.75, the candidate moving object is the target moving object.
If the shooting scene is a second kind of scene, namely, object motion and lens rotation, the embodiment of the invention firstly takes the gray value of the pixel point at the position of the target motion object in the previous video frame as a reference value, then carries out motion estimation in the current video frame, the gravity center of the target motion object in the previous video frame is taken as an original point, 9 pixel points are taken as radiuses to determine a search range, the point with the motion estimation value less than or equal to 3 in the search range is taken as an optimal matching point, the gravity center, the width and the height of the target motion object in the current video frame are determined according to the matching point, and the target motion object is determined in the current video frame according to the gravity center, the width and the height of the target motion object.
EXAMPLE III
Fig. 3 is a flowchart of a specific implementation of a method for tracking a target moving object according to a third embodiment of the present invention, and this embodiment provides a specific implementation step of the method for tracking a target moving object on the basis of the foregoing embodiments. As shown in fig. 3, the method comprises the steps of:
and 310, acquiring a video frame acquired by the camera in real time, and performing noise reduction processing on the video frame.
In this step, the embodiment of the present invention performs noise reduction processing on the video frame by using a median filtering algorithm, where the processing procedure is as follows: firstly, selecting a preset window and carrying out raster scanning along the video frame by using the window; then reading the pixel values of corresponding positions under the window, and sequencing the pixel values in the window after moving the window every time; finally, the middle one of the pixel values is found, and the obtained median value is used for replacing the original pixel value at the center of the window.
And step 320, detecting the candidate motion pixel points.
In this step, the embodiment of the present invention detects the candidate motion pixel in the current video frame by using an inter-frame image difference algorithm. Firstly, judging whether the absolute value of the difference between the gray values of the pixel points at the corresponding positions of the current video frame and the previous video frame is greater than or equal to a preset threshold, if so, setting the first gray value of each pixel point of the current video frame to be 255, and otherwise, setting the first gray value of each pixel point of the current video frame to be 0; then judging whether the absolute value of the difference between the gray values of the pixel points at the corresponding positions of the current video frame and the next video frame is greater than or equal to a preset threshold value, if so, setting a second gray value of each pixel point of the current video frame to be 255, otherwise, setting the second gray value of each pixel point of the current video frame to be 0; and finally, setting the gray value of each pixel point in the current video frame as the sum operation result of the first gray value and the second gray value to obtain a binary image corresponding to the current video frame, and acquiring each pixel point with the gray value of 255 in the binary image to serve as the candidate motion pixel point.
Specifically, the first gray value is a gray value of a pixel point at a position corresponding to a binary difference image between a current video frame and a previous video frame, and the second gray value is a gray value of a pixel point at a position corresponding to a binary difference image between the current video frame and a next video frame.
Preferably, the preset threshold value in this step is set to 15.
According to the embodiment of the invention, the binary image corresponding to the current video frame is obtained through the steps, and each pixel point with the gray value of 255 in the binary image is obtained and used as the candidate motion pixel point. And if the candidate motion pixel points exist in the current video frame, acquiring a shooting scene corresponding to the current video frame, otherwise, continuously acquiring the video frame.
And step 340, acquiring a shooting scene corresponding to the current video frame.
In this step, the embodiment of the present invention first divides the current video frame into a plurality of first-level blocks by taking 320 × 320 pixels as a unit; then, dividing each primary block into a plurality of secondary blocks by taking 80-by-80 pixel points as a unit, calculating the number of alternative motion pixel points included in each secondary block, and calculating the ratio of the number of the secondary blocks with the number of the alternative motion pixel points smaller than 5 to the total number of the secondary blocks; and finally, judging whether the ratio is greater than or equal to 0.73, if so, determining that the shooting scene is an object motion scene and a lens is static, otherwise, determining that the shooting scene is an object motion scene and a lens rotation scene.
And 350, judging the type of the shooting scene, dividing the shooting scene into two scenes, namely a scene with a static object and a static lens and a scene with a rotating object, and selecting a matched processing strategy according to different shooting scenes.
And step 360, adopting a processing mode of dividing the current video frame for the shooting scene with the moving object and the static lens.
The embodiment of the invention firstly calculates the number of candidate motion pixel points included in each primary block, and determines the primary block with the number of the candidate motion pixel points being more than or equal to 56 as a motion object candidate block; and then dividing each secondary block into a plurality of tertiary blocks by taking 40-by-40 pixel points as a unit, constructing a search region matched with the image of the moving object candidate block according to the image position of each moving object candidate block, and if each tertiary block in the search region does not comprise any alternative moving pixel point, determining the moving object candidate block corresponding to the search region as an independent candidate moving object.
Firstly, taking the gray value of a pixel point at the position of a target moving object in the previous video frame as a reference value, and determining a search range according to the position of the target moving object in the previous video frame; and then, carrying out motion estimation according to the reference value and the gray value of the pixel point of the current video frame in the search range to obtain a plurality of matching points.
And 380, identifying the target moving object and calculating the position parameter of the target moving object.
If the shooting scene is a first kind of scene, namely the object moves and the lens is static, independent candidate moving objects are determined through the steps, the gravity center, the width and the height of each candidate moving object are calculated, the motion severity of the candidate moving objects is calculated according to the number, the width and the height of candidate moving pixels of the candidate moving objects, and the candidate moving objects are judged to be target moving objects according to the motion severity.
If the shooting scene is a first kind of scene, namely the object moves and the lens rotates, the matching points corresponding to the current video frame are obtained through the steps, the gravity center, the width and the height of the target moving object of the current video frame are determined according to the matching points, and the target moving object is determined in the current video frame according to the gravity center, the width and the height of the target moving object.
And step 390, controlling the tracking direction of the camera.
In this step, the tracking direction of the camera depends on the direction of the center of gravity deviation of most of the target moving objects. And if the gravity centers of most of the moving objects are positioned at the left side of the current video frame, controlling the tracking direction of the camera to deflect to the left side, and if the gravity centers of most of the moving objects are positioned at the right side of the current video frame, controlling the tracking direction of the camera to deflect to the right side, so that the most of the moving objects are always positioned in the central area of the image. If the gravity center of most moving objects is in the central area of the current video frame, the camera does not need to perform tracking action.
The technical scheme of the embodiment of the invention comprises the steps of firstly obtaining a video frame acquired by a camera in real time, carrying out noise reduction processing on the video frame, detecting alternative moving pixel points and providing conditions for determining a target moving object behind; then judging whether the alternative motion pixel points exist in the current video frame or not, and acquiring a shooting scene corresponding to the current video frame, so as to classify the current video frame, select matched processing strategies according to different shooting scenes, effectively identify a target moving object and calculate a position parameter of the target moving object; and finally, controlling the tracking direction of the camera according to the position of the target moving object. The technical scheme of the embodiment accurately and comprehensively identifies the target moving object in the video image, solves the problem of huge calculation amount of the detection algorithm, and meets the requirement of real-time tracking of the target moving object in the field of image processing.
Example four
Fig. 4 is a structural diagram of a tracking apparatus of a target moving object according to a fourth embodiment of the present invention, where the apparatus includes: a candidate moving pixel point detection module 410, a target moving object recognition module 420, and a tracking direction control module 430 of the camera.
The candidate motion pixel point detection module 410 is configured to acquire a video frame acquired by a camera in real time, and detect a candidate motion pixel point in the current video frame by using an inter-frame image difference algorithm; a target moving object identification module 420, configured to acquire a shooting scene corresponding to the current video frame, select an identification policy matched with the shooting scene, and identify at least one target moving object included in the current video frame according to the candidate motion pixel point; and a tracking direction control module 430 of the camera, configured to control a tracking direction of the camera according to a deviation direction of a center of gravity of the at least one target moving object with respect to the center of the current video frame.
According to the technical scheme, firstly, a candidate motion pixel point detection module detects candidate motion pixel points in the current video frame to provide conditions for determining a target moving object later, then a target moving object identification module is used for effectively identifying the target moving object under different shooting scenes, and finally a tracking direction control module of a camera is used for controlling the tracking direction of the camera. The technical scheme of the embodiment accurately and comprehensively identifies the target moving object in the video image, reduces the operation amount of the detection algorithm, and realizes accurate and rapid tracking of the target moving object.
On the basis of the foregoing embodiments, the alternative moving pixel point detecting module 410 may further include: and the video frame denoising module is used for acquiring the video frames acquired by the camera in real time and denoising the video frames.
The alternative motion pixel point detection module 410 may include:
a video frame acquisition module, configured to acquire a previous video frame and a next video frame corresponding to the current video frame;
and the candidate motion pixel point determining module is used for detecting the candidate motion pixel point in the current video frame according to the difference between the gray value of each pixel point in the current video frame and the gray value of the pixel point at the corresponding position in the previous video frame or the next video frame.
The candidate motion pixel point determining module may include:
a first gray value setting module, configured to determine whether an absolute value of a difference between gray values of pixel points at respective corresponding positions of the current video frame and the previous video frame is greater than or equal to a preset threshold, if yes, set a first gray value of each pixel point of the current video frame to 255, and otherwise set a first gray value of each pixel point of the current video frame to 0;
a second gray value setting module, configured to determine whether an absolute value of a difference between gray values of pixels at corresponding positions of the current video frame and the next video frame is greater than or equal to a preset threshold, if yes, set a second gray value of each pixel of the current video frame to 255, and otherwise set the second gray value of each pixel of the current video frame to 0;
a current video frame gray level setting module, configured to set a gray level value of each pixel in the current video frame as an and operation result of the first gray level value and the second gray level value, so as to obtain a binary image corresponding to the current video frame;
and obtaining each pixel point with the gray value of 255 in the binary image as the candidate motion pixel point.
The target moving object identification module 420 may include:
a shooting scene obtaining module, configured to obtain a shooting scene corresponding to the current video frame;
and the target moving object determining module is used for selecting an identification strategy matched with the shooting scene and identifying at least one target moving object in the current video frame according to the alternative motion pixel points.
The photographing scene acquiring module may include:
the primary block dividing module is used for dividing the current video frame into a plurality of primary blocks by taking a first preset pixel point as a unit;
the secondary block dividing module is used for dividing each primary block into a plurality of secondary blocks by taking a second preset pixel point as a unit;
and the shot scene determining module is used for calculating the number of the alternative motion pixel points in each secondary block, calculating the ratio of the number of the secondary blocks with the number of the alternative motion pixel points smaller than a preset value to the total number of the secondary blocks, judging whether the ratio is larger than or equal to a preset threshold value, if so, determining that the shot scene is a scene with object motion and a static lens, and otherwise, determining that the shot scene is a scene with object motion and a rotating lens.
The target moving object determination module may include:
the moving object candidate block determining module is applied to a scene with moving objects and static lens, and is used for calculating the number of candidate moving pixel points in each primary block and determining the primary block with the number of the candidate moving pixel points being more than or equal to a preset threshold value as a moving object candidate block;
the three-level block dividing module is applied to a scene with moving objects and static lens and used for dividing each two-level block into a plurality of three-level blocks by taking a third preset pixel point as a unit;
the searching region constructing module is applied to a scene with a moving object and a static lens and is used for constructing a searching region matched with the images of the moving object candidate blocks according to the image positions of the moving object candidate blocks;
the candidate moving object determining module is applied to a scene with a moving object and a static lens, and if each three-level block in the search area does not comprise any candidate moving pixel point, the module is used for determining a moving object candidate block corresponding to the search area as an independent candidate moving object;
the motion intensity calculation module is applied to a scene with an object moving and a still lens, and is used for calculating the gravity center, the width and the height of each candidate moving object, calculating the motion intensity of the candidate moving objects according to the number, the width and the height of candidate motion pixels of the candidate moving objects, and judging the candidate moving objects as target moving objects according to the motion intensity;
the searching range determining module is applied to a scene with a rotating lens and used for determining a searching range according to the position of the target moving object in the previous video frame by taking the gray value of the pixel point of the position of the target moving object in the previous video frame as a reference value;
the matching point acquisition module is applied to a scene which is used for object motion and lens rotation, and is used for carrying out motion estimation according to the reference value and the gray value of the pixel point of the current video frame in the searching range to obtain a plurality of matching points;
and the target moving object position parameter calculation module is applied to a scene with moving objects and rotating lenses, and is used for determining the gravity center, the width and the height of a target moving object of the current video frame according to the matching points and determining the target moving object in the current video frame according to the gravity center, the width and the height of the target moving object.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a computing apparatus according to a fifth embodiment of the present invention, as shown in fig. 5, the computing apparatus includes a processor 510, a memory 520, an input device 530, and an output device 540; the number of processors 510 in the computing device may be one or more, and one processor 510 is taken as an example in fig. 5; the processor 510, memory 520, input device 530, and output device 540 in the computing device may be connected by a bus or other means, such as by a bus in fig. 5.
The memory 520 may be used as a computer-readable storage medium for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the tracking method of the target moving object in the embodiments of the present invention (e.g., the candidate motion pixel point detection module 410, the target moving object identification module 420, and the tracking direction control module 430 of the camera in the tracking device of the target moving object). The processor 510 executes various functional applications and data processing of the computing device by executing software programs, instructions and modules stored in the memory 520, namely, the above-mentioned tracking method of the target moving object is realized. That is, the program when executed by the processor implements:
acquiring a video frame acquired by a camera in real time, and detecting alternative motion pixel points in the current video frame by using an interframe image difference algorithm;
acquiring a shooting scene corresponding to the current video frame, selecting an identification strategy matched with the shooting scene, and identifying at least one target moving object included in the current video frame according to the alternative motion pixel points;
and controlling the tracking direction of the camera according to the deviation direction of the gravity center of the at least one target moving object relative to the center of the current video frame.
The memory 520 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, memory 520 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 520 can further include memory located remotely from the processor 510, which can be connected to a computing device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 530 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the computing device, and may include a keyboard, a mouse, and the like. The output device 540 may include a display device such as a display screen. The computing device in the embodiment of the invention can be a moving object tracking device provided with a camera, and can also be a server, and the server can be connected with the camera in a wireless or wired transmission mode.
EXAMPLE six
The sixth embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for tracking a target moving object according to any embodiment of the present invention. Of course, the embodiment of the present invention provides a computer-readable storage medium, which can perform related operations in the tracking method for a target moving object provided in any embodiment of the present invention. That is, the program when executed by the processor implements:
acquiring a video frame acquired by a camera in real time, and detecting alternative motion pixel points in the current video frame by using an interframe image difference algorithm;
acquiring a shooting scene corresponding to the current video frame, selecting an identification strategy matched with the shooting scene, and identifying at least one target moving object included in the current video frame according to the alternative motion pixel points;
and controlling the tracking direction of the camera according to the deviation direction of the gravity center of the at least one target moving object relative to the center of the current video frame.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly can be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the tracking device for the target moving object, the units and modules included in the embodiment are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims (7)
1. A method for tracking a target moving object, comprising:
acquiring a video frame acquired by a camera in real time, and detecting alternative motion pixel points in the current video frame by using an inter-frame image difference algorithm;
dividing the current video frame into a plurality of primary blocks by taking a first preset pixel point as a unit; dividing each primary block into a plurality of secondary blocks by taking a second preset pixel point as a unit; calculating the number of alternative motion pixel points included in each secondary block, and calculating the ratio of the number of the secondary blocks with the number of the alternative motion pixel points smaller than a preset value to the total number of the secondary blocks; judging whether the ratio is greater than or equal to a preset threshold value or not; if so, determining that the shooting scene is an object motion scene and a lens static scene; otherwise, determining that the shooting scene is an object motion and lens rotation scene;
if the shooting scene is determined to be an object motion scene and a lens static scene, calculating the number of alternative motion pixel points included in each primary block, and determining the primary block of which the number of the alternative motion pixel points is greater than or equal to a preset threshold value as a moving object candidate block; dividing each secondary block into a plurality of tertiary blocks by taking a third preset pixel point as a unit; constructing a search region matched with the image of the moving object candidate block according to the image position of each moving object candidate block; if each three-level block in the search area does not comprise any alternative motion pixel point, determining a motion object candidate block corresponding to the search area as an independent candidate motion object; calculating the gravity center, the width and the height of each candidate moving object, and calculating the motion severity of the candidate moving objects according to the number, the width and the height of the candidate moving pixels of the candidate moving objects; judging the candidate moving object as a target moving object according to the sport severity;
if the shooting scene is determined to be an object motion scene and the lens rotates, taking the gray value of the pixel point at the position where the target motion object in the previous video frame is located as a reference value, and determining a search range according to the position where the target motion object in the previous video frame is located; performing motion estimation according to the reference value and the gray value of the pixel point of the current video frame in the search range to obtain a plurality of matching points; determining the gravity center, the width and the height of a target moving object of the current video frame according to the matching points; determining the target moving object in the current video frame according to the gravity center, the width and the height of the target moving object;
and controlling the tracking direction of the camera according to the deviation direction of the gravity center of at least one target moving object relative to the center of the current video frame.
2. The method of claim 1, further comprising, before detecting the candidate motion pixel in the current video frame using an inter-frame image difference algorithm:
and acquiring a video frame acquired by a camera in real time, and performing noise reduction processing on the video frame.
3. The method of claim 1, wherein detecting the candidate motion pixel in the current video frame by using an inter-frame image difference algorithm comprises:
acquiring a previous video frame and a next video frame corresponding to the current video frame;
and detecting the candidate motion pixel points in the current video frame according to the difference between the gray value of each pixel point in the current video frame and the gray value of the pixel point at the corresponding position in the previous video frame or the next video frame.
4. The method of claim 3, wherein detecting the candidate motion pixel in the current video frame according to a difference between a gray value of each pixel in the current video frame and a gray value of a pixel at a corresponding position in the previous video frame or the next video frame comprises:
judging whether the absolute value of the difference of the gray values of the pixel points at each corresponding position of the current video frame and the previous video frame is greater than or equal to a preset threshold value or not; if so, setting the first gray value of each pixel point of the current video frame to be 255, otherwise, setting the first gray value of each pixel point of the current video frame to be 0;
judging whether the absolute value of the difference of the gray values of the pixel points at each corresponding position of the current video frame and the next video frame is greater than or equal to a preset threshold value or not; if so, setting a second gray value of each pixel point of the current video frame to be 255, otherwise, setting the second gray value of each pixel point of the current video frame to be 0;
setting the gray value of each pixel point in the current video frame as the sum operation result of the first gray value and the second gray value to obtain a binary image corresponding to the current video frame;
and obtaining each pixel point with the gray value of 255 in the binary image as the candidate motion pixel point.
5. A tracking apparatus for a target moving object, comprising:
the alternative motion pixel point detection module is used for acquiring a video frame acquired by the camera in real time and detecting alternative motion pixel points in the current video frame by utilizing an interframe image difference algorithm;
the target moving object identification module is used for dividing the current video frame into a plurality of primary blocks by taking a first preset pixel point as a unit; dividing each primary block into a plurality of secondary blocks by taking a second preset pixel point as a unit; calculating the number of alternative motion pixel points included in each secondary block, and calculating the ratio of the number of the secondary blocks with the number of the alternative motion pixel points smaller than a preset value to the total number of the secondary blocks; judging whether the ratio is greater than or equal to a preset threshold value; if so, determining that the shooting scene is an object motion scene and a lens static scene; otherwise, determining that the shooting scene is an object motion and lens rotation scene;
if the shooting scene is determined to be an object motion scene and a lens static scene, calculating the number of alternative motion pixel points included in each primary block, and determining the primary block of which the number of the alternative motion pixel points is greater than or equal to a preset threshold value as a moving object candidate block; dividing each secondary block into a plurality of tertiary blocks by taking a third preset pixel point as a unit; constructing a search area matched with the images of the moving object candidate blocks according to the image position of each moving object candidate block; if each three-level block in the search area does not comprise any alternative motion pixel point, determining a motion object candidate block corresponding to the search area as an independent candidate motion object; calculating the gravity center, the width and the height of each candidate moving object, and calculating the motion severity of the candidate moving objects according to the number, the width and the height of the candidate moving pixels of the candidate moving objects; judging the candidate moving object as a target moving object according to the motion severity;
if the shooting scene is determined to be an object motion scene and the lens rotates, taking the gray value of the pixel point of the position of the target motion object in the previous video frame as a reference value, and determining a search range according to the position of the target motion object in the previous video frame; performing motion estimation according to the reference value and the gray value of the pixel point of the current video frame in the searching range to obtain a plurality of matching points; determining the gravity center, the width and the height of a target moving object of the current video frame according to the matching points; determining the target moving object in the current video frame according to the gravity center, the width and the height of the target moving object;
and the tracking direction control module of the camera is used for controlling the tracking direction of the camera according to the deviation direction of the gravity center of at least one target moving object relative to the center of the current video frame.
6. A computing device, wherein the computing device comprises:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method of tracking a target moving object as recited in any one of claims 1-4.
7. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out a method for tracking a target moving object according to any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910837354.4A CN110610150B (en) | 2019-09-05 | 2019-09-05 | Tracking method, device, computing equipment and medium of target moving object |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910837354.4A CN110610150B (en) | 2019-09-05 | 2019-09-05 | Tracking method, device, computing equipment and medium of target moving object |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110610150A CN110610150A (en) | 2019-12-24 |
CN110610150B true CN110610150B (en) | 2022-10-11 |
Family
ID=68892337
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910837354.4A Active CN110610150B (en) | 2019-09-05 | 2019-09-05 | Tracking method, device, computing equipment and medium of target moving object |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110610150B (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113643497A (en) * | 2020-05-11 | 2021-11-12 | 广东毓秀科技有限公司 | Based on subway equipment smog identification system that catches fire |
CN113807124B (en) * | 2020-06-11 | 2023-12-12 | Oppo广东移动通信有限公司 | Image processing method, device, storage medium and electronic equipment |
CN112492196B (en) * | 2020-10-29 | 2022-01-07 | 贝壳技术有限公司 | Live broadcast in-process anchor tracking method, device and system |
CN113115085A (en) * | 2021-04-16 | 2021-07-13 | 海信电子科技(武汉)有限公司 | Video playing method and display equipment |
CN113179371B (en) * | 2021-04-21 | 2023-04-07 | 新疆爱华盈通信息技术有限公司 | Shooting method, device and snapshot system |
CN113569777B (en) * | 2021-08-02 | 2024-08-09 | 中国石油天然气集团有限公司 | Video detection method and device for equipment rotation working state |
CN113840159B (en) * | 2021-09-26 | 2024-07-16 | 北京沃东天骏信息技术有限公司 | Video processing method, device, computer system and readable storage medium |
CN115018706B (en) * | 2022-05-31 | 2024-11-01 | 新华智云科技有限公司 | Method for converting horizontal screen video material into vertical screen video material |
CN115499585B (en) * | 2022-09-07 | 2024-04-16 | 湖南中信安科技有限责任公司 | Hybrid scene law enforcement video focus local correction method and system |
CN116489317B (en) * | 2023-06-08 | 2023-09-08 | 北京城建智控科技股份有限公司 | Object detection method, system and storage medium based on image pickup device |
Family Cites Families (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7321386B2 (en) * | 2002-08-01 | 2008-01-22 | Siemens Corporate Research, Inc. | Robust stereo-driven video-based surveillance |
US7856120B2 (en) * | 2007-03-30 | 2010-12-21 | Mitsubishi Electric Research Laboratories, Inc. | Jointly registering images while tracking moving objects with moving cameras |
CN101303732B (en) * | 2008-04-11 | 2011-06-22 | 西安交通大学 | Method for apperceiving and alarming movable target based on vehicle-mounted monocular camera |
CN101572803B (en) * | 2009-06-18 | 2010-11-10 | 中国科学技术大学 | Customizable automatic tracking system based on video monitoring |
CN102054277B (en) * | 2009-11-09 | 2013-08-21 | 深圳市朗驰欣创科技有限公司 | Method and system for detecting moving target, and video analysis system |
CN105654512B (en) * | 2015-12-29 | 2018-12-07 | 深圳微服机器人科技有限公司 | A kind of method for tracking target and device |
US20180150703A1 (en) * | 2016-11-29 | 2018-05-31 | Autoequips Tech Co., Ltd. | Vehicle image processing method and system thereof |
CN107248173A (en) * | 2017-06-08 | 2017-10-13 | 深圳市智美达科技股份有限公司 | Method for tracking target, device, computer equipment and storage medium |
CN107392941A (en) * | 2017-07-25 | 2017-11-24 | 哈尔滨理工大学 | A kind of takeoff and landing tracking system and method |
CN109063659B (en) * | 2018-08-08 | 2021-07-13 | 北京佳讯飞鸿电气股份有限公司 | Method and system for detecting and tracking moving target |
CN109379594B (en) * | 2018-10-31 | 2022-07-19 | 北京佳讯飞鸿电气股份有限公司 | Video coding compression method, device, equipment and medium |
CN109889838B (en) * | 2018-12-29 | 2021-02-12 | 北京佳讯飞鸿电气股份有限公司 | HEVC (high efficiency video coding) rapid coding method based on ROI (region of interest) |
-
2019
- 2019-09-05 CN CN201910837354.4A patent/CN110610150B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN110610150A (en) | 2019-12-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110610150B (en) | Tracking method, device, computing equipment and medium of target moving object | |
CN110097586B (en) | Face detection tracking method and device | |
CN104966304B (en) | Multi-target detection tracking based on Kalman filtering and nonparametric background model | |
CN102103753B (en) | Use method and the terminal of real time camera estimation detect and track Moving Objects | |
CN112883819A (en) | Multi-target tracking method, device, system and computer readable storage medium | |
CN110650316A (en) | Intelligent patrol and early warning processing method and device, electronic equipment and storage medium | |
CN103870824B (en) | A kind of face method for catching and device during Face datection tracking | |
CN105046719B (en) | A kind of video frequency monitoring method and system | |
WO2001084844A1 (en) | System for tracking and monitoring multiple moving objects | |
CN107705254B (en) | City environment assessment method based on street view | |
CN110084830B (en) | Video moving object detection and tracking method | |
CN106682619A (en) | Object tracking method and device | |
CN107403451B (en) | Self-adaptive binary characteristic monocular vision odometer method, computer and robot | |
CN113469201A (en) | Image acquisition equipment offset detection method, image matching method, system and equipment | |
CN111429485B (en) | Cross-modal filtering tracking method based on self-adaptive regularization and high-reliability updating | |
CN118096815B (en) | Road abnormal event detection system based on machine vision | |
CN115049954B (en) | Target identification method, device, electronic equipment and medium | |
CN110717934B (en) | Anti-occlusion target tracking method based on STRCF | |
CN114511803B (en) | Target shielding detection method for visual tracking task | |
KR101690050B1 (en) | Intelligent video security system | |
CN110930436B (en) | Target tracking method and device | |
CN101567088B (en) | Method and device for detecting moving object | |
CN109741370B (en) | Target tracking method and device | |
Khan et al. | Foreground detection using motion histogram threshold algorithm in high-resolution large datasets | |
CN114419307A (en) | Weak and small target detection method and detection system based on infrared sequence image |
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 |