Target detection method and system based on depth interval filtering and area proportion analysis

By employing depth interval filtering and region proportion analysis, the problems of noise interference and low computational efficiency in target detection are solved, achieving fast and accurate target detection suitable for embedded devices.

CN122115869APending Publication Date: 2026-05-29HARBIN NAISHI INTELLIGENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HARBIN NAISHI INTELLIGENT TECH CO LTD
Filing Date
2026-04-03
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing technologies suffer from high noise interference and low computational efficiency in target detection, and both 2D vision solutions and multi-sensor fusion solutions have shortcomings.

Method used

The method employs depth interval filtering and region proportion analysis to achieve fast and accurate target detection through depth threshold screening and ROI region pixel proportion statistics, including depth data acquisition, depth interval filtering, ROI region definition, and pixel proportion statistics.

Benefits of technology

It improves noise resistance, increases computational efficiency, adapts to different scenarios, provides intuitive and clear detection results, and is suitable for real-time operation in embedded devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122115869A_ABST
    Figure CN122115869A_ABST
Patent Text Reader

Abstract

The application provides a target detection method and system based on depth interval filtering and area proportion analysis, belongs to the technical field of computer vision and pattern recognition, and acquires an original 16-bit depth gray image through a depth camera; based on a preset depth interval, a threshold segmentation function is used for threshold segmentation on the depth gray image to generate a filtered depth image; a plurality of key points are manually or automatically selected on the filtered depth image to construct a polygon ROI area; the proportion of non-zero pixels in the ROI area to total pixels is calculated; and whether a target exists is judged according to a preset threshold value to complete detection. The application realizes fast and accurate target detection through depth threshold screening and ROI area pixel proportion statistics, and solves the problems of large noise interference and low calculation efficiency in the existing depth image target detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer vision and pattern recognition technology, specifically relating to a target detection method and system based on depth interval filtering and region proportion analysis. Background Technology

[0002] Traditional detection techniques have the following problems: 1. Two-dimensional vision solution: When the target and background colors are similar (ΔE<2), the edge detection algorithm of ordinary RGB cameras fails due to the lack of effective contrast (false detection rate>40%). 2. Multi-sensor fusion solution: This requires the simultaneous deployment of LiDAR and visible light cameras, which presents problems such as high equipment costs (>50,000 yuan) and difficulties in data synchronization (latency >50ms). Summary of the Invention

[0003] To address the shortcomings of existing technologies and to solve the problems of high noise interference and low computational efficiency in current depth map target detection, this invention proposes a target detection method and system based on depth interval filtering and region proportion analysis. It achieves fast and accurate target detection through depth threshold screening and ROI region pixel proportion statistics.

[0004] This invention is achieved through the following technical solution: A target detection method based on depth interval filtering and region proportion analysis: The method specifically includes the following steps: Step 1. Depth Data Acquisition: Obtain the original 16-bit depth grayscale image (deep) using a depth camera; Step 2. Depth range filtering: Based on the preset depth range, the depth grayscale image 'deep' from Step 1 is segmented using OpenCV's threshold segmentation function to generate the filtered depth image 'deep_filter'. Step 3. ROI Region Definition: Manually or automatically select multiple key points on the filtered depth map to construct a polygonal ROI region; Step 4. Pixel percentage statistics: Calculate the percentage of non-zero pixels within the ROI region to the total number of pixels; Step 5. Target determination: Determine whether a target exists based on a preset threshold to complete the detection.

[0005] Further, in step 1, The 16-bit single-channel grayscale image deep has a data type of uint16_t and a unit of millimeters; A depth value of 0 indicates a measurement failure or that the measurement range has been exceeded, while a non-zero value indicates the effective depth.

[0006] Furthermore, in step 2, Define the effective depth range [d_min, d_max], where d_min is the minimum effective depth value and d_max is the maximum effective depth value, both in millimeters; Iterate through each pixel (x, y) in the grayscale image deep and obtain the depth value deep (x, y) corresponding to that pixel. Determine whether the depth value deep(x,y) satisfies d_min ≤ deep(x,y) ≤ d_max; If the depth value deep(x,y) satisfies the above conditions, the original depth value of the pixel is retained; otherwise, the depth value of the pixel is set to 0, and the pixel is marked as an invalid region. A filtered depth map, deep_filter, is generated based on all processed pixels.

[0007] Furthermore, in step 3, Select N key points on the filtered depth map deep_filter, where N is an integer greater than or equal to 3; Connect the selected N key points in sequence to form a closed polygonal region of interest (ROI).

