Moving object tracking method and device based on video image, medium and equipment

Through background difference and inter-frame difference processing, the target optical flow value is calculated only when specific conditions are met, which solves the problems of large calculation amount and slow speed in the existing technology, and improves the speed and accuracy of moving object tracking.

CN118570247APending Publication Date: 2024-08-30PING AN PAY ELECTRONIC PAYMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410725191.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing moving object tracking methods require a large amount of data calculation and are slow, and cannot effectively handle the computing needs of target moving objects when they are stationary or have slight position changes.

Method used

By performing background difference processing based on the current background image, k frame images and k-1 frame images, a binary image is obtained, inter-frame difference processing is performed to calculate the regional grayscale change, and the target optical flow value is calculated only when the tracking conditions are met. Predict the location of target moving objects.

Benefits of technology

It improves the speed and accuracy of tracking of moving objects, reduces the amount of calculation data, and avoids unnecessary calculations when the target object is stationary or changes its position slightly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570247A
    Figure CN118570247A
Patent Text Reader

Abstract

The invention discloses a moving object tracking method and device based on a video image, a medium and equipment. The method comprises the following steps: respectively carrying out background difference processing with a current background image based on k frames of images at the current moment and k-1 frames of images at the previous moment to obtain a first binary image and a second binary image; based on each moving object in the first binary image and each moving object in the second binary image, performing inter-frame difference processing on a target area corresponding to the same moving object to obtain an area gray level variation degree corresponding to each moving object; judging a target moving object meeting a preset tracking condition based on the regional gray level variation degree corresponding to each moving object, and calculating a target optical flow value of the target moving object based on the first binary image and the second binary image; and based on the target optical flow value and the current position of the target moving object in the k frames of images, predicting the target position of the target moving object in the k + 1 frames of images to obtain a tracking result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, medium and equipment for tracking a moving object based on video images. Background Art

[0002] With the continuous development of Internet technology, various intelligent monitoring systems have emerged. By setting up intelligent monitoring systems, it is possible to track suspicious people, visually track objects in robot vision, and track illegal vehicles in traffic monitoring, etc.

[0003] However, existing moving object tracking methods all directly perform background difference processing based on the background image, and then detect and analyze the moving object based on the difference result. Therefore, the existing moving object tracking methods have a large amount of data calculation and a slow speed. Summary of the invention

[0004] In view of this, the present invention provides a method, device, medium and equipment for tracking a moving object based on video images, the main purpose of which is to solve the current problems of large amount of data calculation and slow speed.

[0005] To solve the above problems, the present application provides a moving object tracking method based on video images, comprising:

[0006] Based on the k-frame image at the current moment and the k-1-frame image at the previous moment, background difference processing is performed with the current background image to obtain a first binary image corresponding to the k-1-frame image and a second binary image corresponding to the k-frame image;

[0007] Based on each moving object in the first binary image and each moving object in the second binary image, performing inter-frame difference processing on a target area corresponding to the same moving object to obtain a grayscale change degree of the area corresponding to each moving object;

[0008] Based on the grayscale change of the region corresponding to each moving object, a target moving object that meets the preset tracking condition is judged, and a target optical flow value of the target moving object is calculated based on the first binary image and the second binary image;

[0009] Based on the target optical flow value and the current position of the target moving object in the k frame image, the target position of the target moving object in the k+1 frame image is predicted to obtain a tracking result of the moving object.

[0010] To solve the above problems, the present application provides a moving object tracking device based on video images, comprising:

[0011] A background difference module is used to perform background difference processing on the current background image based on the k-frame image at the current moment and the k-1-frame image at the previous moment, respectively, to obtain a first binary image corresponding to the k-1-frame image and a second binary image corresponding to the k-frame image;

[0012] An inter-frame difference module, used for performing inter-frame difference processing on a target area corresponding to the same moving object based on each moving object in the first binary image and each moving object in the second binary image, to obtain a grayscale change degree of the area corresponding to each moving object;

[0013] A calculation module, used to determine a target moving object that meets a preset tracking condition based on the grayscale change of the region corresponding to each moving object, and calculate a target optical flow value of the target moving object based on the first binary image and the second binary image;

[0014] The tracking module is used to predict the target position of the target moving object in the k+1 frame image based on the target optical flow value and the current position of the target moving object in the k frame image to obtain the tracking result of the moving object.

[0015] To solve the above problems, the present application provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above-mentioned methods for tracking moving objects based on video images are implemented.

[0016] To solve the above problems, the present application provides an electronic device, comprising at least a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above-mentioned methods for tracking moving objects based on video images when executing the computer program on the memory.

