A method, device and storage medium for detecting cross-border

In the cross-border detection method, the video image containing the detection object is found from the first N frames of video images, and the position information and motion vector are used to judge the cross-border, which solves the problems of high resource consumption and inaccurate detection results in the existing technology, and improves the cross-border detection. accuracy.

CN113496500BActive Publication Date: 2024-09-20HANGZHOU EZVIZ SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010252853.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-02
Publication Date
2024-09-20
Estimated Expiration
2040-04-02

AI Technical Summary

Technical Problem

Existing cross-border detection methods consume a lot of resources and have a high error rate in detection results, especially when objects are blocked.

Method used

By obtaining the characteristic information of the current video image and the detection object, find a video image containing the detection object from the previous N frames of video images, and determine whether it has crossed the boundary based on the position information and motion vector of the detection object, avoiding the use of tracking algorithms to reduce resource consumption. .

Benefits of technology

It effectively reduces resource consumption, improves the accuracy of cross-border detection results, and reduces tracking failures caused by object occlusion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113496500B
    Figure CN113496500B
Patent Text Reader

Abstract

The present invention provides a cross-border detection method, device and storage medium, the method comprising: obtaining feature information of a current video image and a detection object in the current video image, the feature information comprising position information; finding a frame of video image containing the detection object from the first N frames of video image of the current video image according to the feature information of the detection object; determining a motion vector corresponding to the detection object based on the position information of the detection object in the found frame of video image and the position information of the detection object in the current video image; determining whether the detection object crosses the border according to the motion vector corresponding to the detection object and a boundary vector pre-set in the current video image. The present invention can reduce resource consumption and improve the accuracy of cross-border detection results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer intelligence technology, and in particular to a cross-border detection method, device and storage medium. Background Art

[0002] The implementation process of the existing cross-border detection method is: using a tracking algorithm to track the moving target, obtain the position information of the moving target, and then make a cross-border / intrusion judgment on the moving target based on the position information of the moving target.

[0003] The above-mentioned out-of-bounds detection method requires the support of a tracking algorithm. Since the tracking algorithm consumes a lot of resources and is easily ineffective when an object is occluded, the out-of-bounds detection method consumes a lot of resources and has a high error rate in the detection results. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a cross-border detection method, device and storage medium, which can reduce resource consumption and improve the accuracy of cross-border detection results.

[0005] In order to achieve the above object, the present invention provides the following technical solutions:

[0006] A cross-border detection method, comprising:

[0007] Acquire feature information of a current video image and a detection object in the current video image, wherein the feature information includes position information;

[0008] According to the feature information of the detection object, a frame of video image containing the detection object is found from the first N frames of video image of the current video image; wherein N is a preset value;

[0009] Determine a motion vector corresponding to the detection object based on the position information of the detection object in the found frame of video image and the position information of the detection object in the current video image;

[0010] Whether the detected object crosses a boundary is determined according to a motion vector corresponding to the detected object and a boundary vector pre-set in the current video image.

[0011] A cross-border detection device includes a non-transitory computer-readable storage medium and a processor connected to the non-transitory computer-readable storage medium via a bus;

[0012] The non-transitory computer-readable storage medium is used to store a computer program that can be run on the processor, and the processor implements the following steps when executing the program:

[0013] Acquire feature information of a current video image and a detection object in the current video image, wherein the feature information includes position information;

[0014] According to the feature information of the detection object, a frame of video image containing the detection object is found from the first N frames of video image of the current video image; wherein N is a preset value;

[0015] Determine a motion vector corresponding to the detection object based on the position information of the detection object in the found frame of video image and the position information of the detection object in the current video image;

[0016] Whether the detected object crosses a boundary is determined according to a motion vector corresponding to the detected object and a boundary vector pre-set in the current video image.

[0017] A non-transitory computer-readable storage medium stores instructions, which, when executed by a processor, cause the processor to perform the steps in the above-mentioned cross-border detection method.

[0018] It can be seen from the above technical solution that in the present invention, after obtaining the feature information of the current video image and the detection object in the current video image, a frame of video image including the detection object is found from the first N frames of video image of the current video image, and the motion vector of the detection object is determined by the position of the detection object in this video image and its position in the current video image, and whether the detection object has crossed the boundary is determined based on this motion vector and a pre-configured cross-border vector. It can be seen that in the present invention, in the process of determining whether the detection object has crossed the boundary, it is not necessary to use a tracking algorithm, and the resource consumption is small. Moreover, it is only necessary to find the detection object in the first N frames of video images and determine whether the detection object has crossed the boundary based on this, which can effectively reduce the tracking failure problem caused by the detection image being obscured in part of the video image, thereby improving the accuracy of the cross-border detection result. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0020] Figure 1 is a flow chart of a cross-border detection method according to an embodiment of the present invention;

[0021] Figure 2 is a flow chart of a cross-border detection method according to a second embodiment of the present invention;

[0022] Figure 3 This is a flow chart of a method for detecting a cross-border error in Embodiment 3 of the present invention;

[0023] Figure 4 is a flow chart of a method for detecting a cross-border error in a fourth embodiment of the present invention;