[0008] Furthermore, in step 3, The key points are obtained through manual annotation or automatic detection. The manual annotation method is as follows: receive the click selection command input by the user through the interactive interface, and determine the position corresponding to the command as the key point; The automatic detection method is as follows: based on edge detection algorithm or clustering algorithm, extract the candidate region contours in the filtered depth map, and select the vertex of the largest contour as the key point.

[0009] Furthermore, in step 4, the pixel proportion statistics step specifically includes: Obtain the bounding rectangle of the polygonal ROI region, generate an initial mask with the same size as the filtered depth map, fill the polygonal ROI region into the initial mask as the effective region, and obtain the ROI mask; Based on the ROI mask, the effective content corresponding to the polygon ROI region is extracted from the filtered depth map deep_filter to obtain the ROI region image; Count the total number of pixels within the bounding rectangle of the ROI mask, and the number of non-zero pixels in the ROI region image; Calculate the ratio of the number of non-zero pixels to the total number of pixels to obtain the proportion of non-zero pixels to the total number of pixels within the ROI region.

[0010] A target detection system based on depth interval filtering and region proportion analysis; The system includes a depth data acquisition module, a depth interval filtering module, an ROI region definition module, a pixel ratio statistics module, and a target determination module. The depth data acquisition involves obtaining a raw 16-bit grayscale image (deep) using a depth camera. The depth range filtering module: Based on a preset depth range, it performs threshold segmentation on the depth grayscale image deep using OpenCV's threshold segmentation function to generate a filtered depth image deep_filter. The ROI region definition module: manually or automatically selects multiple key points on the filtered depth map to construct a polygonal ROI region; The pixel percentage statistics module calculates the percentage of non-zero pixels within the ROI region to the total number of pixels. The target determination module determines whether a target exists based on a preset threshold and completes the detection.

[0011] A computer device system includes a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above-described method. A computer-readable storage medium having a computer program / instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.

[0012] A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the method described above.

[0013] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) Strong noise resistance: Invalid depth values ​​(such as long-distance noise and reflection interference) are removed by filtering the depth range, which improves the reliability of subsequent analysis; (2) High computational efficiency: It only requires threshold segmentation, masking operations and simple statistics, without the need for complex feature extraction or deep learning models, making it suitable for real-time operation on embedded devices; (3) Adaptive adjustment: By adjusting d_min, d_max and T, it can flexibly adapt to different scenarios (such as indoor short-range detection and outdoor medium-range detection). (4) The results are intuitive: the physical meaning of the pixel ratio is clear, and the detection results are easy to interpret and verify. Attached Figure Description

[0014] Figure 1This is a flowchart of the method of the present invention.

[0015] Figure 2 This is a schematic diagram of depth range filtering: (a) original depth map; (b) filtered depth map.

[0016] Figure 3 This is a schematic diagram of ROI region mask filtering: (a) original depth map; (b) filtered mask; (c) filtered depth map. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] Unless otherwise specified, the experimental methods used in the following examples are conventional methods. Unless otherwise specified, the materials, reagents, methods, and instruments used are all conventional materials, reagents, methods, and instruments in the art, and can be obtained commercially by those skilled in the art.

[0019] like Figure 1 As shown, this invention proposes a target detection method based on depth interval filtering and region proportion analysis, including the following steps: Step 1: Depth data acquisition, obtaining the original 16-bit depth grayscale image through a depth camera; Depth information of the scene is acquired using a depth camera (such as Intel RealSense D435, Microsoft Kinect V2, Hikvision RGB-D intelligent stereo camera series, etc.), and the output is a 16-bit single-channel grayscale image (data type uint16_t, unit is millimeters). A depth value of 0 indicates measurement failure or exceeding the measurement range, while non-zero values ​​indicate valid depth.

[0020] Step 2: Depth range filtering. The original depth map is segmented based on a preset depth range to generate a filtered depth map. Define an effective depth range [d_min, d_max] (unit: millimeters), and process the depth using OpenCV's thresholding function to generate a filtered depth map, deep_filter. The specific steps are as follows: For each pixel (x,y) in deep, if its depth value satisfies d_min ≤ deep(x,y) ≤ d_max, then retain the original depth value; otherwise, set it to 0 (mark as an invalid region).