[0017] The present application discloses a method, device, storage medium and electronic device for tracking a moving object based on a video image. By using a current background image to perform background difference with k frames and k-1 frames respectively, a binary image is obtained, so that the subsequent rapid calculation based on the binary image can obtain the regional grayscale change corresponding to each moving object. Therefore, when the regional grayscale change meets the tracking condition, the target optical flow value of the target moving object can be calculated, thereby avoiding the problem of a large amount of calculation data caused by still calculating the target optical flow value of the target moving object when the target moving object is stationary or has a slight position change, and ensuring that the tracking speed of the target moving object is improved while accurately predicting the target position of the target moving object in the k+1 frame image.

[0018] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0020] Figure 1 A flowchart of a method for tracking a moving object based on a video image according to an embodiment of the present application;

[0021] Figure 2 This is a structural block diagram of a moving object tracking device based on video images according to another embodiment of the present application;

[0022] Figure 3 This is a structural block diagram of an electronic device according to another embodiment of the present application. DETAILED DESCRIPTION

[0023] Various aspects and features of the present application are described herein with reference to the accompanying drawings.

[0024] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but only as an example of an embodiment. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.

[0025] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.

[0026] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.

[0027] It should also be understood that although the present application has been described with reference to some specific examples, those skilled in the art will be able to readily implement many other equivalent forms of the present application.

[0028] The above and other aspects, features and advantages of the present application will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.

[0029] Specific embodiments of the present application are described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments applied for are merely examples of the present application, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that obscure the present application. Therefore, the specific structural and functional details applied for herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present application in a variety of ways with substantially any suitable detailed structure.

[0030] This specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present application.

[0031] The present application embodiment provides a moving object tracking method based on video images, which can be specifically applied to electronic devices such as servers and terminals. Figure 1 As shown, the method in this embodiment includes the following steps:

[0032] Step S101, based on the k-frame image at the current moment and the k-1-frame image at the previous moment, background difference processing is performed with the current background image respectively to obtain a first binary image corresponding to the k-1-frame image and a second binary image corresponding to the k-frame image;

[0033] In this step, an initial background image may be acquired first, and then the initial background image may be updated in real time using the historical moment image, thereby obtaining the current background image.

[0034] Step S102, based on each moving object in the first binary image and each moving object in the second binary image, performing inter-frame difference processing on a target area corresponding to the same moving object to obtain a grayscale change degree of the area corresponding to each moving object;

[0035] In this step, the moving object can be a vehicle, a person, or an animal, etc. In the specific implementation process, the first binary image and the second binary image can be subjected to morphological denoising to obtain the processed first binary image and the processed second binary image. Then, based on the processed first binary image and the processed second binary image, the regions corresponding to the same moving object are subjected to inter-frame difference processing to obtain the regional grayscale variation of each object. In this step, the regional grayscale variation refers to the proportion of pixels with different grayscale values ​​in the two images within the same regional range.

[0036] Step S103, based on the grayscale change of the region corresponding to each moving object, determining the target moving object that meets the preset tracking condition, and calculating the target optical flow value of the target moving object based on the first binary image and the second binary image;

[0037] In the specific implementation process of this step, the preset tracking condition can be set according to actual needs, for example, the tracking condition can be greater than the target threshold. That is, when the regional grayscale variation is greater than the target threshold, it indicates that the position of the moving object has moved, and thus the moving object can be determined to be a target moving object that needs to be tracked. When the regional grayscale variation is not greater than the target threshold, it indicates that the moving object is stationary, or that the moving object has moved, but the position movement is relatively small, and the moving object is determined to be a non-target moving object that does not need to be tracked. After determining the target moving object, the target optical flow value of the target moving object can be further calculated. In this step, the target moving object that has moved can be accurately and quickly determined by calculating the grayscale variation, thereby reducing the number of data calculations for the subsequent targeted calculation of the optical flow value of the target moving object based on the target moving object, and laying the foundation for the subsequent accurate position prediction based on the optical flow value, avoiding the problem of large data calculation amount and low tracking speed caused by calculating the optical flow value when the moving object has not moved or has a small position movement.

[0038] Step S104, based on the target optical flow value and the current position of the target moving object in the k frame image, predict the target position of the target moving object in the k+1 frame image to obtain the tracking result of the moving object.

[0039] In the specific implementation process of this step, after determining the target optical flow value of the target moving object, the position of the target moving object at the next moment can be determined by combining the position of the target moving object in the kth frame image and the movement direction and movement speed in the target optical flow value, that is, the target position of the target moving object in the k+1 frame image is obtained.