[0024] Figure 5 It is a structural schematic diagram of a boundary crossing detection device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0026] In an embodiment of the present invention, based on the recognition result of the video image (partial or all feature information of the detection object in the video image has been identified), out-of-bounds detection is performed on the detection object in the video image, and the main process is: find the video image including the detection object in the first N frames of the current video image, and then perform subsequent out-of-bounds judgment based on the feature information of the detection object in the current video image and in the found video image.

[0027] The implementation scheme of the present invention is described in detail below in conjunction with specific embodiments:

[0028] Embodiment 1

[0029] See also Figure 1 , Figure 1 is a flow chart of a cross-border detection method according to an embodiment of the present invention. Figure 1 As shown, the method mainly includes the following steps:

[0030] Step 101: Acquire the current video image and feature information of the detection object in the current video image.

[0031] In the embodiment of the present invention, the characteristic information includes location information.

[0032] Step 102: Find a frame of video image containing the detection object from the first N frames of video image of the current video image according to the feature information of the detection object.

[0033] Here, N is a preset value, such as 5.

[0034] Step 103: Determine a motion vector corresponding to the detection object based on the position information of the detection object in the found frame of video image and the position information of the detection object in the current video image.

[0035] Step 104: Determine whether the detected object has crossed a boundary based on a motion vector corresponding to the detected object and a boundary vector preset in the current video image.

[0036] Under normal circumstances, the position of the camera is fixed and the shooting range is also fixed. If a certain area within its shooting range is prohibited from entering or exiting for some reason, each edge of this area corresponds to an out-of-bounds line in the video image. After a direction is set for this out-of-bounds line, it is the boundary vector pre-set in the current video image as described in the embodiment of the present invention. In fact, each frame of video image taken by the camera has this out-of-bounds vector.

[0037] from Figure 1 It can be seen from the embodiment of the present invention that in the present invention, for each detection object in the current video image, a frame of video image containing the detection object is found in the previous N frames of video image, and the motion vector of the detection object is determined according to the position information of the detection object in the current video image and the found frame of video image, and then the detection object is judged to have crossed the boundary based on the motion vector of the detection object and a pre-set cross-boundary vector. In this process, no tracking algorithm is used, and resource consumption is low. In addition, the present invention uses the previous N frames of video image to determine the motion vector of the detection object in the N+1th frame of video image, which can reduce the tracking failure caused by the detection object being obscured in part of the video image, and can improve the accuracy of the cross-boundary detection results.

[0038] Embodiment 2

[0039] See also Figure 2 , Figure 2 is a flow chart of a cross-border detection method according to a second embodiment of the present invention. Figure 2 As shown, the method mainly includes the following steps:

[0040] Step 2011: Receive the current video image and the position information and size information of the detection object in the current video image.

[0041] The position information and size information of the detected object are a kind of spatial features, belonging to the feature information of the detected object. In addition, the feature information of the detected object also includes the image features of the detected object.

[0042] Step 2012: extracting image features of the detection object from the current video image based on the position information and size information of the detection object in the current video image.

[0043] The above steps 2011 to 2012 are Figure 1 In a specific implementation scheme of step 101 in the embodiment of the present invention, the above position information, size information and image features of the detection object all belong to the feature information of the detection object.

[0044] In the embodiment of the present invention, the image feature of the detection object may be a grayscale histogram feature, an RGB histogram feature, or any feature that can reflect the image information of the detection object.

[0045] In an embodiment of the present invention, the position information of the detection object may include the position coordinates of the detection object, and the size information of the detection object may include the width and the height. The frame corresponding to the detection object in the current video image can be determined based on the position coordinates and the size information of the detection object. For example, when the position coordinates are the center point of the frame corresponding to the detection object, the four corner coordinates of the frame corresponding to the detection object can be determined based on the size information of the detection object, and the frame corresponding to the detection object is determined accordingly. After the frame corresponding to the detection object is determined, the image information in the frame can be extracted to obtain the image features of the detection object.

[0046] Step 202: Find a frame of video image containing the detection object from the first N frames of video image of the current video image according to the feature information of the detection object.

[0047] Here, N is a preset value, such as 5.

[0048] In practical applications, the feature information of the same object in two frames of video images taken at close times should be the same or relatively close. Based on this feature, in an embodiment of the present invention, a frame of video image containing the detected object is found from the previous N frames of video images of the current video image according to the feature information of the detected object. The specific implementation method is as follows:

[0049] According to the shooting time of the previous N frames of video images of the current video image, from back to front, search for the detection object y whose feature information matches the feature information of the detection object in each frame of video image in turn, until the detection object y is found, the video image in which the detection object y is found is determined to be a frame of video image containing the detection object, or the search is terminated after N frames of video images have been searched and the detection object y is not found.

[0050] Here, it should be noted that the detection object y may also be searched according to other sorting orders of the first N frames of the current video image, and the above specific implementation method is only a preferred embodiment.

[0051] The following is an example to illustrate the above specific implementation method:

[0052] Assuming that N=3, the process of finding a frame of video image containing the detection object from the previous N frames of video image of the current video image according to the feature information of the detection object is as follows:

[0053] S1, searching for a detection object y whose characteristic information matches the characteristic information of the detection object from the first-ranked video image, if the detection object y is found, determining the first-ranked video image as a frame of video image containing the detection object, and ending the search process, otherwise, entering step S2;