[0021] The mathematical expression is: Code implementation example (C++ / OpenCV): cv::Mat deep_filter; cv::inRange(deep, cv::Scalar(d_min), cv::Scalar(d_max), deep_filter); / / Output binary mask deep.copyTo(deep_filter, deep_filter); / / Apply a mask to preserve valid depth values Step 3: Define the ROI region. Manually or automatically select multiple key points on the filtered depth map to construct a polygonal ROI region. Select N keypoints (N≥3) on the deep_filter image and connect them sequentially to form a closed polygonal Region of Interest (ROI). Keypoints can be obtained in the following ways: Manual annotation: Users select via the interactive interface; Automatic detection: Extract candidate region contours based on edge detection or clustering algorithms, and select the vertices of the largest contour as key points.

[0022] The mathematical definition of a ROI is a set of polygon vertices P = {p_1(x_1,y_1), p_2(x_2,y_2), ..., p_N(x_N,y_N)}.

[0023] Step 4: Pixel percentage statistics, calculate the proportion of non-zero pixels in the ROI region to the total number of pixels; Iterate through all pixels within the ROI region, count the number of non-zero pixels (count_nonzero), and calculate the ratio of this count to the total number of pixels in the ROI (total_pixels). Code implementation example: cv::Rect roi_rect = cv::boundingRect(P); / / Get the bounding rectangle of the ROI cv::Mat roi_mask = cv::Mat::zeros(deep_filter.size(), CV_8UC1); cv::fillConvexPoly(roi_mask, P, cv::Scalar(255)); / / Generate ROI mask cv::Mat roi_region; deep_filter(roi_rect).copyTo(roi_region, roi_mask(roi_rect)); / / Extract the ROI region int total_pixels = cv::countNonZero(roi_mask(roi_rect)); int count_nonzero = cv::countNonZero(roi_region); double ratio = (double)count_nonzero / total_pixels; Step 5: Target determination, determine whether a target exists based on a preset threshold; Set a ratio threshold T (usually 0.3~0.7, adjusted according to the actual scenario). If ratio ≥ T, then the ROI is considered to have a target; otherwise, it is considered to have no target.

[0024] In the embodiments, the method of the present invention is experimentally verified: (1) Hardware environment: Depth camera: Intel RealSense D435 (resolution 1280×720, depth accuracy ±2mm@1m); Processor: Intel Core i5-1135G7 (quad-core, eight-thread, 2.4GHz). Memory: 16GB DDR4; Operating system: Ubuntu 20.04 LTS; Development framework: OpenCV 4.5.5, C++17 standard.

[0025] (2) Implementation steps: Initialize the depth camera: Configure camera parameters (resolution, frame rate, depth format) and start the data stream; Acquire raw depth map: Read a frame of 16-bit depth grayscale image (CV_16UC1 type); Set depth range: Based on the application scenario, set d_min=300mm (minimum effective distance) and d_max=2000mm (maximum effective distance); Perform depth filtering: Call cv::inRange to generate a mask, filter invalid depth values ​​to obtain deep_filter; Define the ROI region: Manually select 4 key points (such as the four vertices of a rectangle) using a mouse callback function to construct the ROI polygon; Pixel ratio statistics: Extract the ROI region and calculate the ratio of non-zero pixels; Target determination: Set a threshold T=0.5. If ratio≥0.5, output "Target detected", otherwise output "Target not detected".

[0026] (3) Test in a laboratory setting (the target is a 30cm×30cm cardboard box, placed at a distance of 500~1500mm from the camera): Invalid pixels account for approximately 25% of the original depth map (mainly background noise from distant locations); After depth-range filtering, the proportion of invalid pixels was reduced to 8%; The proportion of non-zero pixels in the ROI area (covering the cardboard box) is 0.62, which is greater than the threshold of 0.5, indicating that the target was correctly detected. When the cardboard box is moved out of the ROI area, the percentage drops to 0.12, indicating that there is no target.

[0027] Experimental results show that the method of the present invention has a detection accuracy of ≥95% in typical scenarios and a single frame processing time of ≤10ms, which meets the real-time requirements.

[0028] A computer device system includes a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above-described method. A computer-readable storage medium having a computer program / instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.

[0029] A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the method described above.