[0040] In the present embodiment, a moving object tracking method based on video images is used to obtain a binary image by using the current background image to perform background difference with the k frame image and the k-1 frame image, so as to facilitate the subsequent rapid calculation based on the binary image to obtain the regional grayscale change corresponding to each moving object. Therefore, when the regional grayscale change meets the tracking condition, the target optical flow value of the target moving object can be calculated, thereby avoiding the problem of a large amount of calculation data caused by still calculating the target optical flow value of the target moving object when the target moving object is stationary or has a slight position change, thereby ensuring that the tracking speed of the target moving object is improved while accurately predicting the target position of the target moving object in the k+1 frame image.

[0041] On the basis of the above-mentioned embodiments, another embodiment of the present application provides a method for tracking moving objects based on video images. In the specific implementation process of this embodiment, when calculating the regional grayscale change of each moving object, the following method can be specifically adopted: determine the object contour of each moving object in the first binary image and the second binary image; based on the object contour of each moving object in the first binary image, determine the first peripheral frame corresponding to each moving object and containing the object contour; based on the object contour of each moving object in the second binary image, determine the second peripheral frame corresponding to each moving object and containing the object contour; based on the first peripheral frame and the second peripheral frame corresponding to the same moving object, perform inter-frame difference processing on the image area within the first peripheral frame and the second peripheral frame to obtain the regional grayscale change corresponding to each moving object. In this embodiment, the first peripheral frame and the second peripheral frame can be specifically rectangular frames. After determining the object contour in each binary image, the rectangular frame containing the object contour can be determined according to the object contour and the preset range value, so as to frame the moving object. The preset range value implements the distance range between the object contour and the rectangular frame, which can be set and adjusted according to actual needs. In this embodiment, by determining the rectangular frame, it is convenient to subsequently calculate the regional grayscale change degree for the pixels within the rectangular frame area.

[0042] Based on the above embodiments, another embodiment of the present application provides a method for tracking a moving object based on a video image. In this embodiment, when judging a target moving object that meets a preset tracking condition, the following method can be specifically adopted: comparing the regional grayscale change degree corresponding to each moving object with a predetermined first target threshold; when it is determined that the regional grayscale change degree is less than or equal to the first target threshold, determining that the moving object corresponding to the regional grayscale change degree is a non-target moving object; when it is determined that the regional grayscale change degree is greater than the first target threshold and greater than the second target threshold, determining that the moving object corresponding to the regional grayscale change degree is a target moving object; the second target threshold is greater than the first target threshold.

[0043] In this embodiment, the tracking condition can be set in advance according to actual needs. For example, the tracking condition can be set as the regional grayscale change is greater than the first target threshold and greater than or equal to the second target threshold, for example, the first target threshold is 15% and the second target threshold is 60%. That is, when the regional grayscale change is 89%, which is greater than the first target threshold by 15% and greater than the second target threshold by 60%, it indicates that the position of the moving object has moved, and thus the moving object can be determined to be a target moving object that needs to be tracked. When the regional grayscale change is 14%, which is not greater than the first target threshold, it indicates that the moving object is stationary (the position of the moving object has not changed), so the moving object is determined to be a non-target moving object. When the regional grayscale change is 25%, which is greater than the first target threshold by 15% but less than the second target threshold by 60%, it indicates that although the moving object has moved, the position movement is relatively small, and the moving object is also determined to be a non-target moving object.

[0044] In this embodiment, after the non-target moving object is determined, the current background image can be subjected to background update processing based on the grayscale regional variation of the non-target moving object, combined with the regional image in the first peripheral frame and / or the second peripheral frame corresponding to the non-target moving object, to obtain the updated current background image for the next round of moving object tracking. That is, after the non-target moving object is determined, the first non-target moving object whose regional grayscale variation is greater than zero and less than the first target threshold can be determined based on the grayscale regional variation of each non-target moving object; then, the current background image can be subjected to background update processing using the regional image in the first peripheral frame and / or the second peripheral frame corresponding to the first non-target moving object, to obtain the updated current background image for the next round of moving object tracking.

[0045] In this embodiment, since non-target moving objects include two types, the first type is: the regional grayscale change is greater than 0 but less than the first target threshold, and the second type is: the regional grayscale change is greater than the first target threshold but less than the second target threshold. Therefore, the non-target moving object in the first case can be determined as the first non-target moving object for background update. Therefore, the regional image in the first peripheral frame and / or the second peripheral frame of the first non-target moving object can be used to perform background update processing on the current background image.