[0054] S2, searching for a detection object y whose characteristic information matches the characteristic information of the detection object from the second ranked video image, if the detection object y is found, determining the second ranked video image as a frame of video image containing the detection object, and ending the search process, otherwise, entering step S3;

[0055] S3. Search for a detection object y whose feature information matches the feature information of the detection object from the third-ranked video image. If the detection object y is found, the third-ranked video image is determined to be a frame of video image containing the detection object, and the search process is terminated. Otherwise, since the first three frames of the current video image have been searched, the detection object y is not found, and the search process is also terminated at this time.

[0056] In the embodiment of the present invention, the above-mentioned searching for the detection object y whose feature information matches the feature information of the detection object in each frame of the video image may specifically include:

[0057] Assume that the detection object is detection object x;

[0058] Perform feature information matching on each to-be-matched detection object in the frame of video image and the detection object x. If it is determined that the to-be-matched detection object and the detection object x meet a preset feature information matching condition, the to-be-matched detection object is determined as the detection object y.

[0059] Among them, the fact that the to-be-matched detection object and the detection object x satisfy the preset feature information matching conditions means that: the difference between the image features of the to-be-matched detection object and the image features of the detection object x is less than the preset feature difference threshold, the difference between the area of ​​the to-be-matched detection object and the area of ​​the detection object x is less than the preset area difference threshold, and the angle between the motion vector corresponding to the to-be-matched detection object and the check vector of the detection object x corresponding to the to-be-matched detection object is less than the preset angle threshold (that is, the motion trajectories of the two detection objects remain within a reasonable range of variation).

[0060] Here, the area of ​​the detection object to be matched can be determined based on the size information of the detection object to be matched, and the area of ​​the detection object x can be determined based on the size information of the detection object x. The motion vector corresponding to the detection object to be matched can be determined based on the position information of the detection object to be matched in a frame of video image containing the detection object to be matched found from the first N frames of video image to which it belongs and the position information of the detection object to be matched in the video image to which it belongs, that is, the vector formed by the directed line from the previous position to the next position. The test vector of the detection object x corresponding to the detection object to be matched can be determined based on the position information of the detection object to be matched and the position information of the detection object x, that is, the vector formed by the directed line from the previous position to the next position. For example, assuming that the position information of the detection object to be matched is p1 and the position information of the detection object x is p2, then the test vector of the detection object x corresponding to the detection object to be matched is the vector formed by the directed line from p1 to p2.

[0061] It should be noted that, when the feature information of each detection object to be matched in the frame of video image is matched with the detection object x, since it cannot be determined at this time that the detection object to be matched is the detection object y to be found, the motion vector of the detection object x cannot be determined at this time. In order to be able to perform feature information matching, the concept of the test vector of the detection object x corresponding to the detection object to be matched is proposed, and its actual meaning is: the motion vector corresponding to the detection object x is determined based on the assumption that the detection object to be matched is the detection object y to be found, and if the detection object to be matched is the detection object y to be found, then the test vector of the detection object x corresponding to the detection object to be matched is the motion vector of the detection object x. Therefore, in the embodiment of the present invention, the test vector of the detection object x corresponding to the detection object to be matched can be determined according to the position information of the detection object to be matched in the video image to which it belongs (the starting point of the test vector) and the position information of the detection object x in the current video image (the end point of the test vector).

[0062] It can be seen that when the feature information of each to-be-matched detection object in the frame of video image is matched with the detection object x, the matching judgment is actually performed based on the three aspects of image features, area, and motion trajectory of the two detection objects in their respective video images determined according to the feature information of the two detection objects. This is a preferred scheme. In fact, other matching schemes can also be used, such as using any combination of image features, area and motion trajectory, or directly using other feature matching schemes.

[0063] Step 203: Determine a motion vector corresponding to the detection object based on the position information of the detection object in the found frame of video image and the position information of the detection object in the current video image.

[0064] In an embodiment of the present invention, based on the position information of the detection object in a found frame of video image and the position information of the detection object in the current video image, the motion vector corresponding to the detection object is determined, specifically including: taking the position coordinates of the detection object in the found frame of video image as the starting point of the motion vector of the detection object, and taking the position coordinates of the detection object in the current video image as the end point of the motion vector of the detection object, that is, the directed line from the starting point to the end point is the motion vector corresponding to the detection object.

[0065] Step 204: Determine whether the detected object has crossed a boundary based on a motion vector corresponding to the detected object and a boundary vector preset in the current video image.

[0066] Under normal circumstances, the position of the camera is fixed and the shooting range is also fixed. If a certain area within its shooting range is prohibited from entering or exiting for some reason, each edge of this area corresponds to an out-of-bounds line in the video image. After a direction is set for this out-of-bounds line, it is the boundary vector pre-set in the current video image as described in the embodiment of the present invention. In fact, each frame of video image taken by the camera has this out-of-bounds vector.

[0067] from Figure 2 It can be seen from the embodiment of the present invention that in the present invention, the recognition and analysis process of the video image is separated, and the out-of-bounds judgment is directly performed on the basis of the existing recognition results of the video image, thereby reducing the resource consumption required for image recognition. In addition, the present invention does not use a tracking algorithm in the process of out-of-bounds detection of the detection object, and the resource consumption is relatively low. In addition, the motion vector of the detection object in the N+1th frame of the video image is determined by the first N frames of the video image, and whether the detection object has crossed the boundary is determined based on the motion vector, which can reduce the tracking failure caused by the detection object being obscured in part of the video image, and can improve the accuracy of the out-of-bounds detection result.

