A method for solving hot area detection false detection
By adjusting the video frame sequence length and sensitivity configuration, and combining morphological and edge detection, the problems of multi-target detection and false detection of hot spots in existing technologies are solved, achieving accurate detection of hot spots and reducing the false detection rate.
Patent Information
- Application Number
- CN202110433750.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-22
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2041-04-22
AI Technical Summary
In existing technologies, low-complexity video motion detection based on image edges cannot effectively detect multiple moving targets, cannot clearly indicate the position of moving objects, and cannot accurately detect hot areas, resulting in a high false detection rate.
By initializing the video frame sequence length L and sensitivity sense configuration, frame difference, thresholding, morphological processing, edge detection, external rectangle operation, and fusion operation are performed. Combined with hot zone detection, false detections are reduced and detection accuracy is improved.
This allows for focused attention on hot zones, reduces the triggering of irrelevant movement events, lowers the false detection rate, and improves the accuracy and flexibility of hot zone detection.
Smart Images

Figure CN115239611B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method for solving false detections in hot zone detection. Background Technology
[0002] In existing technologies, low-complexity video motion detection based on image edges involves performing contour detection on the current frame and the frame after time T to obtain a difference image. Then, an erosion operation is performed on the difference image, and non-zero points are counted. When the number of non-zero points reaches a preset threshold, motion information is triggered.
[0003] However, as Figure 1 As shown, in the prior art, for example, patent number CN105096321A, "A Low-Complexity Video Motion Detection Method Based on Image Edges," the motion region obtained through the contour difference map can only represent one area with a single image. If multiple moving targets appear, it cannot clearly indicate which moving object is being detected. Furthermore, it cannot set hotspots, failing to meet the customer's need for hotspot detection (e.g., only concerned with whether moving objects appear at entrances or exits).
[0004] In addition, the commonly used terms in the prior art are as follows:
[0005] 1. bbox: abbreviation for bounding box, which represents the smallest rectangle on a two-dimensional plane that can contain all the points and lines to be contained.
[0006] 2. Motion Detection: Motion detection technology, also known as motion detection, is commonly used in unattended surveillance video recording and automatic alarms. Images captured by cameras at different frame rates are processed by the CPU through certain calculations and comparisons. When a person or object moves in the frame, the bbox of the moving object is calculated, triggering an alarm, recording, and other subsequent actions.
[0007] 3. Hotspot Detection: A pre-defined area to be detected, called a hotspot, is set in the video frame. The hotspot can be a rectangle or any polygon. Subsequent actions, such as alarms, are only triggered when the bounding box calculated by motion detection intersects with or is inside the hotspot.
[0008] 4. Binary Image: A binary image is an image in which there are only two gray levels. That is, the gray value of any pixel in the image is either 0 or 1, representing black and white respectively.
[0009] 5. Frame difference: In a consecutive video sequence, the difference operation is performed between the image of the nth frame and the image of the (n+t)th frame, where t>=1.
[0010] 6、ROI: region of interest, in machine vision, image processing, the region of interest is outlined in the image to be processed in the form of a box, circle, ellipse, irregular polygon, etc. The region to be processed is called the region of interest.
[0011] 7、Tbbox: true moving bbox, indicating that the bbox of the binary image calculated by the moving target has an intersection with the hot area, and the binary image calculated by the moving target also has an intersection with the hot area.
[0012] 8、Fbbox: false moving bbox, indicating that the bbox of the binary image calculated by the moving target has an intersection with the hot area, but the binary image calculated by the moving target does not have an intersection with the hot area. SUMMARY
[0013] In order to solve the above problems, the purpose of the method is to obtain the target number of moving objects through video frame data by proposing a novel moving detection method. Support hot area detection setting, effectively meet the detection of hot area in the whole monitoring area, focus on the hot area concerned, reduce the triggering of irrelevant moving events. At the same time, a method for reducing false detection in hot area detection is proposed, which can improve the accuracy of hot area detection.
[0014] Specifically, the present application provides a method for solving the false detection of hot area detection, which comprises the following steps:
[0015] S1, initialization operation: including setting the threshold value th of thresholding operation: defining a th, the range is 0<th<255; setting the video frame sequence length L: predefining the number of video frames that can be cached;
[0016] S2, obtaining video frame data: obtaining YUV data of each frame through code stream data acquisition interface, and only extracting Y data;
[0017] S3, updating video frame data sequence: copying the Y data obtained in step S2 to the tail of the video frame sequence, if the length of the copied data is greater than the preset video frame length L, deleting the previous data from the head;
[0018] S4, frame difference of the 0th data and the Lth data of the video frame: f=f0-f L ;
[0019] S5, thresholding operation: thresholding operation is performed on the f obtained in step S4, the pixel value greater than th is set to 255, and the value less than or equal to th is set to 0, to obtain a binary image f1;
[0020] S6, morphological processing: according to the configuration of sensitivity sense, corresponding morphological operation is performed on f1 to obtain data f2 after operation;
[0021] S7, edge detection: edge detection is performed on f2 to extract m contour information, each contour information has a plurality of points to form a closed area;
[0022] S8, outer rectangle operation: outer rectangle operation is performed on the m contour information obtained in step S7 to obtain m bbox;
[0023] S9, fusion operation: fusion operation is performed on the m bbox obtained in step S8, that is, two bbox are selected from the m bbox for comparison, when the positional relationship of the two bbox meets certain conditions, the two bbox are subjected to 'or' operation, otherwise the two bbox are retained, K times of fusion operation are performed, and finally n bbox are obtained;
[0024] S10, hot area detection: n bbox obtained in step S9 are subjected to hot area detection to obtain final c bbox and alarm state of the hot area.
[0025] The method further comprises:
[0026] S11, judging whether to end the hot area detection function, if yes, ending; otherwise, updating the video frame data in step S2.
[0027] Therefore, the advantages of the present application are:
[0028] 1. In the present application, a variable length video frame sequence is used for number buffering, when frame difference is performed, the longer the sequence length is, the easier the slow movement condition can be detected, and the shorter the length is, the noise and false detection can be effectively reduced, and the length can be adjusted according to the actual use scene of the customer, which is flexible and convenient.
[0029] 2. Different combination operations of morphological are performed using sensitivity sense, which can meet the flexible judgment of the customer on detection sensitivity.
[0030] 3. The hot area detection idea is proposed in the present application, which can realize the key attention to the target area and reduce the moving events that are not concerned.
[0031] 4. The hot area detection operation used in the present application can effectively reduce the triggering condition of Fbbox to the moving event. BRIEF DESCRIPTION OF DRAWINGS
[0032] The drawings described herein are used to provide further understanding of the present application, constitute a part of the present application, and do not constitute a limitation of the present application.
[0033] Figure 1 is a diagram in the prior art.
[0034] Figure 2 is a flowchart of the method of the present application.
[0035] Figure 3 is a flowchart of the steps of a specific embodiment of the method.
[0036] Figure 4 is a flowchart of the steps of the initialization operation in a specific embodiment of the method. DETAILED DESCRIPTION
[0037] In order to enable a clearer understanding of the technical content and advantages of the present application, the present application will now be further described in detail with reference to the accompanying drawings.
[0038] As shown in Figure 2 , the present application relates to a method for solving the false detection of hot area detection, the method comprising the following steps:
[0039] S1, initialization operation: including setting the threshold value th when thresholding operation: predefine a th, the range is 0<th<255; setting the video frame sequence length L: predefine the number of video frames that can be cached;
[0040] S2, obtaining video frame data: through the code stream data acquisition interface, obtaining the YUV data of each frame, and only extracting Y data;
[0041] S3, updating the video frame data sequence: copying the Y data obtained in step S2 to the tail of the video frame sequence, if the data length after copying is greater than the pre-set video frame length L, deleting the previous data from the head;
[0042] S4, frame difference on the 0th data and the Lth data of the video frame: f=f0-f L ;
[0043] S5, thresholding operation: thresholding operation is performed on the f obtained in step S4, the pixel value greater than th is set to 255, and the value less than or equal to th is set to 0, obtaining a binary image f1;
[0044] S6, morphological processing: according to the configuration of the sensitivity sense, corresponding morphological operation is performed on f1, and the data f2 after operation is obtained;
[0045] S7, edge detection: edge detection is performed on f2 to extract m contour information, each contour information has a plurality of points to form a closed area;
[0046] S8, outer rectangle operation: outer rectangle operation is performed on the m contour information obtained in step S7, obtaining m bbox;
[0047] S9, fusion operation: m bbox obtained in step S8 are subjected to a fusion operation, which is to compare any two of the m bbox, and when the positional relationship of the two bbox meets certain conditions, the two bbox are subjected to an OR operation, otherwise the two bbox are retained, and the fusion operation is performed K times, and finally n bbox are obtained;
[0048] S10, hot area detection: n bbox obtained in step S9 are subjected to hot area detection, and finally c bbox and the alarm state of the hot area are obtained.
[0049] The step S1 further comprises:
[0050] S1.1, setting sensitivity sense: the sensitivity level is set by default, and the greater the set value, the more sensitive it is;
[0051] S1.2, setting minimum detection size: used to filter bbox, and bbox with a size smaller than the minimum detection size are removed;
[0052] S1.3, setting threshold value th of thresholding operation: a th is predetermined, and the range is 0<th<255;
[0053] S1.4, setting video frame sequence length L: the number of video frames that can be buffered is predefined, and L represents the number of frames that can be saved at the same time;
[0054] S1.5, setting the number of hot areas and position information: the number x of hot areas and the position information of the hot areas are predefined, the position information is a polygon composed of a series of pixel point coordinates, and the pixel point coordinates are stored in sequence clockwise or counterclockwise from a starting point; and each hot area is subjected to polygon filling to obtain the mask area M of each hot area [1-x] , and the bbox of the mask area [1-x] .
[0055] In the step S1.1, the default sensitivity level is 0, 1, 2, and 3, and additional settings can be made according to requirements; the sensitivity mainly controls the combination method during morphological processing, wherein 0: erode once and dilate once, 1: erode once and dilate twice, 2: erode twice and dilate once, 3: dilate once and erode once, and 4: dilate twice and erode once.
[0056] The step S9, when the two bbox position relations satisfy certain conditions, the conditions can be pre-set, such as b3=b1|b2, the width and height of b3 and the width and height of b1 or b2 differ within 10 pixels, or the IOU (intersection over union) of b1 and b2 is greater than a given preset value, which can be set according to actual conditions. In fact, methods that can describe the position and size of b1 and b2 two boxes similar can be used.
[0057] The step S10 is specifically operated as,
[0058] S10.1, according to the result f2 of n bbox pairs of step S6, the ROI operation is performed to obtain n moving area binary graphs F [0-n] Then, the n bboxs and the bboxs of the hot area are traversed to perform 'and' operation, if there is intersection, the next step S10.2 is continued to judge, if not, the next bbox is traversed;
[0059] S10.2, if the i-th moving bbox i and the j-th hot area bboxj exist intersection, the dot product operation is performed on the corresponding moving area binary graph F i and the mask Mj of the hot area to obtain a new binary graph, and the number of non-zero points of the binary graph is counted, if greater than a preset threshold, it is determined as Tbbox, otherwise as Fbbox, and at the same time, the alarm state of the corresponding hot area is set to 1 to indicate that the moving object in the hot area is detected.
[0060] The method further comprises:
[0061] S11, judging whether to end the hot area detection function, if yes, ending; otherwise, continuing to execute step S2 to update the video frame data.
[0062] As shown in Figure 3 and Figure 4 The specific embodiment of the method of the application can also be described as follows:
[0063] 1. Start;
[0064] 2. Initialization operation;
[0065] 3. Obtain video frame data;
[0066] 4. Update the video frame data sequence;
[0067] 5. Frame difference is performed on the 0th data and the Lth data of the video frame sequence to obtain difference value data f;
[0068] 6. Thresholding operation is performed on the difference value data f to obtain binary data f1;
[0069] 7. Morphological processing of the data f1 according to different sensitivity settings to obtain f2;
[0070] 8. Edge detection of f2 to obtain m contour data sequences;
[0071] 9. Outer rectangle operation of the m contour data sequences to obtain m bbox;
[0072] 10. k times of fusion operation of the m bbox to obtain n bbox;
[0073] 11. Hot zone detection of the n bbox to obtain the final c bbox and the alarm state of the hot zone;
[0074] 12. Whether to end, if yes, end, if no, re-perform the step of acquiring video frame data and continue.
[0075] Wherein, the initialization operation further comprises the following:
[0076] Setting the sense sensitivity;
[0077] Setting the minimum detection size;
[0078] Setting the threshold value th of the threshold operation;
[0079] Setting the video frame sequence length L;
[0080] Setting the number of hot zones and the hot zone position information.
[0081] The above only describes the preferred embodiments of the present application and is not used to limit the present application. For those skilled in the art, the embodiments of the present application can have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for resolving false detections in hot zone detection, characterized in that, The method includes the following steps: S1, Initialization operation: including setting the threshold th for thresholding operation: predetermine a th, where the range is 0 < th < 255; setting the length L of the video frame sequence: predefined number of buffers for video frames; S2, Obtain video frame data: through the bitstream data acquisition interface, obtain the YUV data of each frame, and only extract the Y data; S3, Update the video frame data sequence: copy the Y data obtained in step S2 to the end of the video frame sequence. If the length of the copied data is greater than the preset video frame length L, delete the previous data from the beginning; S4, calculate the frame difference between the 0th and Lth data points of the video frame: f = f0 - f L ; S5, Thresholding operation: perform a thresholding operation on f obtained in step S4, set the pixel values greater than th to 255, and the values less than or equal to th to 0, generating a binary image f1; S6, Perform morphological processing: determine the corresponding morphological operation on f1 according to the configuration of the sensitivity sense, and obtain the data f2 after the operation; S7, Perform edge detection: perform edge detection on f2 to extract m contour information, where each contour information is a closed area composed of multiple points; S8, Bounding rectangle operation: perform a bounding rectangle operation on the m contour information obtained in step S7 to obtain m bboxes; S9, Fusion operation: perform a fusion operation on the m bboxes obtained in step S8, that is, perform K rounds of fusion operations. Finally, obtain n bboxes. Each round of fusion operation is to randomly select two bboxes from the current bbox set for comparison. When the positional relationship between these two bboxes meets certain conditions, these two bboxes are combined into a new bbox by performing an 'or' operation and update the bbox set. Otherwise, these two bboxes are retained; S10, Hot zone detection: perform hot zone detection on the n bboxes obtained in step S9 to obtain the final c bboxes and the alarm status of the hot zone.
2. The method for solving false detections in hot zone detection according to claim 1, characterized in that, Step S1 further includes: S1.1, Set the sensitivity sense: default set the sensitivity level, the larger the set value, the more sensitive; S1.2, Set the minimum detection size: used to filter bboxes, remove bboxes with a size smaller than the minimum detection size; S1.3, Set the threshold th for thresholding operation: predetermine a th, where the range is 0 < th < 255; S1.4, Set the length L of the video frame sequence: predefined number of buffers for video frames, L represents the number of video frames that can be saved simultaneously; S1.5, Set the number and location information of hot zones: Predefine the number of hot zones x, and the location information of the hot zones. The location information consists of a polygon composed of a series of pixel coordinates, with the pixel coordinates stored in clockwise or counterclockwise order starting from a certain point; and fill each hot zone with a polygon and multiply by 255 to obtain the mask area M of each hot zone. [1-x] and the bbox of the mask area [1-x] .
3. The method for solving false detections in hot zone detection according to claim 2, characterized in that, In step S1.1, the default sensitivity levels are 0, 1, 2, 3; this sensitivity is used to control the combination method during morphological processing. Among them, 0: erode once and dilate once, 1: erode once and dilate twice, 2: erode twice and dilate once, 3: dilate once and erode once, 4: dilate twice and erode once.
4. The method for solving false detections in hot zone detection according to claim 1, characterized in that, In step S9, when the positional relationship between these two bboxes meets certain conditions, the condition is that the preset b3 = b1 | b2, the width and height of b3 differ from the width and height of b1 or b2 by within 10 pixels, or the IOU of b1 and b2 is greater than a given preset value.
5. The method for solving false detections in hot zone detection according to claim 1, characterized in that, The specific operation of step S10 is S10.1, Based on the n bounding boxes, perform a Region of Interest (ROI) operation on the result f2 from step S6 to obtain n binary maps of moving regions F. [0-n] Then, iterate through the n bounding boxes and perform an AND operation with the bounding boxes in the hot zone. If there is an intersection, continue to the next step S10.2 to judge; otherwise, iterate through the next bounding box. S10.2, if it is assumed that the i-th moving bboxi and the j-th hot zone bboxj have an intersection, then the binary map F of the corresponding moving region will be... i and the mask M of the hot zone j Perform a dot product operation to obtain a new binary image. Count the number of non-zero points in the binary image. If the number is greater than a preset threshold, it is custom-marked as Tbbox; otherwise, it is custom-marked as Fbbox. At the same time, set the alarm status of the corresponding hot zone to 1 to indicate that a moving object has been detected in the hot zone.
6. The method for solving false detections in hot zone detection according to claim 1, characterized in that, The method further includes: S11, determine whether to end the hot zone detection function. If yes, end it; otherwise, continue to step S2 to update the video frame data.
Citation Information
Patent Citations
Low-complexity video motion detecting method based on image edge
CN105096321A
Multi-target tracking method based on multi-characteristic binding in combination with Camshift algorithm
CN108198206A
Abnormal moving object detection system and method thereof
CN108256501A