[0046] Another embodiment of the present application provides a moving object tracking method based on video images, and in this embodiment, the Lucas-Kanade method can be specifically used to calculate the optical flow value. When calculating the target optical flow value of the target moving object, the following method can be specifically used: based on the object contour of the target moving object in the first binary image and the object contour of the target moving object in the second binary image, determine the offset direction of the object contour of the target moving object to determine the target optical flow direction; based on the target optical flow direction and the optical flow direction of each pixel point in the object contour area of ​​the target moving object in the second binary image, determine each target pixel point that meets the target optical flow direction; calculate the optical flow value of each target pixel point based on the first binary image and the second binary image; obtain the target optical flow value based on the optical flow value calculation of each target pixel point. In this embodiment, since most of the target moving objects are not rigid objects, there is a possibility of local anisotropic motion when the target moving object moves, so the optical flow in the object contour area may be different in direction. In order to obtain the main optical flow value of the target moving object as a whole, the direction (positive or negative) of the optical flow value that occupies the largest area of ​​the target (within the object contour area) can be statistically obtained, and then the average optical flow value of the pixels whose optical flow direction is in this direction is calculated, that is, the optical flow value (u, v) of the target is obtained. By calculating the optical flow value in the above manner, the accuracy of the target optical flow value calculation can be improved, thereby improving the accuracy of the tracking result. Subsequently, the target optical flow value (u, v) and the position (X, Y) of the target moving object in the k frame image can be used to predict the position (X+u, Y+v) of the target moving object in the k+1 frame image.

[0047] Another embodiment of the present application provides a method for tracking a moving object based on a video image. In this embodiment, before background difference processing is performed between the k frame images at the current moment and the k-1 frame images at the previous moment and the current background image, respectively, a current background image can also be obtained. The current background image can be an initial background image or an updated image that is updated in real time based on the initial background image.

[0048] The acquisition process of the current background image is as follows: acquiring several initial image frames that do not contain moving objects; constructing an initial background image based on each initial image frame to obtain the current background image. Alternatively, acquiring several initial image frames that do not contain moving objects; constructing an initial background image based on each initial image frame; updating the initial background image to obtain the current background image based on the grayscale change of the region corresponding to each moving object in the adjacent historical image frames in real time. Specifically, after acquiring several initial image frames that do not contain moving objects, pixel average calculation can be performed on each pixel in each initial image frame to obtain the average pixel value of each pixel; constructing an initial background image based on the average pixel value of each pixel, and then a mixed Gaussian distribution model can be used to describe the recent changes on each pixel in the initial background image. When the initial background image is subsequently updated, the historical first non-target moving object that meets the update condition can be judged in real time based on the Gaussian distribution model and the grayscale change of the region corresponding to each moving object in the adjacent historical image frames, and then the initial background image is updated using the region corresponding to the historical first non-target moving object to obtain the current background image.

[0049] In this embodiment, the principle of updating the initial background image to obtain the current background image based on the grayscale change of the region corresponding to each moving object in the adjacent historical image frames in real time is the same as the principle of updating the current background image based on the region corresponding to the first non-target moving object, which is achieved by calculating the grayscale change of the region corresponding to the moving object. That is, the adjacent historical image frames at adjacent historical moments are used to perform background difference with the initial background image respectively to obtain two binary images, and then the two binary images are subjected to inter-frame difference processing to obtain the grayscale change of the region corresponding to each moving object in the historical image frame, and then it is determined whether the preset background update condition is met based on the grayscale change of the region; and when the grayscale change of the region is greater than zero and less than the first target threshold, the historical first non-target moving object that meets the background update condition is determined, and the initial background image is updated based on the regional image corresponding to the historical first non-target moving object to obtain the current image. In this embodiment, by updating the background image in real time, when a certain moving object A suddenly breaks in and the moving object A does not move in position afterwards, it is possible to avoid that each frame of the image containing the moving object A in the subsequent shooting is compared and calculated with the original initial image that does not contain the moving object A, which causes the problem of large data volume calculation and slow speed. That is, since the background image can be updated in real time, even if the initial background image does not contain the moving object A, the initial background can be updated in real time based on the image containing A, so as to obtain the current background image containing the moving object A, so that each frame of the image taken subsequently is compared and calculated with the current background image containing the moving object A, which reduces the amount of data calculation and improves the tracking speed.

[0050] The present application is based on a moving object tracking method for video images. By using the updated current background image to perform background difference on k frame images and k-1 frame images, the amount of calculation can be reduced and the difference result can be made more accurate. By determining the regional grayscale change corresponding to each moving object, the target optical flow value of the target moving object is calculated when the regional grayscale change meets the tracking condition. This avoids the problem of a large amount of calculation data caused by still calculating the target optical flow value of the target moving object when the target moving object is stationary or has a slight position change. This ensures that while the target position of the target moving object in the k+1 frame image is accurately predicted, the tracking speed of the target moving object is improved.