[0068] Embodiment 3

[0069] See also Figure 3 , Figure 3 : is a flow chart of a method for detecting a cross-border error in Embodiment 3 of the present invention. Figure 3 As shown, the method mainly includes the following steps:

[0070] Step 3011: Receive the current video image and the position information and size information of the detection object in the current video image.

[0071] Step 3012: Based on the position information and size information of each detection object in the current video image, each detection object in the current video image is fused to obtain a new detection object, the new detection object is used to replace the original detection object in the current video image, and the position information and size information of the new detection object are determined.

[0072] Step 3013: extract image features of the detection object from the current video image based on the position information and size information of the detection object in the current video image.

[0073] The detection object in step 3013 is the new detection object obtained after the fusion processing.

[0074] The above steps 3011 to 3013 are Figure 1 A specific implementation scheme of step 101 in the embodiment of the present invention. The position information, size information and image features of the detection object mentioned above are all feature information of the detection object.

[0075] In this embodiment, the cross-border detection is performed on the detection object after the fusion processing. The image feature of the detection object can be a grayscale histogram feature, an RGB histogram feature of the detection object, or any feature that can reflect the image information of the detection object.

[0076] In an embodiment of the present invention, the position information of the detection object may include the position coordinates of the detection object, and the size information of the detection object may include the width and the height. The frame corresponding to the detection object in the current video image can be determined based on the position coordinates and the size information of the detection object. For example, when the position coordinates are the center point of the frame corresponding to the detection object, the four corner coordinates of the frame corresponding to the detection object can be determined based on the size information of the detection object, and the frame corresponding to the detection object is determined accordingly. After the frame corresponding to the detection object is determined, the image information in the frame can be extracted to obtain the image features of the detection object.

[0077] In the embodiment of the present invention, the size information includes width and height;

[0078] According to the position information and size information of each initial detection object in the current video image, the initial detection object is fused to obtain a new detection object, specifically including:

[0079] Determine, according to the position information and size information of each initial detection object in the current video image, a frame corresponding to the initial detection object in the current video image;

[0080] Calculate the overlap of the frames corresponding to any two detected objects in the current video image;

[0081] Multiple frames whose overlap exceeds a preset overlap threshold are fused into one frame, and the image content covered by the fused frame is used as a new detection object.

[0082] In actual implementation, a specific implementation method for fusing multiple frames may be: comparing the four corner coordinates of the multiple frames, using the minimum horizontal coordinate and the minimum vertical coordinate among the four corner coordinates of the multiple frames as the lower left corner coordinate of the fused frame, using the minimum horizontal coordinate and the maximum vertical coordinate among the four corner coordinates of the multiple frames as the upper left corner coordinate of the fused frame, using the maximum horizontal coordinate and the minimum vertical coordinate among the four corner coordinates of the multiple frames as the lower right corner coordinate of the fused frame, and using the maximum horizontal coordinate and the maximum vertical coordinate among the four corner coordinates of the multiple frames as the upper right corner coordinate of the fused frame.

[0083] Step 302: Find a frame of video image containing the detection object from the first N frames of video image of the current video image according to the feature information of the detection object.

[0084] Step 303: Determine a motion vector corresponding to the detection object based on the position information of the detection object in the found frame of video image and the position information of the detection object in the current video image.

[0085] Step 304: Determine whether the detected object has crossed a boundary based on a motion vector corresponding to the detected object and a boundary vector preset in the current video image.

[0086] The above steps 302 to 304 are Figure 2 The implementation principles of steps 202 to 204 are the same and will not be described in detail.

[0087] from Figure 3 It can be seen from the embodiment of the present invention that in the present invention, the cross-border judgment is performed on the basis of the existing recognition results of the video image, so that the resource consumption required for image recognition can be reduced. In addition, through the method of detecting object fusion, the detection objects that may belong to different parts of the same object can be fused into one detection object before performing cross-border detection, so that the number of detection objects can be reduced, thereby reducing resource consumption. In addition, the present invention does not use a tracking algorithm in the process of performing cross-border detection on the detection object, and the resource consumption is relatively low. In addition, the motion vector of the detection object in the N+1th frame of the video image is determined by using the first N frames of video images, and whether the detection object is cross-border is determined based on the motion vector, which can reduce the tracking failure caused by the detection object being obscured in part of the video image, and can improve the accuracy of the cross-border detection result.

[0088] Embodiment 4:

[0089] See also Figure 4 , Figure 44 is a flow chart of a method for detecting a cross-border error in accordance with the fourth embodiment of the present invention. Figure 4 As shown, the method mainly includes the following steps:

[0090] Step 401: Acquire the current video image and feature information of the detection object in the current video image.

[0091] In the embodiment of the present invention, the characteristic information includes location information.

[0092] This step 401 can be performed by Figure 2 The steps 2011-2012 shown can also be implemented using Figure 3 Steps 3011-3013 shown are implemented.

[0093] Step 402: Find a frame of video image containing the detection object from the first N frames of video image of the current video image according to the feature information of the detection object.

[0094] Here, N is a preset value, such as 5.

[0095] This step 402 and Figure 2 The implementation principle of step 202 is the same.

