Target detection and early warning method and system based on two-dimensional laser radar
By demarcating the rectangular area to be detected in the two-dimensional lidar coordinate system and using the pole diameter to indicate the side length, combined with the Raspberry Pi computer, the problem of video camera data leakage and the difficulty of customization of two-dimensional lidar is solved, real-time, Accurate target detection and early warning to adapt to the needs of different production scenarios.
Patent Information
- Application Number
- CN202411192743.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-20
AI Technical Summary
In production scenarios, using video cameras for target detection poses a risk of data leakage, and the customized development of two-dimensional lidar is difficult, and there is a lack of equipment available for simple debugging, making it difficult to meet the needs of different production scenarios.
By demarcating the rectangular area to be detected in the two-dimensional lidar coordinate system, using the pole diameter to represent the side length, optimizing the angle and distance relationship, fast object detection and early warning are achieved, and data processing and hardware interface integration are combined with a Raspberry Pi computer.
Real-time object detection and early warning are realized, detection efficiency and accuracy are improved, coordinate conversion complexity is reduced, and coordinate conversion is adapted to the needs of different application scenarios, and is not affected by lighting conditions. It has high computing efficiency and real-time performance.
Smart Images

Figure CN119165501A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of radar data processing technology, and in particular to a target detection and early warning method and system based on a two-dimensional laser radar. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] In production scenarios, target detection tasks mainly involve identifying various objects on the production line, including parts, tools, equipment or other important elements, and determining their location, quantity, status, etc. This information is crucial to achieving automated production, improving production efficiency and ensuring product quality.
[0004] Object detection usually relies on image or video data, using computer vision technology to identify and analyze objects in images. Object detection tasks in production scenarios usually involve automatic identification and positioning of objects in a specific area. In this scenario, dividing warning areas and setting up the function of triggering an alarm when a target appears is an important means to ensure production safety and improve production efficiency.
[0005] However, in some scenarios involving confidential production tasks, the use of video cameras for object detection may pose a risk of data leakage. Therefore, it is necessary to find an alternative information acquisition technology to ensure object detection under the premise of confidentiality.
[0006] As a common information acquisition technology, LiDAR plays an important role in confidential target detection. Different production scenarios and warning areas have different requirements for target detection. For example, the size, shape, and location of the warning area often require customized development of LiDAR to meet specific needs, including algorithm adjustment, parameter configuration, etc., which increases the difficulty of direct use. After detecting the target object, it is necessary to determine whether to trigger an alarm based on the preset decision logic. LiDAR needs to be integrated with other hardware devices (such as control systems, alarm devices, etc.), which requires compatible interfaces and communication protocols between devices. In addition to the debugging of hardware equipment, software system development and debugging are also required to ensure that hardware signals can be correctly received and processed.
[0007] In summary, for target detection tasks using two-dimensional lidar, there is still a lack of equipment that can be directly used through simple debugging. Summary of the invention
[0008] In order to solve the above problems, the present invention proposes a target detection and early warning method and system based on two-dimensional laser radar. Scene modeling is realized by defining a rectangular area to be detected parallel to the coordinate axis, thereby simplifying the expression of the range of the area to be detected. At the same time, according to the characteristics of laser scanning, the range of polar diameter is used to represent the side length of the rectangular area to be detected. By introducing the idea of polar coordinates in the plane rectangular coordinate system, the relationship between angle and distance is optimized, thereby improving the efficiency and convenience of the two-dimensional laser radar target detection task.
[0009] In order to achieve the above object, the present invention adopts the following technical solution:
[0010] In a first aspect, the present invention provides a target detection and early warning method based on a two-dimensional laser radar, comprising:
[0011] Construct a coordinate system with the 2D laser radar as the origin and mark the area to be detected as a rectangle;
[0012] Change the emission direction of the two-dimensional laser radar, scan and traverse the area to be detected; if there is an echo signal, calculate the distance between the two-dimensional laser radar and the target object;
[0013] Based on the vertex coordinates of the area to be detected and the emission angle of the two-dimensional laser radar, an expression of a straight line where the side length of the area to be detected is located is obtained, and constraint conditions of the area to be detected are constructed according to the expression;
[0014] If the distance between the two-dimensional laser radar and the target object is within the constraint condition, it is determined that there is a target object in the area to be detected and an early warning is issued.
[0015] Preferably, any right-angled side of the area to be detected is parallel to the x-axis and the y-axis of the coordinate system.
[0016] Preferably, the two-dimensional laser radar changes the emission direction of the laser beam by one or more rotating scanning mirrors.
[0017] Preferably, the calculating of the distance between the two-dimensional laser radar and the target object includes: collecting the time of laser emission and return at the current emission angle, and determining the distance between the two-dimensional laser radar and the target object based on the time difference.
[0018] Preferably, the expression of the straight line where the side length of the area to be detected is obtained based on the vertex coordinates of the area to be detected and the emission angle of the two-dimensional laser radar is specifically:
[0019]
[0020] Among them, the four vertices defining the rectangle of the area to be detected in the counterclockwise direction are (A 1 ,B 1 ), (A 2 ,B1 ), (A 2 ,B 2 ) and (A 1 ,B 2 ), and the straight lines where the sides of the rectangle lie are denoted by ρ 1 , 2 , 3 , 4 ; θ is the emission angle of the two-dimensional laser radar.
[0021] Preferably, the constraints are:
[0022]
[0023] Wherein, ρ is the distance between the two-dimensional laser radar and the target object when the two-dimensional laser radar generates an echo signal.
[0024] In a second aspect, the present invention provides a target detection and early warning system based on a two-dimensional laser radar, comprising:
[0025] The scene construction module is used to construct a coordinate system with the two-dimensional laser radar as the origin and mark the area to be detected as a rectangle;
[0026] The radar scanning module is used to change the emission direction of the two-dimensional laser radar, scan and traverse the area to be detected; if there is an echo signal, calculate the distance between the two-dimensional laser radar and the target object;
[0027] A constraint establishment module is used to obtain a straight line expression of the side length of the area to be detected based on the vertex coordinates of the area to be detected and the emission angle of the two-dimensional laser radar, and to construct a constraint condition of the area to be detected according to the expression;
[0028] The target detection module is used to determine that there is a target object in the area to be detected and issue an early warning if the distance between the two-dimensional laser radar and the target object is within the constraint condition.
[0029] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a target detection and early warning method based on two-dimensional laser radar described in the first aspect.
[0030] In a fourth aspect, the present invention provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of a target detection and early warning method based on two-dimensional laser radar described in the first aspect are implemented.
[0031] Compared with the prior art, the present invention has the following beneficial effects:
[0032] 1. In terms of processing effect, the present invention proposes for the first time a target detection and early warning processing method based on two-dimensional laser radar. The two-dimensional laser radar collects the original signal, divides the early warning area, determines whether there is a target object falling within the early warning area, and outputs the early warning signal in the form of hardware. The method provided by the present invention can realize real-time target detection and early warning. By using the range of the polar diameter to represent the side length of the rectangle, the polar coordinate data scanned by the two-dimensional laser radar can be intuitively linked to the rectangular detection area, reducing the complexity of coordinate conversion; at the same time, it is easy to process the changes in distance at different angles during the laser scanning process, and quickly determine whether there is a target object in the detection area, thereby improving the efficiency and convenience of target detection.
[0033] 2. In terms of practicality and scalability, the method combines a two-dimensional laser radar and a Raspberry Pi computer. In one embodiment, the warning area is first divided in a customized manner to determine whether there is an object in the warning area, and a warning signal is output in the form of hardware. The two-dimensional laser radar measures the distance and position of the target object by emitting a laser beam and receiving the reflected signal. This method is not affected by lighting conditions and can work stably during the day and at night, which improves the accuracy of detection. By adjusting the detection algorithm and parameter settings, the needs of different application scenarios can be met.
[0034] 3. In terms of computational efficiency, the scanning speed of 2D laser radar is usually very fast, and it can complete the scanning of the entire detection area in a short time. The data processing algorithm has low complexity and can meet the real-time requirements.
[0035] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their description are used to explain the present invention but do not constitute a limitation of the present invention.
[0037] Figure 1 A flow chart of a target detection and early warning method based on a two-dimensional laser radar provided in an embodiment of the present invention;
[0038] Figure 2 The early warning area division provided by the embodiment of the present invention;
[0039] Figure 3 The original signal of the two-dimensional laser radar provided in the embodiment of the present invention;
[0040] Figure 4 A visual display diagram of a radar signal provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0042] Embodiment 1
[0043] like Figure 1 As shown, this embodiment discloses a target detection and early warning method based on a two-dimensional laser radar, comprising the following steps:
[0044] S1: Establish a coordinate system with the two-dimensional laser radar as the origin, and mark the area to be detected as a rectangle;
[0045] S2: Change the emission direction of the two-dimensional laser radar, scan and traverse the area to be detected; if there is an echo signal, calculate the distance between the two-dimensional laser radar and the target object;
[0046] S3: Based on the vertex coordinates of the area to be detected and the emission angle of the two-dimensional laser radar, an expression of a straight line where the side length of the area to be detected is located is obtained, and constraint conditions of the area to be detected are constructed according to the expression;
[0047] S4: If the distance between the two-dimensional laser radar and the target object is within the constraint condition, it is determined that there is a target object in the area to be detected, and an early warning is issued.
[0048] Next, combine Figure 1 , the method described in this embodiment is described in detail.
[0049] In S1, a coordinate system is established with the two-dimensional laser radar as the origin, and the area to be detected is marked as a rectangle.
[0050] like Figure 2 As shown, a 2D laser radar is placed at the origin to establish a coordinate system. A rectangular area is predefined as a warning area to specify a specific range of objects to be detected. The orange rectangle in the figure is the marked area to be detected. Any right-angled side of the area to be detected is parallel to the x-axis and y-axis of the coordinate system.
[0051] Since the rectangle is parallel to the coordinate axis in this embodiment, it is convenient to use the polar diameter range to represent the side length of the rectangle later, and it is easier to derive the mathematical relationship between the polar diameter and the x, y coordinates, thereby simplifying the conversion logic from rectangular coordinates to polar coordinates.
[0052] In S2, the emission direction of the two-dimensional laser radar is changed to scan and traverse the area to be detected; if there is an echo signal, the distance between the two-dimensional laser radar and the target object is calculated.
[0053] Specifically, the two-dimensional laser radar changes the emission direction of the laser beam through one or more rotating scanning mirrors to scan the area to be detected and the surrounding environment. This enables the laser radar to obtain information from different directions in the environment. The original signal is as follows: Figure 3 As shown, including time, maximum angle, minimum angle, angle increment, time increment, etc.
[0054] Furthermore, the collected raw signals usually need to be processed to generate usable data or images, such as two-dimensional point cloud images. The specific steps are as follows:
[0055] a. Traverse the original data:
[0056] Starting from the initial angle, traverse according to the step size of the angle increment.
[0057] For each angle, the corresponding point coordinates are calculated on the two-dimensional plane based on the distance measured by the radar.
[0058] b. Calculate the point coordinates:
[0059] Assuming the radar is located at the origin (0,0), each detected point (x,y) can be calculated by the following formula:
[0060] x=r·cos(θ)
[0061] y=r·sin(θ)
[0062] Where r is the distance and θ is the current angle between the radar transmission beam and the x-axis of the coordinate system (the angle increment is accumulated from the initial angle).
[0063] c. Storage point coordinates:
[0064] Add the calculated point coordinates (x, y) to the point cloud collection.
[0065] d. Repeat steps:
[0066] Repeat the above steps until all angle values in the original data are traversed.
[0067] The visualization results are as follows Figure 4 As shown, the two-dimensional point cloud data generated from the raw data takes the lidar as the origin and the distance to the detected object.
[0068] The distance between the laser radar and the detected object is determined by collecting the time of laser emission and return at the current emission angle, and the distance between the two-dimensional laser radar and the target object is determined based on the time difference.
[0069] It should be understood that determining the distance between the radar and the target object based on the time difference is a commonly used ranging method in existing lidar technology.
[0070] In S3, based on the vertex coordinates of the area to be detected and the emission angle of the two-dimensional laser radar, the straight line expression of the side length of the area to be detected is obtained, and the constraint conditions of the area to be detected are constructed according to the expression.
[0071] As a specific implementation method, Figure 2 As shown, the four vertices of the rectangular area are marked counterclockwise (A 1 ,B 1 ), (A 2 ,B 1 ), (A 2 ,B 2 ), (A 1 ,B 2 ), in fact, we only need to know two horizontal coordinates A 1 ,A 2 and two ordinates B 1 , B 2 .
[0072] A 1 ,B 1 ) as an example, the rectangular coordinate position is converted into the position information (r, θ) of the spherical coordinate system, which is expressed as:
[0073]
[0074] θ=arctan2(B 1 ,A 1 )
[0075] Furthermore, to determine whether there is a target object in the warning area, it is only necessary to determine whether there is a radar signal in the warning area. After the rectangular warning area is converted into a polar coordinate system, (A 1 ,B 2 ),(A 2 ,B 2 )The straight line on which the line segment lies is represented as:
[0076]
[0077] Among them, θ is the angle of radar output data, ρ 1 For (A 1 ,B 2 ),(A 2 ,B 2 )The polar diameter of a point on the line on which the line segment lies.
[0078] In the polar coordinate system, ρ represents the distance from a point to the origin, and θ represents the angle between the point and the polar axis. In this embodiment, with the help of the idea of the polar coordinate system, since ρ changes with the change of the scanning angle, the set of ρ values at different angles represents the set of scanned points, so it can be expressed as (A 1 ,B 2 ),(A 2 ,B 2 )The line on which the line segment lies.
[0079] Figure 2 In the figure, the side lengths of the rectangular area to be detected, that is, the straight lines corresponding to the line segments numbered 1, 2, 3, and 4 are expressed as:
[0080]
[0081] Laser scanning usually starts from a central point (such as the location of the radar) and emits and receives echoes at different angles. In the polar coordinate system, this scanning process is very intuitive because, in this embodiment, the change of ρ corresponds to the change of the scanning direction. When the laser is emitted and scanned at different angles θ, the distance between the scanned point and the origin can be directly compared with the boundary of the rectangular side length without complex coordinate conversion, thereby simplifying the relationship between angle and distance.
[0082] In S4, if the distance between the two-dimensional laser radar and the target object is within the constraint condition, it is determined that there is a target object in the area to be detected, and an early warning is issued.
[0083] The area surrounded by the four straight lines is the warning area, so the warning area is between straight line 1 and straight line 3, and between straight line 2 and straight line 4. The constraint condition of the area to be detected is constructed according to the straight line expression to determine whether there is a radar signal in the warning area, which is expressed as:
[0084]
[0085] Among them, ρ is the length of the signal returned by the radar. When the above conditions are met, it means that the signal returned by the radar is within the warning area, that is, there is a target in the warning area.
[0086] Warning signal is transmitted: the signal is identified and the judgment signal is output in the form of hardware transmission.
[0087] This specific embodiment greatly simplifies the complex expression of the target area contour by accurately constructing the coordinate system and carefully modeling the scene of the area to be detected. Redundant points and unnecessary details in the complex contour are removed while retaining the main features of its shape. This process not only significantly reduces the storage volume of contour data, but also speeds up the subsequent processing speed, laying a solid foundation for real-time target detection tasks. At the same time, in order to optimize the representation of the distance from the radar to the target object, the contour of the area to be detected is represented by means of the constructed scene model and trigonometric functions. The simplified contour expression reduces the complexity of data processing, and the optimized distance representation improves the accuracy and speed of target detection.
[0088] Embodiment 2
[0089] This embodiment provides a target detection and early warning system based on a two-dimensional laser radar, including:
[0090] The scene construction module is used to construct a coordinate system with the two-dimensional laser radar as the origin and mark the area to be detected as a rectangle;
[0091] The radar scanning module is used to change the emission direction of the two-dimensional laser radar, scan and traverse the area to be detected; if there is an echo signal, calculate the distance between the two-dimensional laser radar and the target object;
[0092] A constraint establishment module is used to obtain a straight line expression of the side length of the area to be detected based on the vertex coordinates of the area to be detected and the emission angle of the two-dimensional laser radar, and to construct a constraint condition of the area to be detected according to the expression;
[0093] The target detection module is used to determine that there is a target object in the area to be detected and issue an early warning if the distance between the two-dimensional laser radar and the target object is within the constraint condition.
[0094] As a specific implementation, the radar scanning module includes a two-dimensional laser radar signal collector for collecting radar signals; the target detection module includes a Raspberry Pi computer, a microcomputer for data analysis and processing.
[0095] The 2D LiDAR signal collector captures and records the original signal reflected by the target after the radar is emitted. These signals contain key information such as the position, speed, and size of the target, which is crucial for subsequent signal processing, target recognition and other tasks.
[0096] Raspberry Pi computer is used for data analysis and processing. Raspberry Pi has a built-in ARM architecture processor with powerful computing power. Users can use programming to utilize this computing power to complete various complex tasks. The system is based on Linux and embedded with memory and hard disk to store operating system, applications and user data. The Raspberry Pi motherboard integrates multiple USB interfaces, Ethernet interfaces, HDMI high-definition video output interfaces, etc., which can be connected to various peripherals such as keyboard, mouse, monitor, etc., to facilitate user operation and expansion.
[0097] It should be noted that this article only focuses on devices that meet specific computing needs, and there are no strict requirements on the model or brand of the computer. Raspberry Pi computer, as a microcomputer that combines powerful functions, high flexibility and affordable prices, has become an ideal terminal computing device choice due to its compact size. In view of its excellent performance and portability, this invention selects Raspberry Pi as a key tool for radar signal analysis.
[0098] As a specific implementation, the target detection module also includes a relay, which receives the determination signal and amplifies the signal, and is used to connect other industrial alarm devices, such as warning lights and warning speakers.
[0099] The relay controls the on / off state of the low-current coil to affect the on / off state of the high-current circuit, thereby amplifying the signal to some extent. In this embodiment, the relay receives a weak signal from the Raspberry Pi computer, controls the corresponding early warning device according to the signal, and drives the early warning device to enter a working state, such as starting the alarm, shutting down dangerous equipment, etc. The Raspberry Pi computer and the relay are directly connected through the GPIO pin.
[0100] The early warning implementation process is as follows: First, install the RPi.GPIO library of Python on the Raspberry Pi computer. Then, use the GPIO pin 17 to control the output signal. Specifically, set a GPIO pin to input mode, and when the pin level changes, execute the relay control code. When the signal is judged that there is a target in the early warning area, the GPIO.output (17, GPIO.HIGH) relay is turned on, and the GPIO.output (17, GPIO.LOW) relay is turned off.
[0101] In a specific embodiment, a target detection and early warning processing system based on a two-dimensional laser radar is used to identify whether there is a target object in the early warning area. When there is an object in the early warning area, there is a radar signal in the early warning area, and the red light of the relay is on; when there is no object in the early warning area, there is no radar signal in the early warning area, and the red light of the relay is off.
[0102] Embodiment 3
[0103] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of a target detection and early warning method based on a two-dimensional laser radar as described in the first embodiment above are implemented.
[0104] Embodiment 4
[0105] This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of a target detection and early warning method based on two-dimensional laser radar as described in the first embodiment above are implemented.
[0106] The steps or modules involved in the above embodiments 2 to 4 correspond to those in embodiment 1. For the specific implementation, please refer to the relevant description of embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood to include any medium that can store, encode or carry an instruction set for execution by a processor and enable the processor to execute any method in the present invention.
[0107] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A target detection and early warning method based on two-dimensional laser radar, characterized in that: include: Establish a coordinate system with the two-dimensional laser radar as the origin, and mark the area to be detected as a rectangle; Change the emission direction of the two-dimensional laser radar, scan and traverse the area to be detected; if there is an echo signal, calculate the distance between the two-dimensional laser radar and the target object; Based on the vertex coordinates of the area to be detected and the emission angle of the two-dimensional laser radar, an expression of a straight line where the side length of the area to be detected is located is obtained, and constraint conditions of the area to be detected are constructed according to the expression; If the distance between the two-dimensional laser radar and the target object is within the constraint condition, it is determined that there is a target object in the area to be detected and an early warning is issued.
2. A target detection and early warning method based on two-dimensional laser radar as claimed in claim 1, characterized in that: Any right-angled side of the area to be detected is parallel to the x-axis and the y-axis of the coordinate system.
3. A target detection and early warning method based on two-dimensional laser radar as claimed in claim 1, characterized in that: The two-dimensional laser radar changes the emission direction of the laser beam by one or more rotating scanning mirrors.
4. A target detection and early warning method based on two-dimensional laser radar as claimed in claim 1, characterized in that: The calculation of the distance between the two-dimensional laser radar and the target object includes: collecting the time of laser emission and return at the current emission angle, and determining the distance between the two-dimensional laser radar and the target object based on the time difference.
5. The target detection and early warning method based on two-dimensional laser radar as claimed in claim 1, characterized in that: The expression of the straight line where the side length of the area to be detected is obtained based on the vertex coordinates of the area to be detected and the emission angle of the two-dimensional laser radar is: Among them, the four vertices of the rectangle of the area to be detected are defined in the counterclockwise direction as (A1, B1), (A2, B1), (A2, B2) and (A1, B2); the straight lines where the sides of the rectangle are located are represented as ρ1, ρ2, ρ3, ρ4 respectively; θ is the emission angle of the two-dimensional laser radar.
6. A target detection and early warning method based on two-dimensional laser radar as claimed in claim 1, characterized in that: The constraints are: Wherein, ρ is the distance between the two-dimensional laser radar and the target object when the two-dimensional laser radar generates an echo signal.
7. A target detection and early warning system based on two-dimensional laser radar, characterized in that: include: The scene construction module is used to establish a coordinate system with the two-dimensional laser radar as the origin and mark the area to be detected as a rectangle; The radar scanning module is used to change the emission direction of the two-dimensional laser radar, scan and traverse the area to be detected; if there is an echo signal, calculate the distance between the two-dimensional laser radar and the target object; A constraint establishment module is used to obtain a straight line expression of the side length of the area to be detected based on the vertex coordinates of the area to be detected and the emission angle of the two-dimensional laser radar, and to construct a constraint condition of the area to be detected according to the expression; The target detection module is used to determine that there is a target object in the area to be detected and issue an early warning if the distance between the two-dimensional laser radar and the target object is within the constraint condition.
8. A target detection and early warning method based on two-dimensional laser radar as claimed in claim 7, characterized in that: Any right-angled side of the area to be detected is parallel to the x-axis and the y-axis of the coordinate system.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by the processor, the steps in the target detection and early warning method based on two-dimensional laser radar as described in any one of claims 1 to 6 are implemented.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps in the target detection and early warning method based on two-dimensional laser radar as described in any one of claims 1-6 are implemented.
Citation Information
Cited By
Electric window anti-pinch method based on laser radar, electric window and storage medium
CN120159261A
A laser radar-based electric window anti-pinch method, electric window and storage medium
CN120159261B