[0051] Another embodiment of the present application provides a moving object tracking method based on a video image, comprising:

[0052] Step 1: averaging a series of images that do not contain moving objects pixel by pixel, and taking the result as the background, that is, obtaining the initial background image;

[0053] Step 2: updating the initial background image in real time based on the grayscale change of the region corresponding to each moving object in the adjacent historical image frames to obtain the current background image;

[0054] In this step, the process of updating the initial background image is described by taking the adjacent historical image frames as the mth frame image and the m+1th frame image as an example:

[0055] Based on the m-th frame image and the m+1-th frame image, background difference processing is performed with the initial background image respectively to obtain a first binary image corresponding to the m-th frame image and a second binary image corresponding to the m+1-th frame image. The first binary image and the second binary image are subjected to morphological denoising processing to obtain a processed first binary image and a processed second binary image containing the object contour of the moving object. Based on the object contour of each moving object in the processed first binary image, a first peripheral frame corresponding to each moving object and containing the object contour is determined; based on the object contour of each moving object in the second binary image, a second peripheral frame corresponding to each moving object and containing the object contour is determined. Based on the first peripheral frame and the second peripheral frame corresponding to the same moving object, inter-frame difference processing is performed on the image area within the first peripheral frame and the second peripheral frame to obtain the grayscale change degree of the area corresponding to each moving object. Based on the area change degree of each moving object, determine whether each moving object meets the preset background update condition, so that when the area change degree is less than the first target threshold, determine that the moving object meets the preset background update condition, and determine the moving object as the historical first non-target moving object; then use the first outer frame and / or second outer frame area corresponding to the historical first non-target moving object to update the initial background image to obtain the current background image.

[0056] In this embodiment, when the initial background image is updated, a mixed Gaussian distribution model can be used to describe the recent changes of each pixel of the initial background image, and a multi-distribution model (such as a distribution model containing N distributions) can be obtained. Then, Stauffer's method is used to perform approximate calculations, and each newly captured pixel value X t Compare with N distributions in known mixture models until one is found that matches X t The best matching distribution. If the N distributions in the mixed model are consistent with X t None of them match, indicating that X t It is a new foreground point. A new distribution η(u,D) is used to replace the distribution with the smallest priority coefficient in the mixed model to obtain an updated distribution model corresponding to the updated background image.

[0057] Step 3: Based on the k-frame image at the current moment and the k-1-frame image at the previous moment, background difference processing is performed with the current background image to obtain a first binary image corresponding to the k-1-frame image and a second binary image corresponding to the k-frame image;

[0058] Step 4: Based on each moving object in the first binary image and each moving object in the second binary image, perform inter-frame difference processing on the target area corresponding to the same moving object to obtain the grayscale change degree of the area corresponding to each moving object;

[0059] Step 5: based on the grayscale change of the region corresponding to each moving object, determine the target moving object that meets the preset tracking condition, and determine the first non-target moving object that meets the preset background update condition;

[0060] In this step, after obtaining the regional grayscale change, if the regional grayscale change is less than the first target threshold of 15%, that is, more than 85% of the region has no grayscale change, then the moving object corresponding to the regional grayscale change is determined to be the first historical non-target moving object, that is, the first non-target moving object that meets the background update condition is obtained, and the first peripheral frame and / or second peripheral frame area corresponding to the first non-target moving object can be used to update the current background image to obtain the updated current background image. If the regional grayscale change is greater than or equal to 15%, then it is determined whether the area of ​​the region (i.e., the area of ​​the grayscale change) is less than the second target threshold. If it is less than the second target threshold, it means that the moving object can be ignored, that is, the moving object is a non-target moving object. If the regional grayscale change is greater than or equal to the second target threshold, then the moving object is determined to be a target moving object, that is, the target moving object that meets the tracking condition is obtained.

[0061] Step 6: For a target moving object that meets the tracking condition, a target optical flow value of the target moving object can be calculated based on the first binary image and the second binary image.

[0062] In the specific implementation process of this step, specifically, based on the object contour of the target moving object in the first binary image and the object contour of the target moving object in the second binary image, the offset direction of the object contour of the target moving object can be determined to determine the target optical flow direction; based on the target optical flow direction and the optical flow direction of each pixel point in the object contour area of ​​the target moving object in the second binary image, each target pixel point that meets the target optical flow direction is determined; based on the first binary image and the second binary image, the optical flow value of each of the target pixel points is calculated; and based on the optical flow value calculation of each of the target pixel points, the target optical flow value is obtained.

[0063] Step 7: Based on the target optical flow value and the position of the target moving object in the k frame image, predict the target position of the target moving object in the k+1 frame image to obtain the tracking result of the moving object.