[0096] Step 403: Determine a motion vector corresponding to the detection object based on the position information of the detection object in the found frame of video image and the position information of the detection object in the current video image.

[0097] This step 403 and Figure 2 The implementation principle of step 203 is the same.

[0098] Step 404, determine whether the motion vector corresponding to the detection object intersects with the boundary vector. If the two intersect, further calculate the modulus of the cross product of the motion vector corresponding to the detection object and the boundary vector, and determine whether the detection object has crossed the boundary based on the modulus of the cross product of the two vectors and the cross-boundary direction pre-set for the boundary vector.

[0099] This step 404 is Figure 1 Step 104, Figure 2 Step 204 and Figure 3 Specific refinement of 304 is shown.

[0100] In the embodiment of the present invention, the method for determining whether the motion vector corresponding to the detection object intersects with the boundary vector may be specifically as follows:

[0101] Assuming that the coordinates of the starting point A and the ending point B of the motion vector corresponding to the detection object are (Ax, Ay) and (Bx, By), respectively, and the coordinates of the starting point C and the ending point D of the boundary vector are (Cx, Cy) and (Dx, Dy), respectively, if the motion vector corresponding to the detection object and the boundary vector meet the preset intersection condition, it is determined that the two intersect, otherwise, it is determined that the two do not intersect;

[0102] The motion vector corresponding to the detection object and the boundary vector satisfying a preset intersection condition include:

[0103] Condition 1: The maximum value of Ax and Bx is not less than the minimum value of Cx and Dx;

[0104] Condition 2: The maximum value of Ay and By is not less than the minimum value of Cy and Dy;

[0105] Condition 3: The maximum value of Cx and Dx is not less than the minimum value of Ax and Bx;

[0106] Condition 4: The maximum value of Cy and Dy is not less than the minimum value of Ay and By;

[0107] Condition 5: The product of the magnitude of the cross product of vector AC and vector AB and the magnitude of the cross product of vector AB and vector AD is greater than 0;

[0108] Condition six: The product of the modulus of the cross product of vector CA and vector CD and the modulus of the cross product of vector CD and vector CB is greater than 0.

[0109] In the embodiment of the present invention, assuming that the two sides of the boundary vector are the first side and the second side respectively; the first side is the left side or the lower side of the boundary line; the second side is the right side or the upper side of the boundary line, then the method for determining whether the detection object has crossed the boundary according to the modulus of the cross product of the two vectors and the crossing direction pre-set for the boundary vector can be specifically as follows:

[0110] If the crossing direction is from the first side to the second side, then if the modulus of the cross product of the two vectors is a positive value, it is determined that the detection object has crossed the boundary, and if the modulus of the cross product of the two vectors is a negative value, it is determined that the detection object has not crossed the boundary;

[0111] If the crossing direction is from the second side to the first side, then if the modulus of the cross product of the two vectors is a positive value, it is determined that the detection object has not crossed the boundary, and if the modulus of the cross product of the two vectors is a negative value, it is determined that the detection object has crossed the boundary;

[0112] If the crossing direction is from the first side to the second side or from the second side to the first side, and if the modulus of the cross product of the two vectors is not 0, it is determined that the detection object has crossed the boundary.

[0113] from Figure 4 It can be seen from the embodiment of the present invention shown that the present invention detects an object by finding a frame of video image containing the detection object in the first N frames of video image, determining the motion vector of the detection object according to the position information of the detection object in the current video image and the found frame of video image, and then performing an out-of-bounds judgment on the detection object according to the motion vector of the detection object and a pre-set out-of-bounds vector. In this process, no tracking algorithm is used, and resource consumption is low. In addition, the present invention determines the motion vector of the detection object in the N+1th frame of video image through the first N frames of video image and determines whether the detection object has crossed the boundary based on the motion vector, which can reduce the tracking failure caused by the detection object being obscured in part of the video image, and can improve the accuracy of the out-of-bounds detection result.

[0114] The above four embodiments describe in detail the cross-border detection method provided by the present invention. The present invention also provides a cross-border detection device. Figure 5 Provide detailed explanation.

[0115] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a cross-border detection device provided by an embodiment of the present invention, such as Figure 5 As shown, the device includes a non-transitory computer-readable storage medium 501, and a processor 502 connected to the non-transitory computer-readable storage medium 501 via a bus;

[0116] The non-transitory computer-readable storage medium 501 is used to store a computer program that can be run on the processor 502. When the processor 502 executes the program, the following steps are implemented:

[0117] Acquire feature information of a current video image and a detection object in the current video image, wherein the feature information includes position information;

[0118] According to the feature information of the detection object, a frame of video image containing the detection object is found from the first N frames of video image of the current video image; wherein N is a preset value;

[0119] Determine a motion vector corresponding to the detection object based on the position information of the detection object in the found frame of video image and the position information of the detection object in the current video image;

[0120] Whether the detected object crosses a boundary is determined according to a motion vector corresponding to the detected object and a boundary vector pre-set in the current video image.

[0121] In the embodiment of the present invention, the feature information further includes size information and image features;

[0122] In an optional embodiment of the present invention, the processor 505 obtains feature information of the current video image and the detection object in the current video image, including:

[0123] Receiving the current video image and the position information and size information of the detection object in the current video image;

[0124] Image features of the detection object are extracted from the current video image based on position information and size information of the detection object in the current video image.