[0030] The memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous linked DRAM (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory of the methods described in this invention is intended to include, but is not limited to, these and any other suitable types of memory.

[0031] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired means such as coaxial cable, optical fiber, digital subscriber line, DSL, or wireless means such as infrared, wireless, microwave, etc. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium such as a floppy disk, hard disk, magnetic tape; an optical medium such as a high-density digital video disc, DVD; or a semiconductor medium such as a solid-state disk, SSD, etc.

[0032] In implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or by a combination of hardware and software modules in the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, detailed descriptions are omitted here.

[0033] It should be noted that the processor in the embodiments of this application can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method embodiments can be completed by the integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied as execution by a hardware decoding processor, or as execution by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above methods.

[0034] The above provides a detailed description of the target detection method and system based on depth interval filtering and region proportion analysis proposed in this invention, and elucidates the principles and implementation methods of this invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.

Claims

1. A target detection method based on depth interval filtering and region proportion analysis, characterized in that: The method specifically includes the following steps: Step 1. Depth Data Acquisition: Obtain the original 16-bit depth grayscale image (deep) using a depth camera; Step 2. Depth range filtering: Based on the preset depth range, the depth grayscale image 'deep' from Step 1 is segmented using OpenCV's threshold segmentation function to generate the filtered depth image 'deep_filter'. Step 3. ROI Region Definition: Manually or automatically select multiple key points on the filtered depth map to construct a polygonal ROI region; Step 4. Pixel percentage statistics: Calculate the percentage of non-zero pixels within the ROI region to the total number of pixels; Step 5. Target determination: Determine whether a target exists based on a preset threshold to complete the detection.

2. The method according to claim 1, characterized in that: In step 1, The 16-bit single-channel grayscale image deep has a data type of uint16_t and a unit of millimeters; A depth value of 0 indicates a measurement failure or that the measurement range has been exceeded, while a non-zero value indicates the effective depth.

3. The method according to claim 2, characterized in that: In step 2, Define the effective depth range [d_min, d_max], where d_min is the minimum effective depth value and d_max is the maximum effective depth value, both in millimeters; Iterate through each pixel (x, y) in the grayscale image deep and obtain the depth value deep(x, y) corresponding to that pixel. Determine whether the depth value deep(x,y) satisfies d_min ≤ deep(x,y) ≤ d_max; If the depth value deep(x,y) satisfies the above conditions, the original depth value of the pixel is retained; otherwise, the depth value of the pixel is set to 0, and the pixel is marked as an invalid region. A filtered depth map, deep_filter, is generated based on all processed pixels.

4. The method according to claim 3, characterized in that: In step 3, Select N key points on the filtered depth map deep_filter, where N is an integer greater than or equal to 3; Connect the selected N key points in sequence to form a closed polygonal region of interest (ROI).

5. The method according to claim 4, characterized in that: In step 3, The key points are obtained through manual annotation or automatic detection. The manual annotation method is as follows: receive the click selection command input by the user through the interactive interface, and determine the position corresponding to the command as the key point; The automatic detection method is as follows: based on edge detection algorithm or clustering algorithm, extract the candidate region contours in the filtered depth map, and select the vertex of the largest contour as the key point.

6. The method according to claim 5, characterized in that: In step 4, the pixel proportion statistics step specifically includes: Obtain the bounding rectangle of the polygonal ROI region, generate an initial mask with the same size as the filtered depth map, fill the polygonal ROI region in the initial mask as the effective region, and obtain the ROI mask; Based on the ROI mask, the effective content corresponding to the polygon ROI region is extracted from the filtered depth map deep_filter to obtain the ROI region image; Count the total number of pixels within the bounding rectangle of the ROI mask, and the number of non-zero pixels in the ROI region image; Calculate the ratio of the number of non-zero pixels to the total number of pixels to obtain the proportion of non-zero pixels to the total number of pixels within the ROI region.

7. A target detection system based on depth interval filtering and region proportion analysis, characterized in that: The system is used to execute the target detection method based on depth interval filtering and region proportion analysis as described in any one of claims 1 to 6; The system includes a depth data acquisition module, a depth interval filtering module, an ROI region definition module, a pixel ratio statistics module, and a target determination module. The depth data acquisition involves obtaining a raw 16-bit grayscale image (deep) using a depth camera. The depth range filtering module: Based on a preset depth range, it performs threshold segmentation on the depth grayscale image deep using OpenCV's threshold segmentation function to generate a filtered depth image deep_filter. The ROI region definition module: manually or automatically selects multiple key points on the filtered depth map to construct a polygonal ROI region; The pixel percentage statistics module calculates the percentage of non-zero pixels within the ROI region to the total number of pixels. The target determination module determines whether a target exists based on a preset threshold and completes the detection.

8. A computer device system, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1 to 6.

10. A computer program product comprising a computer program / instructions, characterized in that, When executed by a processor, the computer program instructions implement the steps of the method according to any one of claims 1 to 6.