[0064] Step 8: for a first non-target moving object that meets the background update condition, the current background image is updated using the first peripheral frame and / or the second peripheral frame area corresponding to the first non-target moving object to obtain an updated current background image;

[0065] The video image-based moving object tracking method in the present application obtains a binary image by performing background difference using the current background image and the k-frame image and the k-1-frame image respectively, so as to facilitate the subsequent rapid calculation based on the binary image to obtain the regional grayscale change corresponding to each moving object. Thus, when the regional grayscale change satisfies the tracking condition, the target optical flow value of the target moving object can be calculated, thereby avoiding the problem of a large amount of calculation data caused by still calculating the target optical flow value of the target moving object when the target moving object is stationary or has a slight position change, and ensuring that the tracking speed of the target moving object is improved while accurately predicting the target position of the target moving object in the k+1 frame image.

[0066] Another embodiment of the present application provides a moving object tracking device based on video images, comprising:

[0067] The background difference module 11 is used to perform background difference processing on the current background image based on the k-frame image at the current moment and the k-1-frame image at the previous moment, respectively, to obtain a first binary image corresponding to the k-1-frame image and a second binary image corresponding to the k-frame image;

[0068] An inter-frame difference module 12 is used to perform inter-frame difference processing on a target area corresponding to the same moving object based on each moving object in the first binary image and each moving object in the second binary image to obtain a grayscale change degree of the area corresponding to each moving object;

[0069] A calculation module 13 is used to determine a target moving object that meets a preset tracking condition based on the grayscale change of the region corresponding to each moving object, and calculate a target optical flow value of the target moving object based on the first binary image and the second binary image;

[0070] The tracking module 14 is used to predict the target position of the target moving object in the k+1 frame image based on the target optical flow value and the current position of the target moving object in the k frame image to obtain the tracking result of the moving object.

[0071] In the specific implementation process of this embodiment, the video image-based moving object tracking device also includes a processing module, which is used to: before performing inter-frame difference processing on the target area corresponding to the same moving object based on each moving object in the first binary image and each moving object in the second binary image, perform morphological denoising processing on the first binary image and the second binary image to obtain the processed first binary image and the processed second binary image for inter-frame difference processing.

[0072] In the specific implementation process of this embodiment, the inter-frame difference module is specifically used to: determine the object contours of each moving object in the first binary image and the second binary image; based on the object contours of each moving object in the first binary image, determine the first outer frame corresponding to each moving object and containing the object contour; based on the object contours of each moving object in the second binary image, determine the second outer frame corresponding to each moving object and containing the object contour; based on the first outer frame and the second outer frame corresponding to the same moving object, perform inter-frame difference processing on the image area within the first outer frame and the second outer frame to obtain the grayscale change degree of the area corresponding to each moving object.

[0073] In the specific implementation process of this embodiment, the calculation module is specifically used to: compare the regional grayscale change degree corresponding to each moving object with a predetermined first target threshold; when it is determined that the regional grayscale change degree is less than or equal to the first target threshold, determine that the moving object corresponding to the regional grayscale change degree is a non-target moving object; when it is determined that the regional grayscale change degree is greater than the first target threshold and greater than the second target threshold, determine that the moving object corresponding to the regional grayscale change degree is a target moving object; the second target threshold is greater than the first target threshold.

[0074] In the specific implementation process of this embodiment, the video image-based motion object tracking device also includes an update module, which is used to: after determining the non-target motion object, based on the area image within the first outer frame and / or the second outer frame corresponding to the non-target motion object, perform background update processing on the current background image to obtain an updated current background image for the next round of motion object tracking.

[0075] In the specific implementation process of this embodiment, the calculation module is specifically used to: determine the offset direction of the object contour of the target moving object based on the object contour of the target moving object in the first binary image and the object contour of the target moving object in the second binary image to determine the target optical flow direction; determine each target pixel point that meets the target optical flow direction based on the target optical flow direction and the optical flow direction of each pixel point in the object contour area of ​​the target moving object in the second binary image; calculate the optical flow value of each of the target pixel points based on the first binary image and the second binary image; and obtain the target optical flow value based on the optical flow value calculation of each of the target pixel points.

[0076] In the specific implementation process of this embodiment, the video image-based moving object tracking device also includes an acquisition module, which is used to acquire the current background image before performing background difference processing with the current background image based on the k-frame image at the current moment and the k-1-frame image at the previous moment. Specifically, the acquisition module is used to: acquire a number of initial image frames that do not contain moving objects; construct an initial background image based on each initial image frame; and the update module is also used to: update the initial background image in real time based on the grayscale change of the area corresponding to each moving object in the adjacent historical image frames to obtain the current background image.