[0125] In another optional embodiment of the present invention, the processor 502 obtains feature information of the current video image and the detection object in the current video image, including:

[0126] Receiving the current video image and the position information and size information of the initial detection object in the current video image;

[0127] According to the position information and size information of each initial detection object in the current video image, the initial detection object is fused to obtain a new detection object, and the position information and size information of the new detection object is determined;

[0128] The new detection object is used as the detection object in the current video image, and image features of the detection object are extracted from the current video image based on position information and size information of the detection object in the current video image.

[0129] Figure 5 In the device shown, the size information includes width and height;

[0130] The processor 502 performs fusion processing on the initial detection objects to obtain new detection objects according to the position information and size information of each initial detection object in the current video image, including:

[0131] Determine, according to the position information and size information of each initial detection object in the current video image, a frame corresponding to the initial detection object in the current video image;

[0132] Calculate the overlap of the frames corresponding to any two detected objects in the current video image;

[0133] Multiple frames whose overlap exceeds a preset overlap threshold are fused into one frame, and the image content covered by the fused frame is used as a new detection object.

[0134] Figure 5 In the device shown,

[0135] The processor 502, according to the feature information of the detection object, finds a frame of video image containing the detection object from the first N frames of video image of the current video image, including:

[0136] According to the shooting time of the previous N frames of video images of the current video image, from back to front, search for the detection object y whose feature information matches the feature information of the detection object in each frame of video image in turn, until the detection object y is found, the video image in which the detection object y is found is determined to be a frame of video image containing the detection object, or the search is terminated after N frames of video images have been searched and the detection object y is not found.

[0137] Figure 5 In the device shown,

[0138] The processor 502 searches for the detection object y whose feature information matches the feature information of the detection object in each frame of the video image, including:

[0139] Assume that the detection object is detection object x;

[0140] Perform feature information matching on each to-be-matched detection object in the frame of video image and the detection object x. If it is determined that the to-be-matched detection object and the detection object x meet a preset feature information matching condition, the to-be-matched detection object is determined as the detection object y.

[0141] Among them, the fact that the detection object to be matched and the detection object x meet the preset feature information matching conditions means that: the difference between the image features of the detection object to be matched and the image features of the detection object x is less than the preset feature difference threshold, the difference between the area of ​​the detection object to be matched and the area of ​​the detection object x is less than the preset area difference threshold, and the angle between the motion vector corresponding to the detection object to be matched and the test vector of the detection object x corresponding to the detection object to be matched is less than the preset angle threshold; wherein the area of ​​the detection object to be matched is determined according to the size information of the detection object to be matched, and the area of ​​the detection object x is determined according to the size information of the detection object x; the motion vector corresponding to the detection object to be matched is determined according to the position information of the detection object to be matched in a frame of video image containing the detection object to be matched found from the first N frames of video image to which it belongs and the position information of the detection object to be matched in the video image to which it belongs; the test vector of the detection object x corresponding to the detection object to be matched is determined according to the position information of the detection object to be matched and the position information of the detection object x.

[0142] Figure 5 In the device shown,

[0143] The location information includes location coordinates;

[0144] The processor 502 determines the motion vector corresponding to the detected object based on the position information of the detected object in the found frame of video image and the position information of the detected object in the current video image, including:

[0145] The position coordinates of the detected object in the found frame of video image are used as the starting point of the motion vector of the detected object, and the position coordinates of the detected object in the current video image are used as the ending point of the motion vector of the detected object.

[0146] Figure 5 In the device shown,

[0147] The processor 502 determines whether the detected object crosses a boundary according to a motion vector corresponding to the detected object and a boundary vector preset in the current video image, including:

[0148] Determine whether the motion vector corresponding to the detection object intersects with the boundary vector. If the two intersect, further calculate the modulus of the cross product of the motion vector corresponding to the detection object and the boundary vector, and determine whether the detection object has crossed the boundary based on the modulus of the cross product of the two vectors and the cross-boundary direction pre-set for the boundary vector.

[0149] Figure 5 In the device shown,

[0150] The processor 502, when determining whether the motion vector corresponding to the detected object intersects with the boundary vector, is configured to:

[0151] Assuming that the coordinates of the starting point A and the ending point B of the motion vector corresponding to the detection object are (Ax, Ay) and (Bx, By), respectively, and the coordinates of the starting point C and the ending point D of the boundary vector are (Cx, Cy) and (Dx, Dy), respectively, if the motion vector corresponding to the detection object and the boundary vector meet the preset intersection condition, it is determined that the two intersect, otherwise, it is determined that the two do not intersect;

[0152] The motion vector corresponding to the detection object and the boundary vector satisfying a preset intersection condition include:

[0153] Condition 1: The maximum value of Ax and Bx is not less than the minimum value of Cx and Dx;

[0154] Condition 2: The maximum value of Ay and By is not less than the minimum value of Cy and Dy;

[0155] Condition 3: The maximum value of Cx and Dx is not less than the minimum value of Ax and Bx;

[0156] Condition 4: The maximum value of Cy and Dy is not less than the minimum value of Ay and By;

[0157] Condition 5: The product of the magnitude of the cross product of vector AC and vector AB and the magnitude of the cross product of vector AB and vector AD is greater than 0;

