Method, device, computer equipment and storage medium for determining the motion state of an object
Through video frame edge detection and contour feature matching, the problem of low efficiency in identifying motion state of monitoring objects is solved, and fast and accurate detection is achieved in complex scenarios.
Patent Information
- Application Number
- CN202110858280.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-28
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2041-07-28
AI Technical Summary
It is difficult for the prior art to quickly and accurately identify the motion state of the monitoring object, especially in complex scenarios, where false detection and low recognition efficiency are problems.
By acquiring the monitoring video stream, performing video frame edge detection, determining contour features, matching preset features to determine flag position information, and determining the motion state of the monitoring object based on this. This method includes edge detection, contour feature extraction and matching, combining binarization processing and entropy segmentation threshold selection to ensure fast and accurate position information acquisition.
It realizes rapid and accurate detection of the motion state of the monitored object, reduces the false detection rate, and is suitable for a variety of monitoring scenarios, including monitoring of fixed and mobile objects.
Smart Images

Figure CN113673362B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to a method, device, computer equipment and storage medium for determining the motion state of an object. Background Art
[0002] In recent years, with the development of related technologies such as signal processing theory and visual theory, computer vision has also developed rapidly, and with its non-contact, automated, visualized, real-time and intelligent features, it is gradually being applied to various scenarios in our daily lives, especially for monitoring tasks of objects in certain scenarios, such as preventing theft through intelligent monitoring of an electric vehicle parking lot; preventing illegal removal through detection of stone pier checkpoints at the entrance of pedestrian places; and preventing loss of livestock by positioning and detecting in farms. Therefore, it is an issue that needs to be considered to quickly and accurately identify the running status of an object. Summary of the invention
[0003] Based on this, it is necessary to provide a method, device, computer equipment and storage medium for determining the motion state of an object in response to the above technical problems.
[0004] In a first aspect, an embodiment of the present invention provides a method for determining a motion state of an object, the method comprising:
[0005] Acquire a surveillance video stream, wherein the surveillance video stream contains a surveillance object associated with the mark to be detected;
[0006] Determine the marker position information corresponding to each video frame in the monitoring video stream, wherein the marker position information is determined based on the position information of the marker to be detected in the corresponding video frame;
[0007] Based on the marker position information corresponding to each video frame, the motion state of the monitored object is determined.
[0008] In one embodiment, determining the marker position information corresponding to each video frame in the surveillance video stream includes:
[0009] The following operations are performed for each video frame:
[0010] Perform edge detection on one of the video frames to obtain edge information of the one video frame; based on the edge information of the one video frame, obtain
[0011] The corresponding first contour feature;
[0012] Based on the matching relationship between the first contour feature and a preset second contour feature, the mark position information corresponding to the one video frame is determined; wherein the second contour feature is obtained based on a reference image containing the mark to be detected.
[0013] In one embodiment, the first contour feature includes the position information of the contour, the shape of the contour, and the positional relationship between the contours. The first contour feature includes the position information of the contour, the shape of the contour, and the positional relationship between the contours. The first contour feature corresponding to the edge information of the one video frame is obtained by:
[0014] Based on the edge information of the one video frame, determining position information of a corresponding contour;
[0015] The shapes of the contours and the positional relationship between the contours are determined based on the positional information of the contours.
[0016] In one embodiment, determining the position information of the corresponding contour based on the edge information of the one video frame includes:
[0017] Determine any pixel point in a video frame after the edge detection as a first detection point;
[0018] Determine whether the first detection point is a target pixel point, where the target pixel point is a pixel point where an edge is located;
[0019] If so, taking the first detection point as the center point, traversing the pixel points around the center point in sequence according to the first preset rule to determine whether it is a target pixel point, when the target pixel point is determined, taking the target pixel point as the next center point, and repeating the above target pixel point determination step, until the determined target pixel point is a traversed pixel point or there is no target pixel point around the center point, then determining the next pixel point as the second detection point according to the second preset rule, repeating the above target pixel point determination step, until the pixel points contained in the video frame are traversed;
[0020] If not, the next pixel point is determined as the second detection point according to the second preset rule, and the above target pixel point determination step is repeated until the pixel points included in the video frame are traversed;
[0021] The position information of the contour corresponding to the edge information in the video frame is determined based on the target pixel point.
[0022] In one embodiment, the determining the marker position information corresponding to the one video frame based on the matching relationship between the first contour feature and the preset second contour feature includes:
[0023] In the first contour feature, determining a third contour feature that matches the shape of the contour included in the second contour feature and matches the positional relationship between the contours included in the second contour feature;
[0024] Based on the position information of the contour corresponding to the third contour feature, the marker position information corresponding to the one video frame is determined.
[0025] In one embodiment, before performing edge detection on one of the video frames, the method further includes:
[0026] Performing binarization processing on one of the video frames to obtain a binarized image;
[0027] Perform edge detection on the binarized image.
[0028] In one embodiment, the binarizing one of the video frames to obtain a binarized image includes:
[0029] Performing grayscale processing on the one video frame to obtain a grayscale histogram;
[0030] Taking the average of the grayscale values corresponding to each adjacent peak in the grayscale histogram as the candidate segmentation threshold;
[0031] Selecting each candidate segmentation threshold to segment the foreground and background of the grayscale histogram, and using the segmentation threshold corresponding to the maximum value of the sum of the foreground and background entropies as the threshold for binarization processing;
[0032] Based on the binarization threshold, the one video frame is binarized to obtain a binarized image.
[0033] In a second aspect, an embodiment of the present invention provides a device for determining a motion state of an object, the device comprising:
[0034] An acquisition module, used for acquiring a monitoring video stream, wherein the monitoring video stream contains a monitoring object associated with the mark to be detected;
[0035] A first determination module, used to determine the marker position information corresponding to each video frame in the monitoring video stream, wherein the marker position information is determined based on the position information of the marker to be detected in the corresponding video frame;
[0036] The second determination module is used to determine the motion state of the monitored object based on the marker position information corresponding to each video frame.
[0037] In a third aspect, an embodiment of the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0038] Acquire a surveillance video stream, wherein the surveillance video stream contains a surveillance object associated with the mark to be detected;
[0039] Determine the marker position information corresponding to each video frame in the monitoring video stream, wherein the marker position information is determined based on the position information of the marker to be detected in the corresponding video frame;
[0040] Based on the marker position information corresponding to each video frame, the motion state of the monitored object is determined.
[0041] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein when the processor executes the computer program, the following steps are implemented:
[0042] Acquire a surveillance video stream, wherein the surveillance video stream contains a surveillance object associated with the mark to be detected;
[0043] Determine the marker position information corresponding to each video frame in the monitoring video stream, wherein the marker position information is determined based on the position information of the marker to be detected in the corresponding video frame;
[0044] Based on the marker position information corresponding to each video frame, the motion state of the monitored object is determined.
[0045] The above-mentioned method, apparatus, computer equipment and storage medium obtain a monitoring video stream, wherein the monitoring video stream contains a monitoring object associated with a mark to be detected, and determines the mark position information corresponding to each video frame in the monitoring video stream, wherein the mark position information is determined based on the position information of the mark to be detected in the corresponding video frame, and determines the motion state of the monitoring object based on the mark position information corresponding to each video frame, thereby being able to quickly and accurately detect the motion state of the monitoring object. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A diagram of an application environment of a method for determining a motion state of an object in one embodiment;
[0047] Figure 2 A schematic diagram of a flow chart of a method for determining a motion state of an object in one embodiment;
[0048] Figure 3 is a schematic diagram of a mark to be detected in one embodiment;
[0049] Figure 4 It is a flowchart of a method for determining position information of a mark to be detected in one embodiment;
[0050] Figure 5 It is a flowchart of a method for determining position information of a mark to be detected in one embodiment;
[0051] Figure 6 is a schematic flow chart of a method for determining position information of a contour in one embodiment;
[0052] Figure 7 is a schematic diagram of the structure of a device for determining a motion state of an object in one embodiment;
[0053] Figure 8 The figure is a diagram of the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0055] The present application provides a method for determining the motion state of an object, which can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The terminal 102 first obtains a monitoring video stream, the monitoring video stream contains a monitoring object associated with a mark to be detected, and determines the mark position information corresponding to each video frame in the monitoring video stream, the mark position information is determined based on the position information of the mark to be detected in the corresponding video frame, and based on the mark position information corresponding to each video frame, the motion state of the monitoring object is determined, and the terminal 102 sends the monitoring result to the server 104. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0056] In one embodiment, if Figure 2 As shown, a method for determining the motion state of an object is provided, and the method is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0057] S202: Acquire a surveillance video stream, wherein the surveillance video stream includes a surveillance object associated with a mark to be detected;
[0058] S204: Determine the marker position information corresponding to each video frame in the monitoring video stream, wherein the marker position information is determined based on the position information of the marker to be detected in the corresponding video frame;
[0059] S206: Determine the motion state of the monitored object based on the marker position information corresponding to each video frame.
[0060] In this embodiment, a to-be-detected mark linked to the monitored object is set, and the to-be-detected mark can be identified more quickly and accurately than the monitored object. Therefore, the present invention can quickly and accurately determine the motion state of the monitored object by determining the mark position information corresponding to the video frame.
[0061] In S202, the mark to be detected is captured by the monitoring device. In order to quickly and accurately identify the mark to be detected, the mark to be detected, the monitored object, and the scene where the monitored object is located are significantly different, so as to avoid false detection.
[0062] In one embodiment, the mark to be detected is mainly formed by a combination of any shapes such as circle, square, triangle, etc. Figure 3 As shown, design rules usually superimpose two or more different shapes to distinguish them from other interference targets in the same monitoring scene.
[0063] For monitoring scenes with fixed monitoring objects: the high-definition camera monitors the current scene horizontally at a depression angle of 30 degrees. The mark to be detected is usually pasted on the side of the monitored object near the top and facing the high-definition monitoring camera so that the camera can normally capture the mark to be detected.
[0064] For monitoring scenes with moving monitoring objects: the high-definition camera monitors the current scene from a top-down angle of about 75 degrees. The mark to be detected is usually pasted on the top of the target to be monitored. In this way, no matter how the monitored object moves, the camera can always capture the mark to be detected normally.
[0065] In S204, the monitoring video stream is framed and the mark to be detected in each video frame is detected. After the mark to be detected is detected, the mark position information corresponding to each video frame can be determined.
[0066] In one embodiment, if Figure 4 As shown, the method for determining the marker position information corresponding to each video frame in the monitoring video stream includes:
[0067] The following operations are performed for each video frame:
[0068] S302: Perform edge detection on one of the video frames to obtain edge information of the one video frame.
[0069] In one embodiment, the Canny operator is first used for edge detection. The specific method is as follows: the Canny operator is used to calculate the gradient G(x, y) and angle θ(x, y) of a certain pixel point on the input video frame.
[0070]
[0071]
[0072] Among them, (i, j) represents the position of the pixel with abscissa i and ordinate j, G x (i, j) represents the gradient information of the pixel point (i, j) in the x direction, G y (i, j) represents the gradient information of the pixel point (i, j) in the y direction.
[0073] Then, the non-maximum suppression method is used to find the pixel points corresponding to the local maximum value in the gradient image as edge points. In order to avoid the generation of partial pseudo edges, a double threshold algorithm is used to detect and connect the edge points to determine the edge information.
[0074] S304: Obtain a corresponding first contour feature based on the edge information of the one video frame.
[0075] In one embodiment, the first contour feature includes the position information of the contour, the shape of the contour and the positional relationship between the contours. First, based on the edge information of the one video frame, the position information of the corresponding contour is determined, and then based on the position information of the contour, the shape of the contour and the positional relationship between the contours are determined.
[0076] In one embodiment, if Figure 5 As shown, based on the edge information of the one video frame, determining the position information of the corresponding contour includes the following steps:
[0077] Determine any pixel point in the video frame after the edge detection as the first detection point; determine whether the first detection point is a target pixel point, and the target pixel point is the pixel point where the edge is located; if so, take the first detection point as the center point and traverse the pixel points around the center point in sequence according to the first preset rule to determine whether it is the target pixel point. When the target pixel point is determined, take the target pixel point as the next center point and repeat the above target pixel point determination step until the determined target pixel point is a traversed pixel point or there is no target pixel point around the center point, then determine the next pixel point as the second detection point according to the second preset rule, and repeat the above target pixel point determination step until the pixel points included in the video frame are traversed; if not, determine the next pixel point as the second detection point according to the second preset rule, and repeat the above target pixel point determination step until the pixel points included in the video frame are traversed; determine the position information of the contour corresponding to the edge in each video frame based on the target pixel point.
[0078] It is understandable that the contour corresponding to the edge in the video frame is composed of multiple continuous target pixels. In one embodiment, the background pixels in the video frame after edge detection are all set to 0, and the edge pixels are set to 1, so when a certain pixel is judged to be 1, it is determined that the pixel is the target pixel.
[0079] The first detection point is generally the pixel at the upper left corner of the video frame, and other pixel points can also be selected as the first detection point according to actual needs. If the first detection point is the target pixel point, the first detection point is used as the center point to determine whether the 8 (or 4) pixel points around the center point are the target pixel points in sequence according to the first preset rule, generally in a counterclockwise or clockwise manner.
[0080] If the determined edge is a closed shape, when the determined target pixel is a traversed pixel, it means that the edge has been completely traversed. If the determined edge is an open shape, when there is no target pixel around the center point, it means that the line segments in a certain direction of the edge have been completely traversed.
[0081] The next pixel is determined as the second detection point according to the second preset rule. The detection points are generally determined in a top-down order. The second preset rule can be set according to actual needs. If the next pixel has been confirmed as a target pixel, the pixel is no longer used as a detection point until each pixel included in the video frame after edge detection is traversed.
[0082] The corresponding contours in the video frame can be obtained by combining adjacent target pixels. Each pixel in the video frame has corresponding coordinates. After determining all target pixels in the video frame, the position information of all contours in the video frame can be obtained.
[0083] In one embodiment, in order to facilitate the matching of the first contour feature, different detected contours are labeled.
[0084] It is understandable that different shapes have different characteristics, so the shape of the contour can be confirmed based on the characteristics of the different shapes.
[0085] Assuming that the area of a closed figure (without holes inside) in a video frame is S and the perimeter is C, the circularity of the image is defined as:
[0086]
[0087] If the roundness afa of the closed image is 1, it is judged to be a circular edge.
[0088] If the number of vertices of a quadrilateral edge is 4, it is judged to be a quadrilateral edge.
[0089] The detection methods used for contours of other shapes are similar and will not be described in detail.
[0090] After obtaining all the contours in the video frame, the contour topology can be determined by the positional relationship between the contours. The contour topology refers to the hierarchical relationship between contours, that is, the inclusion relationship. For example, if contour 2 is in the middle of contour 1, the contour topology can be described as "contour 1-contour 2". If there is a contour that has no hierarchical relationship with contour 2 and contour 1, it can be represented on another branch of the topology.
[0091] In an example embodiment, Figure 6 For each video frame after edge detection, its contour topology can be described as “contour B1—contour B2; contour B3”.
[0092] S306: Determine the marker position information corresponding to the one video frame based on the matching relationship between the first contour feature and a preset second contour feature; wherein the second contour feature is obtained based on a reference image containing the marker to be detected.
[0093] The second contour feature is obtained from a reference image containing the mark to be detected. According to the mark to be detected in the reference image, the shape of the contour and the positional relationship between the contours can be determined.
[0094] It can be understood that the first contour feature includes features corresponding to the contour of the mark to be detected, and also includes features corresponding to other irrelevant contours, so it is necessary to determine the contour features of the mark to be detected from the first contour feature. Specifically, in the first contour feature, a third contour feature is determined that matches the shape of the contour included in the second contour feature and matches the positional relationship between the contours included in the second contour feature, and based on the position information of the contour corresponding to the third contour feature, the mark position information corresponding to the one video frame is determined. Through shape matching and positional relationship matching, the mark position information corresponding to the video frame can be quickly determined.
[0095] In one embodiment, before edge detection is performed on one of the video frames, the method further includes the following steps:
[0096] S301: performing binarization processing on one of the video frames to obtain a binary image.
[0097] First, the surveillance video stream is framed, and the obtained video frames are grayed using the weighted average method. In order to make the contrast between different grayscales of the grayscale image stronger, the grayscale image is equalized; then the grayscale histogram is obtained using the binarization algorithm. In order to avoid the interference of impurities in the grayscale histogram, the grayscale histogram is Gaussian filtered.
[0098] The purpose of image binarization is to retain the part of interest in the video frame to the maximum extent. The image binarization method based on grayscale histogram can determine the segmentation threshold through the histogram of the grayscale image. This method is fast, but its threshold selection method is inconsistent for histograms with different features, which limits its application. The threshold selection method based on information entropy is to iterate each threshold, and then determine whether the threshold is the optimal threshold by calculating the sum of the entropy of the two parts after the threshold segmentation. This method is better than the binarization algorithm based on histogram, but the iterative process also makes the algorithm efficiency worrying. For this reason, the present invention improves the image binarization algorithm, combines the grayscale histogram and the entropy concept in information theory to automatically adapt to the threshold selection method of different scenes. This method can have both the binarization algorithm based on histogram and the binarization algorithm based on information entropy. It can adapt to most natural scenes while ensuring speed and the effect is good. The specific method is as follows:
[0099] (1) Obtain the grayscale image histogram and smooth it, and count the grayscale values corresponding to each peak;
[0100] (2) The mean of the grayscale values corresponding to each adjacent peak is used as the candidate segmentation threshold, and then the segmentation threshold corresponding to the maximum value of the sum of the foreground and background entropies after segmentation with each candidate segmentation threshold is selected to select the optimal threshold. The total entropy calculation formula of the image after segmentation with threshold q is as follows:
[0101] H 01 (q)=H0(q)+H1(q)
[0102]
[0103]
[0104] P0(q) and P1(q) represent the cumulative probabilities of background and foreground pixels segmented by the q threshold, respectively, and their sum is 1. t represents the gray value, p(t) represents the probability value of the gray value i, and K represents the number of candidate segmentation thresholds.
[0105] In S206, since the shooting angle of the monitoring camera is fixed, the scene it shoots is also fixed. When the monitored object is motionless, its corresponding mark to be detected is also motionless, so the position of the mark to be detected in the video frame is also motionless. Therefore, the motion state of the monitored object can be determined based on the position information of the mark to be detected in the corresponding video frame.
[0106] It is understandable that the motion state of the monitored object includes being stationary, moving, moving beyond a set distance, etc.
[0107] In one embodiment, the position of the mark to be detected in the initial frame of the monitoring video stream is used as the initial position, and the position of the mark to be detected in other video frames is compared with the initial position. When the two are different, it is determined that the position of the monitored object has changed.
[0108] In one embodiment, an alarm offset threshold is set, and when the offset pixel value between the position of the mark to be detected in other video frames and the initial position exceeds the set alarm offset threshold, an APP warning or a speaker reminder is issued.
[0109] In one embodiment, in order to prevent the moving monitored object from moving to an illegal area, such as farmed animals leaving the breeding area, different areas in the current scene are first divided, mainly into: reasonable activity area, warning activity area, and illegal activity area. When the monitored object moves and moves to the warning activity area or the illegal activity area, an APP warning or a loudspeaker reminder is used.
[0110] It should be understood that although Figure 1-6 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-6 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0111] In one embodiment, if Figure 7 As shown, the present invention provides a target monitoring device, the device comprising:
[0112] An acquisition module, used for acquiring a monitoring video stream, wherein the monitoring video stream contains a monitoring object associated with a mark to be detected;
[0113] A first determination module, used to determine the marker position information corresponding to each video frame in the monitoring video stream, wherein the marker position information is determined based on the position information of the marker to be detected in the corresponding video frame;
[0114] The second determination module is configured to determine the motion state of the monitored object based on the marker position information corresponding to each video frame. In one embodiment, the first determination module includes:
[0115] An edge detection module is used to perform edge detection on one of the video frames to obtain edge information of the one video frame;
[0116] A feature acquisition module, used for obtaining a corresponding first contour feature based on edge information of the one video frame;
[0117] A matching module is used to determine the mark position information corresponding to the one video frame based on the matching relationship between the first contour feature and a preset second contour feature; wherein the second contour feature is obtained based on a reference image containing the mark to be detected.
[0118] In one embodiment, the feature acquisition module includes:
[0119] A first feature acquisition submodule, configured to determine position information of a corresponding contour based on edge information of the one video frame;
[0120] The second feature acquisition submodule is used to determine the shape of the contour and the positional relationship between the contours based on the position information of the contours.
[0121] In one embodiment, the first feature acquisition submodule is specifically used for:
[0122] Determine any pixel point in a video frame after the edge detection as a first detection point;
[0123] Determine whether the first detection point is a target pixel point, where the target pixel point is a pixel point where an edge is located;
[0124] If so, taking the first detection point as the center point, traversing the pixel points around the center point in sequence according to the first preset rule to determine whether it is a target pixel point, when the target pixel point is determined, taking the target pixel point as the next center point, and repeating the above target pixel point determination step, until the determined target pixel point is a traversed pixel point or there is no target pixel point around the center point, then determining the next pixel point as the second detection point according to the second preset rule, repeating the above target pixel point determination step, until the pixel points contained in the video frame are traversed;
[0125] If not, the next pixel point is determined as the second detection point according to the second preset rule, and the above target pixel point determination step is repeated until the pixel points included in the video frame are traversed;
[0126] The position information of the contour corresponding to the edge information in the video frame is determined based on the target pixel point.
[0127] In one embodiment, the matching module is specifically used for:
[0128] In the first contour feature, determining a third contour feature that matches the shape of the contour included in the second contour feature and matches the positional relationship between the contours included in the second contour feature;
[0129] Based on the position information of the contour corresponding to the third contour feature, the marker position information corresponding to the one video frame is determined.
[0130] In one embodiment, it further includes:
[0131] The binarization processing module is used to perform binarization processing on one of the video frames to obtain a binarized image.
[0132] In one embodiment, the binarization processing module is specifically used for:
[0133] Performing grayscale processing on the one video frame to obtain a grayscale histogram;
[0134] Taking the average of the grayscale values corresponding to each adjacent peak in the grayscale histogram as the candidate segmentation threshold;
[0135] Selecting each candidate segmentation threshold to segment the foreground and background of the grayscale histogram, and using the segmentation threshold corresponding to the maximum value of the sum of the foreground and background entropies as the threshold for binarization processing;
[0136] Based on the binarization threshold, the one video frame is binarized to obtain a binarized image.
[0137] For the specific definition of the target monitoring device, please refer to the definition of the method for determining the motion state of the object in the above text, which will not be repeated here. Each module in the above-mentioned object motion state determination device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0138] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, a memory and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store motion detection data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the steps in any of the above-mentioned embodiments of the method for determining the motion state of an object are implemented.
[0139] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0140] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps in any of the above-mentioned methods for determining the motion state of an object are implemented.
[0141] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in any of the above-mentioned methods for determining the motion state of an object are implemented.
[0142] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0143] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0144] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for determining the motion state of an object, characterized in that: The method comprises: Acquire a surveillance video stream, wherein the surveillance video stream contains a surveillance object associated with the mark to be detected; Determine the marker position information corresponding to each video frame in the monitoring video stream, wherein the marker position information is determined based on the position information of the marker to be detected in the corresponding video frame; Determining the motion state of the monitored object based on the marker position information corresponding to each video frame; Wherein, determining the marker position information corresponding to each video frame in the monitoring video stream includes: The following operations are performed for each video frame: Performing binarization processing on one of the video frames to obtain a binarized image; Performing edge detection on the binary image to obtain edge information of the binary image; Based on the edge information of the binary image, a corresponding first contour feature is obtained; Determine the marker position information corresponding to the one video frame based on the matching relationship between the first contour feature and a preset second contour feature; wherein the second contour feature is obtained based on a reference image containing the marker to be detected; The performing binarization processing on one of the video frames to obtain a binarized image comprises: Performing grayscale processing on the one video frame to obtain a grayscale histogram; Taking the average of the grayscale values corresponding to each adjacent peak in the grayscale histogram as the candidate segmentation threshold; Selecting each candidate segmentation threshold to segment the foreground and background of the grayscale histogram, and using the segmentation threshold corresponding to the maximum value of the sum of the foreground and background entropies as the threshold for binarization processing; Based on the binarization threshold, the one video frame is binarized to obtain a binarized image.
2. The method according to claim 1, characterized in that The first contour feature includes the position information of the contour, the shape of the contour and the positional relationship between the contours; the first contour feature corresponding to the edge information of the video frame includes: Based on the edge information of the one video frame, determining position information of a corresponding contour; The shapes of the contours and the positional relationship between the contours are determined based on the positional information of the contours.
3. The method according to claim 2, characterized in that The determining the position information of the corresponding contour based on the edge information of the one video frame comprises: Determine any pixel point in a video frame after the edge detection as a first detection point; Determine whether the first detection point is a target pixel point, where the target pixel point is a pixel point where an edge is located; If so, taking the first detection point as the center point, traversing the pixel points around the center point in sequence according to the first preset rule to determine whether it is a target pixel point, when the target pixel point is determined, taking the target pixel point as the next center point, and repeating the above target pixel point determination step, until the determined target pixel point is a traversed pixel point or there is no target pixel point around the center point, then determining the next pixel point as the second detection point according to the second preset rule, repeating the above target pixel point determination step, until the pixel points contained in the video frame are traversed; If not, the next pixel point is determined as the second detection point according to the second preset rule, and the above target pixel point determination step is repeated until the pixel points included in the video frame are traversed; The position information of the contour corresponding to the edge information in the video frame is determined based on the target pixel point.
4. The method according to claim 1, characterized in that: The determining, based on the matching relationship between the first contour feature and the preset second contour feature, the marker position information corresponding to the one video frame comprises: In the first contour feature, determining a third contour feature that matches the shape of the contour included in the second contour feature and matches the positional relationship between the contours included in the second contour feature; Based on the position information of the contour corresponding to the third contour feature, the marker position information corresponding to the one video frame is determined.
5. A device for determining the motion state of an object, characterized in that: The device comprises: An acquisition module, used for acquiring a monitoring video stream, wherein the monitoring video stream contains a monitoring object associated with the mark to be detected; A first determination module, used to determine the marker position information corresponding to each video frame in the monitoring video stream, wherein the marker position information is determined based on the position information of the marker to be detected in the corresponding video frame; A second determination module, configured to determine the motion state of the monitored object based on the marker position information corresponding to each video frame; A binarization processing module, used for performing binarization processing on one of the video frames to obtain a binarized image; Wherein, the first determining module includes: An edge detection module, used to perform edge detection on the binary image to obtain edge information of the binary image; A feature acquisition module, used for obtaining a corresponding first contour feature based on edge information of the binary image; A matching module, configured to determine the marker position information corresponding to the one video frame based on a matching relationship between the first contour feature and a preset second contour feature; wherein the second contour feature is obtained based on a reference image containing the marker to be detected; The binarization processing module is specifically used to: perform grayscale processing on the one video frame to obtain a grayscale histogram; use the average of the grayscale values corresponding to each adjacent peak in the grayscale histogram as a candidate segmentation threshold; select the foreground and background of the grayscale histogram to be segmented using each candidate segmentation threshold, and use the segmentation threshold corresponding to the maximum value of the sum of the foreground and background entropies as the threshold for binarization processing; based on the threshold for binarization processing, perform binarization processing on the one video frame to obtain a binary image.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Moving object detection method capable of automatically adapting to complex scenes
CN105261037A
Marker-based identification method
CN107240115A
Glowworm swarm optimization method-based image multi-threshold segmentation method
CN107590815A
Leaf area index extraction threshold segmentation method based on optical image
CN109859231A
Target identification and positioning method based on edge feature detection
CN110070557A