[0077] The present application is a moving object tracking device based on video images. By using the current background image to perform background difference with the k-frame image and the k-1-frame image respectively, a binary image is obtained, which is convenient for subsequent rapid calculation based on the binary image to obtain the regional grayscale change corresponding to each moving object. Therefore, when the regional grayscale change meets the tracking condition, the target optical flow value of the target moving object can be calculated, avoiding the problem of a large amount of calculation data caused by still calculating the target optical flow value of the target moving object when the target moving object is stationary or has a slight position change, and ensuring that the tracking speed of the target moving object is improved while accurately predicting the target position of the target moving object in the k+1 frame image.

[0078] Another embodiment of the present application provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the following method steps are implemented:

[0079] Step 1: Based on the k-frame image at the current moment and the k-1-frame image at the previous moment, background difference processing is performed with the current background image to obtain a first binary image corresponding to the k-1-frame image and a second binary image corresponding to the k-frame image;

[0080] Step 2: Based on each moving object in the first binary image and each moving object in the second binary image, inter-frame difference processing is performed on the target area corresponding to the same moving object to obtain the grayscale change degree of the area corresponding to each moving object;

[0081] Step 3: based on the grayscale change of the region corresponding to each moving object, determine the target moving object that meets the preset tracking condition, and calculate the target optical flow value of the target moving object based on the first binary image and the second binary image;

[0082] Step 4: Based on the target optical flow value and the current position of the target moving object in the k frame image, predict the target position of the target moving object in the k+1 frame image to obtain the tracking result of the moving object.

[0083] The specific implementation process of the above method steps can refer to any of the above embodiments of the moving object tracking method based on video images, and this embodiment will not be repeated here.

[0084] The storage medium in the present application obtains a binary image by performing background difference using the current background image and the k-frame image and the k-1-frame image, so as to facilitate the subsequent rapid calculation based on the binary image to obtain the regional grayscale change corresponding to each moving object. Thus, when the regional grayscale change satisfies the tracking condition, the target optical flow value of the target moving object can be calculated, thereby avoiding the problem of a large amount of calculation data caused by still calculating the target optical flow value of the target moving object when the target moving object is stationary or has a slight position change, and ensuring that the tracking speed of the target moving object is improved while the target position of the target moving object in the k+1 frame image is accurately predicted.

[0085] Another embodiment of the present application provides an electronic device, comprising at least a memory and a processor, wherein the memory stores a computer program, and the processor implements the following method steps when executing the computer program in the memory:

[0086] Step 1: Based on the k-frame image at the current moment and the k-1-frame image at the previous moment, background difference processing is performed with the current background image to obtain a first binary image corresponding to the k-1-frame image and a second binary image corresponding to the k-frame image;

[0087] Step 2: Based on each moving object in the first binary image and each moving object in the second binary image, inter-frame difference processing is performed on the target area corresponding to the same moving object to obtain the grayscale change degree of the area corresponding to each moving object;

[0088] Step 3: based on the grayscale change of the region corresponding to each moving object, determine the target moving object that meets the preset tracking condition, and calculate the target optical flow value of the target moving object based on the first binary image and the second binary image;

[0089] Step 4: Based on the target optical flow value and the current position of the target moving object in the k frame image, predict the target position of the target moving object in the k+1 frame image to obtain the tracking result of the moving object.

[0090] The specific implementation process of the above method steps can refer to any of the above embodiments of the moving object tracking method based on video images, and this embodiment will not be repeated here.

[0091] The electronic device in the present application obtains a binary image by performing background difference using the current background image and the k-frame image and the k-1-frame image respectively, so as to facilitate the subsequent rapid calculation based on the binary image to obtain the regional grayscale change corresponding to each moving object. Thus, when the regional grayscale change satisfies the tracking condition, the target optical flow value of the target moving object can be calculated, thereby avoiding the problem of a large amount of calculation data caused by still calculating the target optical flow value of the target moving object when the target moving object is stationary or has a slight position change, and ensuring that the tracking speed of the target moving object is improved while the target position of the target moving object in the k+1 frame image is accurately predicted.

[0092] The above embodiments are only exemplary embodiments of the present application and are not intended to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and protection scope of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present application.

Claims