[0158] Condition six: The product of the modulus of the cross product of vector CA and vector CD and the modulus of the cross product of vector CD and vector CB is greater than 0.

[0159] Figure 5 In the device shown,

[0160] Assume that the two sides of the boundary line with the boundary vector are respectively a first side and a second side; the first side is the left side or the lower side of the boundary line; the second side is the right side or the upper side of the boundary line;

[0161] The processor 502, when determining whether the detected object crosses the boundary according to the modulus of the cross product of the two vectors and the cross-boundary direction pre-set for the boundary vector, is configured to:

[0162] If the crossing direction is from the first side to the second side, then if the modulus of the cross product of the two vectors is a positive value, it is determined that the detection object has crossed the boundary, and if the modulus of the cross product of the two vectors is a negative value, it is determined that the detection object has not crossed the boundary;

[0163] If the crossing direction is from the second side to the first side, then if the modulus of the cross product of the two vectors is a positive value, it is determined that the detection object has not crossed the boundary, and if the modulus of the cross product of the two vectors is a negative value, it is determined that the detection object has crossed the boundary;

[0164] If the crossing direction is from the first side to the second side or from the second side to the first side, and if the modulus of the cross product of the two vectors is not 0, it is determined that the detection object has crossed the boundary.

[0165] The embodiment of the present invention further provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores instructions, and when the instructions are executed by a processor, the processor executes the following Figures 1 to 4 The steps in the cross-border detection method shown.

[0166] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for detecting a cross-border condition, characterized in that: The method includes: Acquire feature information of a current video image and a detection object in the current video image, wherein the feature information includes position information; According to the feature information of the detection object, a frame of video image containing the detection object is found from the previous N frames of video image of the current video image, so as not to use the tracking algorithm; wherein N is a preset value; Determine a motion vector corresponding to the detection object based on the position information of the detection object in the found frame of video image and the position information of the detection object in the current video image; Determine whether the detected object has crossed the boundary according to the motion vector corresponding to the detected object and the boundary vector pre-set in the current video image; in, The step of finding a frame of video image containing the detection object from the first N frames of video image of the current video image according to the feature information of the detection object comprises: According to the shooting time of the first N frames of video images of the current video image, from back to front, searching for the detection object whose characteristic information matches the characteristic information of the detection object in each frame of video image, and determining the video image of the matched detection object as a frame of video image containing the detection object; The step of searching for a detection object whose characteristic information matches the characteristic information of the detection object in each frame of video image includes: Assume that the detection object is detection object x, and perform feature information matching between each detection object to be matched in the frame of video image and the detection object x. If the detection object to be matched and the detection object x meet the preset feature information matching condition, the detection object to be matched is determined as a matching detection object, and the matching condition is a combination of the following conditions: The difference between the image feature of the to-be-matched detection object and the image feature of the detection object x is less than a preset feature difference threshold, The difference between the area of ​​the to-be-matched detection object and the area of ​​the detection object x is less than a preset area difference threshold, The angle between the motion vector corresponding to the to-be-matched detection object and the check vector of the detection object x corresponding to the to-be-matched detection object is less than a preset angle threshold.

2. The method according to claim 1, characterized in that The feature information also includes size information and image features; Get the feature information of the current video image and the detected object in the current video image, including: Receiving the current video image and the position information and size information of the detection object in the current video image; Image features of the detection object are extracted from the current video image based on position information and size information of the detection object in the current video image.

3. The method according to claim 1, characterized in that The feature information also includes size information and image features; Get the feature information of the current video image and the detected object in the current video image, including: Receiving the current video image and the position information and size information of the initial detection object in the current video image; According to the position information and size information of each initial detection object in the current video image, the initial detection object is fused to obtain a new detection object, and the position information and size information of the new detection object is determined; The new detection object is used as the detection object in the current video image, and image features of the detection object are extracted from the current video image based on position information and size information of the detection object in the current video image.

4. The method according to claim 3, characterized in that The size information includes width and height; According to the position information and size information of each initial detection object in the current video image, the initial detection object is fused to obtain a new detection object, including: Determine, according to the position information and size information of each initial detection object in the current video image, a frame corresponding to the initial detection object in the current video image; Calculate the overlap of the frames corresponding to any two detected objects in the current video image; Multiple frames whose overlap exceeds a preset overlap threshold are fused into one frame, and the image content covered by the fused frame is used as a new detection object.

5. The method according to claim 2 or 3, characterized in that: The step of finding a frame of video image containing the detected object from the first N frames of video image of the current video image according to the feature information of the detected object further comprises: When a matching detection object is found, the video image in which the detection object y is found is determined as a frame of video image containing the detection object. When N frames of video images have been searched and the detection object y has not been found, the search is terminated.

6. The method according to claim 1, characterized in that The area of ​​the to-be-matched detection object is determined according to the size information of the to-be-matched detection object, and the area of ​​the detection object x is determined according to the size information of the detection object x; The motion vector corresponding to the to-be-matched detection object is determined based on the position information of the to-be-matched detection object in a frame of video image containing the to-be-matched detection object found from the first N frames of video image to which the to-be-matched detection object belongs and the position information of the to-be-matched detection object in the video image to which the to-be-matched detection object belongs; The verification vector of the detection object x corresponding to the detection object to be matched is determined according to the position information of the detection object to be matched and the position information of the detection object x.

