A motion state determination method, system, electronic device, and storage medium
By constructing a historical displacement matrix and calculating the vector offset angle of relative displacement distance and motion direction, the problem of difficulty in determining the motion state in target detection when the signal is unstable is solved, and accurate motion state determination is achieved under conditions such as occlusion.
Patent Information
- Application Number
- CN202211527740.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-29
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2042-11-29
AI Technical Summary
In the target detection process, existing technologies struggle to accurately determine the motion state of the target when signal acquisition is unstable.
By acquiring at least three target image frames, the relative displacement of the detected target between any two target image frames is calculated, a historical displacement matrix is constructed, and the vector offset angle of the historical relative displacement distance and motion direction is obtained based on the historical displacement matrix to determine the motion state of the detected target.
Even under conditions of occlusion, it can accurately determine the motion state of the detected target, improving the stability and accuracy of motion state determination.
Smart Images

Figure CN116051595B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of target detection and target tracking, and particularly relates to a motion state determination method and system, an electronic device and a storage medium. BACKGROUND
[0002] With the maturity and popularity of image processing, target detection and target tracking are also paid more and more attention in intelligent transportation construction. The current technology usually obtains a motion state signal of a detection target to determine a motion state category of the detection target.
[0003] In the research and practice of the current technology, the present inventors find that in the determination of the motion state of the detection target, the current technology usually determines the motion state of the detection target by obtaining a visual signal and a radar signal. When the signal acquisition is unstable, the motion state of the detection target is difficult to determine. SUMMARY
[0004] The present application mainly solves the technical problem of providing a motion state determination method and system, an electronic device and a storage medium, which can construct a historical displacement matrix according to a relative displacement of a detection target, obtain a motion direction corresponding to each historical relative displacement distance and a vector offset angle corresponding to each pair of motion directions based on the historical relative displacement distance in the historical displacement matrix, and then determine the motion state of the detection target.
[0005] To solve the above technical problem, one technical solution adopted by the present application is to provide a motion state determination method, which comprises: obtaining at least three target image frames; obtaining position information corresponding to a detection target according to the at least three target image frames to determine a relative displacement of the detection target between any two target image frames; constructing a historical displacement matrix according to the relative displacement, and obtaining a historical relative displacement distance based on the historical displacement matrix; obtaining a motion direction corresponding to each historical relative displacement distance and a vector offset angle corresponding to each pair of motion directions based on the historical relative displacement distance, and then determining the motion state of the detection target.
[0006] In an embodiment of the present application, the obtaining the motion direction corresponding to each of the historical relative displacement distances and the vector offset angle corresponding to each two of the motion directions comprises: obtaining an X-axis distance parameter, a Y-axis distance parameter and a straight line distance parameter corresponding to the relative displacement, and an X-axis displacement threshold corresponding to the X-axis distance parameter, a Y-axis displacement threshold corresponding to the Y-axis distance parameter and a straight line displacement threshold corresponding to the straight line distance parameter; determining a target historical relative displacement distance when any distance parameter in the historical relative displacement distances exceeds the corresponding displacement threshold; obtaining the motion direction corresponding to each of the historical relative displacement distances, and obtaining the vector offset angle corresponding to each two of the motion directions when the number of the target historical relative displacement distances does not exceed a first preset number.
[0007] In an embodiment of the present application, the obtaining the motion direction corresponding to each of the historical relative displacement distances comprises: counting the number of the motion directions in each quadrant; and determining that the motion state of the detection target is moving when the number of the motion directions in any one of the quadrants exceeds a second preset number and the number of the motion directions in the other three quadrants is 0.
[0008] In an embodiment of the present application, after counting the number of the motion directions in each quadrant, the motion state determination method further comprises: obtaining the vector offset angle corresponding to each two of the motion directions when the number of the motion directions in all the quadrants does not exceed the second preset number; and determining that the motion state of the detection target is moving when the number of the motion directions in any two of the quadrants is 0 and the vector offset angle is less than or equal to a preset angle threshold.
[0009] In an embodiment of the present application, after obtaining the vector offset angle corresponding to each two of the motion directions, the motion state determination method further comprises: determining that the motion state of the detection target is static when the number of the motion directions in any two of the quadrants does not exceed a third preset number or the vector offset angle is greater than a preset angle threshold.
[0010] In an embodiment of the present application, after determining the target historical relative displacement distance, the motion state determination method further comprises: determining that the motion state of the detection target is moving when the number of the target historical relative displacement distances exceeds a first preset number.
[0011] In an embodiment of the present application, after determining the motion state of the detection target, the method further comprises: if the detection target is in a moving motion state, counting the number of image frames corresponding to the moving motion state; and outputting motion over-speed alarm information of the detection target when the number of image frames corresponding to the moving motion state is less than a preset motion frame threshold.
[0012] In an embodiment of the present application, after determining the motion state of the detection target, the method further comprises: if the detection target is in a stationary motion state, counting the number of image frames corresponding to the stationary motion state; and outputting stationary timeout alarm information of the detection target when the number of image frames corresponding to the stationary motion state exceeds a preset stationary frame threshold.
[0013] In an embodiment of the present application, the obtaining of the at least three target image frames comprises: obtaining a to-be-recognized image frame; performing target detection and target matching and association tracking on the to-be-recognized image frame to obtain a detection target, so as to determine a target image frame.
[0014] In an embodiment of the present application, the constructing of the historical displacement matrix according to the relative displacement comprises: obtaining an X-axis distance parameter, a Y-axis distance parameter, and a straight-line distance parameter of the relative displacement; and establishing an N*N*3-dimensional historical displacement matrix based on the X-axis distance parameter, the Y-axis distance parameter, and the straight-line distance parameter.
[0015] To solve the above technical problems, another technical solution adopted by the present application is to provide a motion state determination system, comprising an image acquisition module, a target detection module, a historical displacement matrix construction module, and a motion state determination module; wherein the image acquisition module is configured to obtain at least three target image frames; the target detection module is configured to obtain position information corresponding to a detection target based on the at least three target image frames, so as to determine a relative displacement of the detection target between any two target image frames; the historical displacement matrix construction module is configured to construct a historical displacement matrix based on the relative displacement, and obtain a historical relative displacement distance based on the historical displacement matrix; and the motion state determination module is configured to obtain a motion direction corresponding to each of the historical relative displacement distances and a vector offset angle corresponding to two of the motion directions based on the historical relative displacement distance, and further determine a motion state of the detection target.
[0016] To solve the above technical problems, still another technical solution adopted by the present application is to provide an electronic device, comprising a memory and a processor coupled with the memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the motion state determination method as described above.
[0017] To solve the above technical problems, the application adopts another technical solution: providing a computer readable storage medium, the computer readable storage medium has at least one program, the at least one program is loaded and executed by a processor, and is used to realize the motion state determination method.
[0018] Different from the prior art, the motion state determination method provided by the application comprises: acquiring at least three target image frames; acquiring position information corresponding to a detection target according to the at least three target image frames to determine the relative displacement of the detection target between any two target image frames; constructing a historical displacement matrix according to the relative displacement, and acquiring a historical relative displacement distance based on the historical displacement matrix; and determining the motion state of the detection target based on the number of historical relative displacement distances exceeding a distance threshold. That is, the application constructs a historical displacement matrix through the relative displacement of the detection target, so that the historical relative displacement distance can be acquired according to the historical displacement matrix even if occlusion or the like occurs, and then the motion direction corresponding to each historical relative displacement distance and the vector offset angle corresponding to each pair of motion directions are acquired according to the historical relative displacement distance, and the motion state of the detection target is determined. BRIEF DESCRIPTION OF DRAWINGS
[0019] Figure 1 is a flowchart of an embodiment of the motion state determination method of the application;
[0020] Figure 2 is a flowchart of an embodiment of step S1 of the application;
[0021] Figure 3 is a flowchart of an embodiment of step S3 of the application;
[0022] Figure 4 is a flowchart of an embodiment of step S4 of the application;
[0023] Figure 5 is a flowchart of an embodiment of step S43 of the application;
[0024] Figure 6 is a flowchart of an embodiment of the application after the number of motion directions in each quadrant is counted;
[0025] Figure 7 is a flowchart of an embodiment of the application after the motion state of the detection target is determined;
[0026] Figure 8 is a flowchart of another embodiment of the application after the motion state of the detection target is determined;
[0027] Figure 9 is a structural diagram of an embodiment of the motion state determination system of the application;
[0028] Figure 10 is a structural schematic diagram of an embodiment of an electronic device of the present application.
[0029] Figure 11 is a structural schematic diagram of an embodiment of a computer readable storage medium of the present application. DETAILED DESCRIPTION
[0030] The application will be described in further detail below with reference to the drawings and embodiments. It is particularly pointed out that the following embodiments are only for illustrating the application, but do not limit the scope of the application. Similarly, the following embodiments are only part of the embodiments of the application, but not all embodiments of the application. All other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the application.
[0031] In this paper, the phrase "embodiment" means that the specific features, structures or characteristics described in connection with the embodiment can be included in at least one embodiment of the application. The phrase appears at various places in the specification does not necessarily refer to the same embodiment, nor is it independent or alternative to other embodiments. Those skilled in the art explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0032] The current motion state determination method, especially in the process of intelligent transportation construction, for the determination of the motion state of the vehicle, usually needs multiple signals to determine together, such as visual signal and radar signal, if the signal acquisition is unstable, etc., the error of the determination result is large.
[0033] Therefore, a motion state determination method is proposed, which constructs a history displacement matrix by detecting the relative displacement of the target, so that even if there is occlusion, etc., the history relative displacement distance can be obtained according to the history displacement matrix, and then the motion direction corresponding to each history relative displacement distance and the vector offset angle corresponding to each pair of motion directions are obtained according to the history relative displacement distance, and then the motion state of the detection target is determined.
[0034] Please refer to Figure 1 , Figure 1 is a flowchart of an embodiment of the motion state determination method of the present application; it should be noted that the method of the present application is not limited to the flow order shown in Figure 1 , such as Figure 1 , the motion state determination method comprises the following steps:
[0035] S1, obtaining at least three target image frames;
[0036] The target image frames are image frames containing the detection target. Since the relative displacement of the detection target in each two image frames needs to be obtained, at least three target image frames are needed to compare the relative displacement.
[0037] Specifically, at least three image frames containing the detection target are obtained through target detection and target tracking.
[0038] In some embodiments, the at least three target image frames can be continuous or discontinuous target image frames.
[0039] In some embodiments, if the occlusion occurs, at least one target image frame is a target image frame before the occlusion occurs, and at least one target image frame is a target image frame after the occlusion ends.
[0040] Please refer to Figure 2 , Figure 2 is a flowchart of an embodiment of step S1 of the present application. In order to accurately obtain the target image frames, the image frames to be recognized need to be preprocessed. Step S1 includes:
[0041] S11, obtaining an image frame to be recognized;
[0042] The image frame to be recognized is a real-time obtained image frame.
[0043] Specifically, real-time video data is obtained through a video acquisition module, and the image frame to be recognized is obtained by pre-processing the real-time video data through an image preprocessing module.
[0044] In some embodiments, the video acquisition module can be a high-position rifle camera, a television device, a cloud platform, or the like, which can collect video data.
[0045] In some embodiments, the preprocessing can include grayscale processing, Gaussian filtering, and other image processing methods.
[0046] S12, performing target detection and target matching associated tracking on the image frame to be recognized to obtain a detection target, so as to determine the target image frame.
[0047] The target detection on the image frame to be recognized is to obtain the real-time position information of the detection target in the image frame, and the target matching associated tracking on the image frame to be recognized is to obtain the positional relationship of the detection target between different image frames.
[0048] Specifically, the target detection module is used to detect the to-be-recognized image frame to detect real-time position information of a detection target, and the target tracking module is used to track the detection target in continuous image frames, and a separate ID is assigned to each detection target to determine the position relationship of each detection target between different image frames, and then the corresponding target image frame is determined according to the detection target.
[0049] In some embodiments, the real-time position information is (x i ,y i ,w i ,h i ), i = 1, …, N, wherein x i is the x-axis coordinate of the detection target in the current image frame, y i is the y-axis coordinate of the detection target in the current image frame, w i is the image width of the current image frame, and h i is the image height of the current image frame.
[0050] S2, acquiring position information corresponding to the detection target according to at least three target image frames to determine the relative displacement of the detection target between any two target image frames;
[0051] The position information corresponding to the detection target corresponds to the real-time position information of the detection target in each target image frame, and the real-time position information of the detection target in each target image frame is different in the case of movement, so that the relative displacement of the detection target between any two target detection frames can be determined.
[0052] Specifically, for the acquired at least three target image frames, the position information (x i ,y i ,w i ,h i ) corresponding to the detection target in each target image frame is acquired, and the relative displacement (Δx, Δy, Δl) of the detection target between different target image frames is determined based on the position information, wherein Δx is the x-axis displacement distance of the detection target between different target image frames, Δy is the y-axis displacement distance of the detection target between different target image frames, and Δl is the straight-line displacement distance of the detection target between different target image frames.
[0053] In some embodiments, the target image frame is at least three, such as three or five or ten target image frames, etc.
[0054] For example, if the detection target is a target vehicle and the target images are three, the first target image frame, the second target image frame and the third target image frame containing the target vehicle are obtained, and the first position information (x1, y1, w1, h1) corresponding to the target vehicle in the first target image frame, the second position information (x2, y2, w2, h2) corresponding to the target vehicle in the second target image frame and the third position information (x3, y3, w3, h3) corresponding to the target vehicle in the third target image frame are obtained. Then, the relative displacement of the target vehicle between the first target image frame and the second target image frame is obtained according to the first position information (x1, y1, w1, h1) and the second position information (x2, y2, w2, h2):
[0055]
[0056] The relative displacement of the target vehicle between the first target image frame and the third target image frame is obtained according to the first position information (x1, y1, w1, h1) and the third position information (x2, y2, w2, h2):
[0057]
[0058] The relative displacement of the target vehicle between the second target image frame and the third target image frame is obtained according to the second position information (x2, y2, w2, h2) and the third position information (x3, y3, w3, h3):
[0059]
[0060] If the target images are five or ten, etc., the corresponding data can be obtained by analogy.
[0061] S3, constructing a historical displacement matrix according to the relative displacements, and obtaining a historical relative displacement distance based on the historical displacement matrix;
[0062] The relative displacement is the position relationship of the detection target between two target image frames. The historical displacement matrix is a matrix established according to a plurality of relative displacements. The historical relative displacement distance is a judgment distance obtained from the historical displacement matrix according to the relative displacement.
[0063] Specifically, the relative displacement between two target image frames is obtained. Based on a plurality of relative displacements, the motion trajectory of the detection target in a plurality of target image frames can be obtained. Then, the historical displacement matrix is constructed according to the motion trajectory. Based on the historical displacement matrix, the motion trajectory of the detection target can be extended to obtain other target image frames. Then, the historical relative displacement distance between the other target image frames and the obtained target image frames, or the historical relative displacement distance between two other target image frames, is obtained.
[0064] Please refer toFigure 3 , Figure 3 is a flowchart of an embodiment of step S3 of the present application, in order to determine whether the detection target is in motion, corresponding judgment is made by displacement threshold, step S3 includes:
[0065] S31, obtain the X-axis distance parameter, the Y-axis distance parameter and the straight line distance parameter of the relative displacement;
[0066] The relative displacement indicates the displacement relationship of the detection target between two target image frames, therefore, after obtaining the relative displacement of each pair of target image frames, the corresponding X-axis distance parameter, Y-axis distance parameter and straight line distance parameter of the detection target in each pair of target image frames can be obtained.
[0067] Specifically, the relative displacement of the detection target in two target image frames is obtained to determine the X-axis displacement distance, Y-axis displacement distance and straight line displacement distance of the detection target in the two target image frames, i.e., the X-axis distance parameter Δx, the Y-axis distance parameter Δy and the straight line distance parameter Δl corresponding to the relative displacement,
[0068] For example, in the case of occlusion, if the first target image frame and the second target image frame are target image frames before the occlusion occurs, and the third target image frame and the fourth target image frame are target image frames after the occlusion ends; the first position information (x1, y1, w1, h1) corresponding to the target vehicle in the first target image frame, the second position information (x2, y2, w2, h2) corresponding to the target vehicle in the second target image frame, the third position information (x3, y3, w3, h3) corresponding to the target vehicle in the third target image frame and the fourth position information (x4, y4, w4, h4) corresponding to the target vehicle in the fourth target image frame are obtained; and then the first relative displacement of the target vehicle between the first target image frame and the second target image frame is obtained according to the first position information (x1, y1, w1, h1) and the second position information (x2, y2, w2, h2):
[0069]
[0070] wherein, is the X-axis distance parameter of the first relative displacement, is the Y-axis distance parameter of the first relative displacement, is the straight line distance parameter of the first relative displacement.
[0071] The second relative displacement of the target vehicle between the first target image frame and the third target image frame is obtained according to the first position information (x1, y1, w1, h1) and the third position information (x3, y3, w3, h3):
[0072]
[0073] wherein, is an X-axis distance parameter of the second relative displacement, is a Y-axis distance parameter of the second relative displacement, is a straight-line distance parameter of the second relative displacement.
[0074] According to the first position information (x1, y1, w1, h1) and the fourth position information (x4, y4, w4, h4), a third relative displacement of the target vehicle between the first target image frame and the fourth target image frame is obtained:
[0075]
[0076] wherein, is an X-axis distance parameter of the third relative displacement, is a Y-axis distance parameter of the third relative displacement, is a straight-line distance parameter of the third relative displacement.
[0077] According to the second position information (x2, y2, w2, h2) and the third position information (x3, y3, w3, h3), a fourth relative displacement of the target vehicle between the second target image frame and the third target image frame is obtained:
[0078]
[0079] wherein, is an X-axis distance parameter of the fourth relative displacement, is a Y-axis distance parameter of the fourth relative displacement, is a straight-line distance parameter of the fourth relative displacement.
[0080] According to the second position information (x2, y2, w2, h2) and the fourth position information (x4, y4, w4, h4), a fifth relative displacement of the target vehicle between the second target image frame and the third target image frame is obtained:
[0081]
[0082] wherein, is an X-axis distance parameter of the fifth relative displacement, is a Y-axis distance parameter of the fifth relative displacement, is a straight-line distance parameter of the fifth relative displacement.
[0083] According to the third position information (x3, y3, w3, h3) and the fourth position information (x4, y4, w4, h4), a sixth relative displacement of the target vehicle between the third target image frame and the fourth target image frame is obtained:
[0084]
[0085] wherein, is an X-axis distance parameter of the sixth relative displacement, is a Y-axis distance parameter of the sixth relative displacement, is a straight-line distance parameter of the sixth relative displacement.
[0086] When no occlusion occurs, four target image frames are acquired, that is, a first target image frame, a second target image frame, a third target image frame and a fourth target image frame containing the target vehicle are acquired; the processing steps are as described above for the case of occlusion occurrence, which will not be described here.
[0087] S32, establishing an N*N*3-dimensional historical displacement matrix based on the X-axis distance parameter, the Y-axis distance parameter and the straight-line distance parameter.
[0088] wherein, the dimension of the historical displacement matrix is determined based on the number of acquired target image frames and the number of relative displacement parameters.
[0089] Specifically, the dimension of the historical displacement matrix is determined based on the square of the number of target image frames and the product of the number of relative displacement parameters; in the case of occlusion occurrence, if the first target image frame and the second target image frame are target image frames before the occurrence of occlusion, and the third target image frame and the fourth target image frame are target image frames after the end of occlusion, then the historical relative displacement distance of the detection target in the occlusion process can be calculated according to the historical displacement matrix based on the relative displacement.
[0090] For example, the number of acquired target image frames is 4, and the number of relative displacement parameters is 3, then the dimension of the historical displacement matrix is 4*4*3; the second position information (x2, y2, w2, h2) of the target vehicle in the second target image frame, the third position information (x3, y3, w3, h3) of the target vehicle in the third target image frame, and the fifth position information (x5, y5, w5, h5) of the target vehicle in the fifth target image frame, then the fifth position information of the target vehicle in the fifth target image frame can be obtained according to the motion distance, motion time and motion speed of the second position information and the third position information.
[0091] That is, through the historical displacement matrix, the position information of the detection target corresponding to the unknown target image frame before and after the acquired target image frame can be inferred, and the corresponding historical relative displacement distance is obtained, and the motion state of the detection target is determined.
[0092] S4, based on the historical relative displacement distance, the motion direction corresponding to each historical relative displacement distance and the vector offset angle corresponding to each pair of motion directions are obtained, and the motion state of the detection target is determined.
[0093] The historical relative displacement distance includes a corresponding X-axis distance parameter, a Y-axis distance parameter and a straight-line distance parameter; a distance threshold is set for the movement of the detection target, and after the distance threshold is exceeded, the movement direction corresponding to each historical relative displacement distance and the vector offset angle corresponding to each pair of movement directions are obtained, and then the movement state of the detection target is determined.
[0094] Specifically, the N target image frames are calculated according to the obtained The more the number of historical relative displacement distances exceeding the distance threshold, the more target image frames in which the detection target moves, that is, the more times the detection target moves, and thus the movement state of the detection target can be determined.
[0095] Referring to Figure 4 , Figure 4 is a flowchart of an embodiment of step S4 of the present application. In order to determine whether the detection target moves, the displacement threshold is used for corresponding judgment, and step S4 includes:
[0096] S41, obtaining an X-axis distance parameter, a Y-axis distance parameter and a straight-line distance parameter corresponding to the relative displacement, and an X-axis displacement threshold corresponding to the X-axis distance parameter, a Y-axis displacement threshold corresponding to the Y-axis distance parameter and a straight-line displacement threshold corresponding to the straight-line distance parameter;
[0097] The X-axis displacement threshold is used for comparing the X-axis distance parameter to determine whether the X-axis distance parameter corresponding to the historical relative displacement distance exceeds the X-axis displacement threshold; the Y-axis displacement threshold is used for comparing the Y-axis distance parameter to determine whether the Y-axis distance parameter corresponding to the historical relative displacement distance exceeds the Y-axis displacement threshold; and the straight-line displacement threshold is used for comparing the straight-line distance parameter to determine whether the straight-line distance parameter corresponding to the historical relative displacement distance exceeds the straight-line displacement threshold.
[0098] Specifically, the X-axis displacement threshold is determined based on the image width of the current target image frame and the first resolution, the Y-axis displacement threshold is determined based on the image height of the current target image frame and the second resolution, and the straight-line displacement threshold is determined based on the image height, the image width and the third resolution of the current target image frame.
[0099] For example, generally, the resolution of the current video picture is 1920*1080, 640*540, etc. The embodiment takes the video picture size of 1920*1080 and the detection target comparison standard size of 640*540 as an example for description, and sets the first parameter value as 2203, the second parameter value as 837, and the third parameter value as 100 according to the project requirement. The first parameter value, the second parameter value, and the third parameter value can be set according to the project requirement. The image height of the current target image frame is iheight, and the image width of the current target image frame is iwidth. Then, the following is obtained:
[0100] threshold Δx =[iwidth / (2*1920)]*(w i / 640)*(iwidth / 100)
[0101] threshold Δy =[iheight / (2*1080)]*(h i / 540)*(iheight / 100)
[0102]
[0103] threshold Δx is the X-axis displacement threshold, threshold Δy is the Y-axis displacement threshold, threshold Δl is the straight-line displacement threshold, il is the image diagonal length of the current target image frame, w i is the width of the detection target in the current target image frame, and h i is the height of the detection target in the current target image frame.
[0104] S42, when any distance parameter in the historical relative displacement distance exceeds the corresponding displacement threshold, determining the target historical relative displacement distance;
[0105] The historical relative displacement distance contains the X-axis distance parameter, the Y-axis distance parameter, and the straight-line distance parameter.
[0106] Specifically, the X-axis distance parameter, the Y-axis distance parameter, and the straight-line distance parameter in each historical relative displacement distance are obtained. When any distance parameter exceeds the corresponding displacement threshold, the historical relative displacement distance is determined as the target historical relative displacement distance.
[0107] For example, if 4 target image frames are acquired, there are 6 historical relative displacement distances, if only the X-axis distance parameter in the first historical relative displacement distance exceeds the corresponding X-axis displacement threshold, the first target historical relative displacement distance is obtained; if the Y-axis distance parameter and the straight line distance parameter in the second historical relative displacement distance exceed the corresponding Y-axis displacement threshold and the straight line displacement threshold, the second target historical relative displacement distance is obtained; if the third, fourth and fifth historical relative displacement distances do not have distance parameters exceeding the corresponding displacement threshold, none of them is a target historical relative displacement distance; if the straight line distance parameter in the sixth historical relative displacement distance exceeds the corresponding straight line displacement threshold, the third target historical relative displacement distance is obtained.
[0108] S43, when the number of target historical relative displacement distances does not exceed the first preset number, the motion direction corresponding to the historical relative displacement distance is acquired, and the vector offset angle corresponding to the two motion directions is acquired.
[0109] Wherein, the more the number of target historical relative displacement distances, the greater the possibility of detecting target motion, if the number of target historical relative displacement distances does not exceed the preset number, it is indicated that the displacement threshold is not used to determine whether the detection target is in motion, so the motion direction corresponding to the historical relative displacement distance is acquired to determine whether the detection target is in motion.
[0110] Specifically, N target image frames are acquired, there are historical relative displacement distances, target historical relative displacement distances are acquired, when the number of target historical relative displacement distances does not exceed N-1, the motion direction corresponding to all historical relative displacement distances is acquired, and one vector offset angle corresponding to the two motion directions is acquired, so that the vector offset angle corresponding to the two motion directions can be acquired after the motion direction corresponding to the historical relative displacement distance is acquired.
[0111] For example: if 4 target image frames are acquired, the detection target will appear 4 positions in the continuous image, and there will be a vector between the two positions, so that the detection target will have 6 vectors in the case of motion, and there are 6 historical relative displacement distances, target historical relative displacement distances are acquired, when the number of target historical relative displacement distances does not exceed 3, the motion direction corresponding to all 6 historical relative displacement distances is acquired, and 5 vector offset angles are acquired.
[0112] In an embodiment, after determining the target historical relative displacement distance, the motion state determination method further comprises: when the number of target historical relative displacement distances exceeds the first preset number, determining that the motion state of the detection target is in motion.
[0113] The more the number of target historical relative displacement distances is, the greater the possibility of detecting the target motion is.
[0114] Specifically, N target image frames are acquired, and there are target historical relative displacement distances are acquired, and when the number of target historical relative displacement distances exceeds N-1, it is determined that the motion state of the detection target is moving.
[0115] For example, 4 target image frames are acquired, there are 6 historical relative displacement distances, target historical relative displacement distances are acquired, and when the number of target historical relative displacement distances exceeds 3, it is determined that the motion state of the detection target is moving.
[0116] Please refer to Figure 5 , Figure 5 is a flowchart of an embodiment of step S43 of the present application. Sometimes, the target is moving slowly and cannot be simply determined whether it is moving or not by the displacement threshold. Therefore, if the target displacement satisfies the motion threshold, the direction of the target motion can be counted. For a certain length of historical trajectory, the motion direction of the moving target is probably the same direction. The fluctuation of the detection frame of the stationary target is probably chaotic. Therefore, in order to avoid the situation that the detection target moves slowly and the detection is inaccurate, after the motion direction corresponding to the historical relative displacement distance is acquired when the number of target historical relative displacement distances does not exceed the first preset number, the motion direction judgment is added. Step S43 includes:
[0117] S431, counting the number of motion directions in each quadrant.
[0118] The first target image is taken as the origin, and divided into four quadrants, first quadrant, second quadrant, third quadrant and fourth quadrant.
[0119] Specifically, after the motion direction corresponding to all historical relative displacement distances is acquired, each quadrant is divided, and the number of motion directions in each quadrant is counted.
[0120] S432, when the number of motion directions in any quadrant exceeds the second preset number, and the number of motion directions in the other three quadrants is 0, it is determined that the motion state of the detection target is moving.
[0121] The first target image is taken as the origin, and divided into four quadrants, first quadrant, second quadrant, third quadrant and fourth quadrant.
[0122] Specifically, N target image frames are acquired, and there are If the number of motion directions in any quadrant exceeds N-1 and the number of motion directions in the other three quadrants is 0, it indicates that the motion direction of the detection target is mainly in the quadrant, and it can be determined that the motion state of the detection target is moving.
[0123] For example, if 4 target image frames are acquired, there are 6 historical relative displacement distances, and the number of motion directions in each quadrant is acquired. If the number of motion directions in the first quadrant exceeds 3 and the number of motion directions in the other three quadrants is 0, it indicates that the detection target is moving based on the motion direction in the first quadrant.
[0124] Please refer to Figure 6 , Figure 6 is a flowchart of an embodiment of the present application after the number of motion directions in each quadrant is counted. In order to further determine the motion state of the detection target, the judgment of the vector offset angle is added, including:
[0125] S433, when the number of motion directions in all quadrants does not exceed the second preset number, the vector offset angle corresponding to each pair of motion directions is acquired.
[0126] Among them, a preset number is set. If the motion direction cannot determine whether the detection target is moving, then whether the number of motion directions in each quadrant exceeds the preset number is used to determine the quadrant with more motion directions. If the motion direction is more, it indicates that the detection target moves along the motion direction of the quadrant.
[0127] Specifically, N target image frames are acquired, and there are historical relative displacement distances. The number of motion directions in each quadrant is acquired. Since there may be no motion of the detection target in some target image frames, the number of motion directions can be less than N. If the number of motion directions in all quadrants does not exceed N-1, the vector offset angle corresponding to each pair of motion directions is acquired to determine whether the detection target is moving.
[0128] For example, if 4 target image frames are acquired, there are 6 historical relative displacement distances, corresponding to 6 motion directions. The number of motion directions in each quadrant is acquired. If the number of motion directions in all quadrants does not exceed 3, the vector corresponding to each pair of motion directions is acquired, and there are 5 vectors. Then, the vector offset angle is acquired according to the vector. Each two vectors correspond to a vector offset angle, and there are 4 vector offset angles.
[0129] S434, when the number of motion directions in any two quadrants is 0 and the vector offset angle is less than or equal to the preset angle threshold, it is determined that the motion state of the detection target is moving.
[0130] The preset angle threshold is used for judging the vector offset angle. Due to the interaction of forces, two forces can be combined into one force within a certain preset angle threshold range. Similarly, two movement directions correspond to two forces, and when the two movement directions are within a certain preset angle threshold range, they can be combined into one movement direction.
[0131] Specifically, N target image frames are acquired, and there are historical relative displacement distances, corresponding to movement directions. The number of movement directions in each quadrant and the vector offset angle corresponding to each pair of movement directions are acquired. If the movement directions in two quadrants are 0, the vector offset angle is less than or equal to the preset angle threshold, the number of vector offset angles less than or equal to the preset angle threshold is greater than or equal to N-2, and the movement state of the detection target is determined to be moving.
[0132] For example, 4 target image frames are acquired, and there are 6 historical relative displacement distances, corresponding to 6 movement directions. The number of movement directions in each quadrant and the vector offset angle corresponding to each pair of movement directions are acquired. If the movement directions in the first quadrant and the second quadrant are 0, there are movement directions in the third quadrant and the fourth quadrant, and the number of vector offset angles less than or equal to 90° is greater than or equal to 2, the movement state of the detection target is determined to be moving.
[0133] In an embodiment, after acquiring the vector offset angle corresponding to each pair of movement directions, the movement state determination method further comprises:
[0134] If the number of movement directions in any two quadrants does not exceed the third preset number, or the vector offset angle is greater than the preset angle threshold, the movement state of the detection target is determined to be stationary.
[0135] The stationary movement state refers to not meeting the above movement conditions.
[0136] Specifically, N target image frames are acquired, and there are historical relative displacement distances, corresponding to movement directions. The number of movement directions in each quadrant and the vector offset angle corresponding to each pair of movement directions are acquired. If the number of movement directions in any two quadrants does not exceed N-1, or the vector offset angle is greater than 90°, or the number of vector offset angles less than or equal to 90° is less than N-2, the movement state of the detection target is determined to be stationary.
[0137] For example, if 4 target image frames are acquired, there are 6 historical relative displacement distances, corresponding to 6 motion directions, the number of motion directions in each quadrant is acquired, and the corresponding vector offset angle. If the number of target historical relative displacement distances is less than 3, or the number of motion directions in all quadrants is less than 3, or the vector offset angle is greater than 90°, or the number of vector offset angles less than or equal to 90° is less than N-2, it is a motion state of detecting a stationary target.
[0138] Referring to Figure 7 , Figure 7 is a flowchart of an embodiment of the present application after determining the motion state of the detection target, comprising:
[0139] T1, if the detection target is in a moving motion state, the number of image frames corresponding to the moving motion state is counted.
[0140] Wherein, for the moving detection target, the speed of the detection target can be determined by counting the number of image frames corresponding to the motion state.
[0141] Specifically, based on the above motion state determination, if the detection target is in a moving motion state, the number of image frames of the detection target motion state is counted.
[0142] T2, when the number of image frames corresponding to the moving motion state is less than the preset motion frame threshold, output the motion overspeed alarm information of the detection target.
[0143] Wherein, the preset motion frame threshold is used to judge the size of the number of image frames corresponding to the moving motion state. If the number of image frames corresponding to the moving motion state is small, it means that the speed of the detection target in the period is large, so the number of acquired image frames is small.
[0144] Specifically, a preset motion frame threshold is set. If the number of image frames corresponding to the moving motion state is greater than the preset motion frame threshold, the speed of the detection target in the period is small, which belongs to normal driving. If the number of image frames corresponding to the moving motion state is less than the preset motion frame threshold, the speed of the detection target in the period is large, which belongs to overspeed motion, therefore, the motion overspeed alarm information of the detection target is output.
[0145] Referring to Figure 8 , Figure 8 is a flowchart of another embodiment of the present application after determining the motion state of the detection target, comprising:
[0146] U1, if the detection target is in a stationary motion state, the number of image frames corresponding to the stationary motion state is counted.
[0147] Wherein, for the detection target in the static state, the number of image frames in the static state is counted to determine whether the temporary parking of the detection target exceeds the time limit or is illegal parking.
[0148] Specifically, based on the above motion state determination, if the detection target is in the static state, the number of image frames in the static state of the detection target is counted.
[0149] U2, when the number of image frames corresponding to the static state exceeds the preset static frame threshold, outputting the static timeout alarm information of the detection target.
[0150] Wherein, the preset static frame threshold is used to determine the number of image frames corresponding to the static state, and if the number of image frames corresponding to the static state is large, it means that the detection target belongs to stop motion or small range motion in the period, so the number of image frames obtained is large.
[0151] Specifically, a preset static frame threshold is set, if the number of image frames corresponding to the static state exceeds the preset motion frame threshold, the speed of the detection target is small in the period, which belongs to small range motion; if the number of image frames corresponding to the static state exceeds the preset motion frame threshold, the detection target stops motion in the period, therefore, the static timeout alarm information of the detection target is outputted.
[0152] Different from the prior art, in the embodiment, at least three target image frames are obtained; the position information corresponding to the detection target is obtained according to the at least three target image frames to determine the relative displacement of the detection target between any two target image frames; the historical displacement matrix is constructed according to the relative displacement, and the historical relative displacement distance is obtained based on the historical displacement matrix; the motion state of the detection target is determined based on the number of historical relative displacement distances exceeding the distance threshold. That is, the present application determines the motion state of the detection target by obtaining the relative displacement of the detection target between different target image frames, establishing a historical displacement matrix, obtaining the corresponding historical relative displacement distance according to the historical displacement matrix, and then determining the motion state of the detection target based on the number of historical relative displacement distances exceeding the distance threshold; the motion state of the detection target can be determined only by using the historical detection information of the same target, without relying on other sensors such as radar.
[0153] Please refer to Figure 9 , Figure 9 is a structural schematic diagram of an embodiment of the motion state determination system of the present application. The motion state determination system can execute the steps of the above motion state determination method. For related content, please refer to the detailed description in the above method, which will not be repeated here.
[0154] The motion state determination system 200 comprises: an image acquisition module 210, a target detection module 220, a historical displacement matrix construction module 230, and a motion state determination module 240; wherein the image acquisition module 210 is configured to acquire at least three target image frames; the target detection module 220 is configured to acquire position information corresponding to a detection target according to the at least three target image frames, so as to determine a relative displacement of the detection target between any two target image frames; the historical displacement matrix construction module 230 is configured to construct a historical displacement matrix based on the relative displacement, and acquire a historical relative displacement distance based on the historical displacement matrix; and the motion state determination module 240 is configured to acquire a motion direction corresponding to each historical relative displacement distance and a vector offset angle corresponding to each pair of motion directions based on the historical relative displacement distance, and further determine a motion state of the detection target.
[0155] In some embodiments, the motion state determination system 200 can further comprise: a video acquisition module 250, an image preprocessing module 260, and a target tracking module 270; wherein the video acquisition module 250 is configured to acquire a to-be-recognized image frame, the image preprocessing module 260 is configured to pre-process the to-be-recognized image frame, and the target tracking module 270 is configured to perform target matching and correlation tracking on the detection target in the image frame, so as to determine a target image frame.
[0156] Please refer to Figure 10 , Figure 10 is a structural schematic diagram of an embodiment of an electronic device of the present application. The electronic device can execute the steps in the motion state determination method described above. The electronic device 300 comprises a memory 310 and a processor 320 coupled with the memory, and the memory 310 stores at least one computer program, which is loaded and executed by the processor, and is configured to implement the motion state determination method described above.
[0157] Please refer to Figure 11 , Figure 11 is a structural schematic diagram of an embodiment of a computer readable storage medium of the present application. The computer readable storage medium 400 stores at least one program segment 410, which is loaded and executed by the processor, and is configured to implement the motion state determination method described above.
[0158] In the above scheme, on the one hand, a historical displacement matrix is established based on the relative displacement of the detection target in the target image frame, so as to determine a historical relative displacement distance of the detection target in a target image frame that is not acquired, thereby solving the problem of acquiring position information of the detection target in the case of occlusion; on the other hand, a motion direction corresponding to each historical relative displacement distance and a vector offset angle corresponding to each pair of motion directions are acquired based on the historical relative displacement distance, and then the motion state of the detection target is determined, so that the motion state of the detection target can be accurately acquired.
[0159] In several embodiments provided by the present application, it should be understood that the disclosed system, apparatus and method can be implemented in other manners. For example, the apparatus embodiments described above are merely schematic. For example, the division of the modules or units is merely logical function division. There can be another division manner for the actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.
[0160] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0161] In addition, each functional unit in the various embodiments of the present application can be integrated into one processing unit, or each unit can exist physically, or two or more units can be integrated into one unit. The integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0162] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art, or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, and various media that can store program codes.
[0163] The above description is merely an embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent flow transformation made by using the content of the specification and drawings of the present application, or directly or indirectly applied to other related technical fields, is also included in the patent protection scope of the present application.
Claims
1. A method of determining a motion state, characterized by The motion state determination method comprises: acquiring at least three target image frames; acquiring position information corresponding to a detection target according to the at least three target image frames to determine a relative displacement of the detection target between any two target image frames; constructing a historical displacement matrix according to the relative displacement and acquiring a historical relative displacement distance based on the historical displacement matrix; acquiring a motion direction corresponding to each of the historical relative displacement distances and a vector offset angle corresponding to each pair of the motion directions based on the historical relative displacement distance, and further determining a motion state of the detection target; wherein an X-axis distance parameter, a Y-axis distance parameter and a straight-line distance parameter corresponding to the relative displacement are acquired, as well as an X-axis displacement threshold value corresponding to the X-axis distance parameter, a Y-axis displacement threshold value corresponding to the Y-axis distance parameter and a straight-line displacement threshold value corresponding to the straight-line distance parameter; when any distance parameter in the historical relative displacement distance exceeds the corresponding displacement threshold value, the distance parameter is determined as a target historical relative displacement distance; when the number of the target historical relative displacement distances does not exceed a first preset number, the motion direction corresponding to the historical relative displacement distance is acquired, and the vector offset angle corresponding to each pair of the motion directions is acquired.
2. The motion state determination method according to claim 1, wherein the acquiring of the motion direction corresponding to the historical relative displacement distance comprises: counting the number of motion directions in each quadrant; when the number of motion directions in any quadrant exceeds a second preset number and the number of motion directions in the other three quadrants is 0, the motion state of the detection target is determined as moving.
3. The motion state determination method according to claim 2, wherein after counting the number of motion directions in each quadrant, the motion state determination method further comprises: when the number of motion directions in all quadrants does not exceed the second preset number, the vector offset angle corresponding to each pair of the motion directions is acquired; when the number of motion directions in two of the quadrants is 0 and the vector offset angle is less than or equal to a preset angle threshold value, the motion state of the detection target is determined as moving.
4. The motion state determination method according to claim 3, wherein after acquiring the vector offset angle corresponding to each pair of the motion directions, the motion state determination method further comprises: when the number of motion directions in all quadrants does not exceed a third preset number or the vector offset angle is greater than the preset angle threshold value, the motion state of the detection target is determined as stationary.
5. The motion state determination method according to claim 1, wherein after determining the target historical relative displacement distance, the motion state determination method further comprises: when the number of target historical relative displacement distances exceeds the first preset number, the motion state of the detection target is determined as moving.
6. The motion state determination method according to claim 1, wherein after determining the motion state of the detection target, the method further comprises: If the detection target is in a moving state, count the number of image frames corresponding to the moving state; If the number of image frames corresponding to the moving state is less than a preset moving frame threshold, output a moving overspeed alarm information of the detection target.
7. The motion state determination method of claim 1, wherein after determining the motion state of the detection target, the method further comprises: If the detection target is in a moving state, count the number of image frames corresponding to the moving state; If the number of image frames corresponding to the moving state is less than a preset moving frame threshold, output a moving overspeed alarm information of the detection target.
8. The motion state determination method of claim 1, wherein the obtaining of the at least three target image frames comprises: obtaining a to-be-recognized image frame; performing target detection and target matching correlation tracking on the to-be-recognized image frame to obtain a detection target, so as to determine a target image frame.
9. The motion state determination method of claim 1, wherein the constructing of the historical displacement matrix according to the relative displacement comprises: obtaining an X-axis distance parameter, a Y-axis distance parameter, and a straight-line distance parameter of the relative displacement; establishing an N*N*3-dimensional historical displacement matrix based on the X-axis distance parameter, the Y-axis distance parameter, and the straight-line distance parameter. The electronic device comprises a memory and a processor coupled to the memory, the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the motion state determination method of any one of claims 1-9. 10. A motion state determination system, characterized by 11. An electronic device, comprising: 12. A computer-readable storage medium, characterized in that, The computer readable storage medium has at least one program segment, which is loaded and executed by the processor, and is used to implement the motion state determination method according to any one of claims 1-9.
Citation Information
Patent Citations
Abnormal behavior detection algorithm based on video recording
CN108596028A
Object motion state detection method and device, server and computer readable medium
CN110135377A
Target tracking method and device
CN112200830A