1. A moving object tracking method based on video images, characterized in that: include: Based on the k-frame image at the current moment and the k-1-frame image at the previous moment, background difference processing is performed with the current background image to obtain a first binary image corresponding to the k-1-frame image and a second binary image corresponding to the k-frame image; Based on each moving object in the first binary image and each moving object in the second binary image, performing inter-frame difference processing on a target area corresponding to the same moving object to obtain a grayscale change degree of the area corresponding to each moving object; Based on the grayscale change of the region corresponding to each moving object, a target moving object that meets the preset tracking condition is judged, and a target optical flow value of the target moving object is calculated based on the first binary image and the second binary image; Based on the target optical flow value and the current position of the target moving object in the k frame image, the target position of the target moving object in the k+1 frame image is predicted to obtain a tracking result of the moving object.

2. The method according to claim 1, characterized in that Before performing inter-frame difference processing on a target area corresponding to the same moving object based on each moving object in the first binary image and each moving object in the second binary image, the method further includes: The first binary image and the second binary image are subjected to morphological denoising processing to obtain the processed first binary image and the processed second binary image for performing inter-frame difference processing.

3. The method according to claim 1, characterized in that The step of performing inter-frame difference processing on a target region corresponding to the same moving object based on each moving object in the first binary image and each moving object in the second binary image to obtain a grayscale change degree of the region corresponding to each moving object specifically includes: determining an object contour of each moving object in the first binary image and the second binary image; Based on the object contour of each moving object in the first binary image, determining a first outer frame corresponding to each moving object and including the object contour; Based on the object contour of each moving object in the second binary image, determining a second outer frame corresponding to each moving object and including the object contour; Based on the first peripheral frame and the second peripheral frame corresponding to the same moving object, inter-frame difference processing is performed on the image areas within the first peripheral frame and the second peripheral frame to obtain the grayscale change degree of the area corresponding to each moving object.

4. The method according to claim 1, characterized in that The step of judging the target moving object that meets the preset tracking condition based on the grayscale change of the region corresponding to each moving object specifically includes: Compare the grayscale change of the region corresponding to each moving object with a predetermined first target threshold; In the case where it is determined that the regional grayscale change degree is less than or equal to the first target threshold, determining that the moving object corresponding to the regional grayscale change degree is a non-target moving object; When it is determined that the regional grayscale variation is greater than the first target threshold and greater than the second target threshold, the moving object corresponding to the regional grayscale variation is determined to be the target moving object; the second target threshold is greater than the first target threshold.

5. The method according to claim 4, characterized in that After determining the non-target moving object, the method further includes: Based on the area image within the first peripheral frame and / or the second peripheral frame corresponding to the non-target moving object, background update processing is performed on the current background image to obtain an updated current background image for the next round of moving object tracking.

6. The method according to claim 1, characterized in that The step of calculating and obtaining the target optical flow value of the target moving object based on the first binary image and the second binary image specifically includes: Based on the object contour of the target moving object located in the first binary image and the object contour of the target moving object located in the second binary image, determining the offset direction of the object contour of the target moving object to determine the target optical flow direction; Based on the target optical flow direction and the optical flow direction of each pixel point in the object contour area of ​​the target moving object in the second binary image, determine each target pixel point that satisfies the target optical flow direction; Calculate the optical flow value of each of the target pixels based on the first binary image and the second binary image; A target optical flow value is obtained based on the optical flow value calculation of each of the target pixel points.

7. The method according to claim 1, characterized in that Before performing background difference processing on the current background image based on the k-frame image at the current moment and the k-1-frame image at the previous moment, the method further includes: acquiring the current background image, specifically including: Acquire a number of initial image frames that do not contain moving objects; An initial background image is constructed based on each initial image frame; The initial background image is updated in real time based on the grayscale change of the region corresponding to each moving object in the adjacent historical image frames to obtain the current background image.

8. A moving object tracking device based on video images, characterized in that: include: A background difference module is used to perform background difference processing on the current background image based on the k-frame image at the current moment and the k-1-frame image at the previous moment, respectively, to obtain a first binary image corresponding to the k-1-frame image and a second binary image corresponding to the k-frame image; An inter-frame difference module is used to perform inter-frame difference processing on a target area corresponding to the same moving object based on each moving object in the first binary image and each moving object in the second binary image, so as to obtain a grayscale change degree of the area corresponding to each moving object; A calculation module, used to determine a target moving object that meets a preset tracking condition based on the grayscale change of the region corresponding to each moving object, and calculate a target optical flow value of the target moving object based on the first binary image and the second binary image; The tracking module is used to predict the target position of the target moving object in the k+1 frame image based on the target optical flow value and the current position of the target moving object in the k frame image to obtain the tracking result of the moving object.

9. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for tracking a moving object based on a video image according to any one of claims 1 to 7 are implemented.

10. An electronic device, characterized in that: The method at least comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method for tracking a moving object based on a video image as described in any one of claims 1 to 7 when executing the computer program on the memory.