7. The method according to claim 1, characterized in that The location information includes location coordinates; Determining a motion vector corresponding to the detected object based on position information of the detected object in the found frame of video image and position information of the detected object in the current video image includes: The position coordinates of the detected object in the found frame of video image are used as the starting point of the motion vector of the detected object, and the position coordinates of the detected object in the current video image are used as the ending point of the motion vector of the detected object.

8. The method according to claim 1, characterized in that Determining whether the detected object crosses a boundary according to a motion vector corresponding to the detected object and a boundary vector pre-set in the current video image includes: Determine whether the motion vector corresponding to the detection object intersects with the boundary vector. If the two intersect, further calculate the modulus of the cross product of the motion vector corresponding to the detection object and the boundary vector, and determine whether the detection object has crossed the boundary based on the modulus of the cross product of the two vectors and the cross-boundary direction pre-set for the boundary vector.

9. The method according to claim 8, characterized in that The method for determining whether the motion vector corresponding to the detection object intersects with the boundary vector is: Assuming that the coordinates of the starting point A and the ending point B of the motion vector corresponding to the detection object are (Ax, Ay) and (Bx, By), respectively, and the coordinates of the starting point C and the ending point D of the boundary vector are (Cx, Cy) and (Dx, Dy), respectively, if the motion vector corresponding to the detection object and the boundary vector meet the preset intersection condition, it is determined that the two intersect, otherwise, it is determined that the two do not intersect; The motion vector corresponding to the detection object and the boundary vector satisfying a preset intersection condition include: Condition 1: The maximum value of Ax and Bx is not less than the minimum value of Cx and Dx; and Condition 2: The maximum value of Ay and By is not less than the minimum value of Cy and Dy; and Condition 3: The maximum value of Cx and Dx is not less than the minimum value of Ax and Bx; and Condition 4: The maximum value of Cy and Dy is not less than the minimum value of Ay and By; and Condition 5: The product of the magnitude of the cross product of vector AC and vector AB and the magnitude of the cross product of vector AB and vector AD is greater than 0; and Condition six: The product of the modulus of the cross product of vector CA and vector CD and the modulus of the cross product of vector CD and vector CB is greater than 0.

10. The method according to claim 8, characterized in that Assume that the two sides of the boundary vector as the boundary are respectively a first side and a second side; the first side is the left side or the lower side of the boundary; the second side is the right side or the upper side of the boundary; The method for determining whether the detected object crosses the boundary according to the modulus of the cross product of the two vectors and the cross-boundary direction pre-set for the boundary vector is: If the crossing direction is from the first side to the second side, then if the modulus of the cross product of the two vectors is a positive value, it is determined that the detection object has crossed the boundary, and if the modulus of the cross product of the two vectors is a negative value, it is determined that the detection object has not crossed the boundary; If the crossing direction is from the second side to the first side, then if the modulus of the cross product of the two vectors is a positive value, it is determined that the detection object has not crossed the boundary, and if the modulus of the cross product of the two vectors is a negative value, it is determined that the detection object has crossed the boundary; If the crossing direction is from the first side to the second side or from the second side to the first side, and if the modulus of the cross product of the two vectors is not 0, it is determined that the detection object has crossed the boundary.

11. A cross-border detection device, characterized in that: The apparatus includes a non-transitory computer-readable storage medium, and a processor connected to the non-transitory computer-readable storage medium via a bus; The non-transitory computer-readable storage medium is used to store a computer program that can be run on the processor, and the processor implements the following steps when executing the program: Acquire feature information of a current video image and a detection object in the current video image, wherein the feature information includes position information; According to the feature information of the detection object, a frame of video image containing the detection object is found from the previous N frames of video image of the current video image, so as not to use the tracking algorithm; wherein N is a preset value; Determine a motion vector corresponding to the detection object based on the position information of the detection object in the found frame of video image and the position information of the detection object in the current video image; Determine whether the detected object has crossed the boundary according to the motion vector corresponding to the detected object and the boundary vector pre-set in the current video image; in, The step of finding a frame of video image containing the detection object from the first N frames of video image of the current video image according to the feature information of the detection object comprises: According to the shooting time of the first N frames of video images of the current video image, from back to front, searching for the detection object whose characteristic information matches the characteristic information of the detection object in each frame of video image, and determining the video image of the matched detection object as a frame of video image containing the detection object; The step of searching for a detection object whose characteristic information matches the characteristic information of the detection object in each frame of video image includes: Assume that the detection object is detection object x, and perform feature information matching between each detection object to be matched in the frame of video image and the detection object x. If the detection object to be matched and the detection object x meet the preset feature information matching condition, the detection object to be matched is determined as a matching detection object, and the matching condition is a combination of the following conditions: The difference between the image feature of the to-be-matched detection object and the image feature of the detection object x is less than a preset feature difference threshold, The difference between the area of ​​the to-be-matched detection object and the area of ​​the detection object x is less than a preset area difference threshold, and The angle between the motion vector corresponding to the to-be-matched detection object and the check vector of the detection object x corresponding to the to-be-matched detection object is less than a preset angle threshold.

12. A non-transitory computer-readable storage medium storing instructions, characterized in that: When the instructions are executed by a processor, the processor executes the steps in the cross-border detection method as claimed in any one of claims 1 to 10.