Target line passing detection method based on thermopile, terminal equipment and medium
By splitting the target frame in the thermopile video image and forming a trajectory, the problem of being indistinguishable between single and double people when two people are side by side is solved, and the accuracy of cross-line detection is improved.
Patent Information
- Application Number
- CN202411498872.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-03-04
AI Technical Summary
The existing thermopile-based target detection method is difficult to accurately distinguish between single and double people when two people are side by side, resulting in inaccurate cross-line detection.
By collecting the thermopile video image, the moving target box in each frame of the image is extracted and split it into two virtual target boxes to form two trajectories. Then, determine whether these trajectories have intersections with the straight line, and determine the authenticity of the trajectory based on the frame number threshold to judge the number of people passing the line.
It improves the accuracy of line detection when two people are side by side, and avoids the problem of indistinguishability when single and double people are the same imaging area.
Smart Images

Figure CN119559124A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of line crossing detection, and in particular to a target line crossing detection method based on a thermopile, a terminal device and a medium. Background Art
[0002] Thermopile is a temperature sensor with resolutions of 16*8, 16*16, 32*32, etc., in which each pixel represents a temperature value.
[0003] The main steps of the existing target detection based on hot spot pile include: 1) subtracting the high temperature area generated by pedestrians from the background; 2) obtaining the high temperature area of pedestrians after subtraction; 3) dividing the area of the high temperature area to distinguish whether it is a single person or a double person.
[0004] In the above method of distinguishing between a single person and a pair of people by area division, when two people stand side by side (shoulder distance is kept at least 20cm), the imaging area of a person with a large body and a relatively tall body is large, while the imaging area of a person with a small body and a short body is small. This will often result in the imaging area of a single person and a pair of people being the same, and the highest stable point is in the center of the detection area (such as Figure 1 In the figure, the left side shows the image of two people side by side, and the right side shows the image of a single person), it will be impossible to distinguish between a single person and a pair of people, resulting in the final target being missed. Summary of the invention
[0005] In order to solve the above problems, the present invention proposes a target crossing line detection method based on thermopile, terminal equipment and medium.
[0006] The specific plan is as follows:
[0007] A method for detecting a target crossing a line based on a thermopile comprises the following steps:
[0008] S1: Collect thermopile video images and extract the target frame corresponding to the moving target in each frame as the real target frame;
[0009] S2: for each frame image, determine whether the number of real target frames in it is 1. If yes, split the real target frame into two target frames, and use the two target frames as virtual target frames;
[0010] S3: Connect the two target frames contained in the connected frame images correspondingly through a tracking algorithm to form two tracks; the two target frames are two real target frames or two virtual target frames;
[0011] S4: Determine whether the number of frames containing two real target frames in all frame images corresponding to the two trajectories is greater than the frame number threshold. If so, retain the two trajectories; otherwise, retain only one of the two trajectories.
[0012] S5: judging whether it is a crossing line trajectory based on whether the retained trajectory has an intersection with the straight line, and judging the number of people crossing the line based on the number of crossing line trajectories in the retained trajectory.
[0013] Furthermore, when the real target frame is split into two target frames, the real target frame is moved to both sides along a direction parallel to the straight line used for line crossing judgment, and the distances moved to both sides are the same.
[0014] Furthermore, the moving distance is 2 pixels.
[0015] Furthermore, the frame number threshold is 2.
[0016] A target crossing line detection terminal device based on thermopile includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above method of the embodiment of the present invention are implemented.
[0017] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described above in an embodiment of the present invention are implemented.
[0018] The present invention adopts the above technical solution to improve the accuracy of line crossing detection when two people are walking side by side. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 Shown are images of the thermopile with two people crossing the line side by side and one person crossing the line.
[0020] Figure 2 Shown is a flow chart of a method according to a first embodiment of the present invention.
[0021] Figure 3 Shown is an image of the thermopile in this embodiment when a person walks from top to bottom.
[0022] Figure 4 Shown is a schematic diagram of the trajectory of two persons becoming one person in the conventional detection method in this embodiment.
[0023] Figure 5 Shown is a schematic diagram of the trajectory of the method of this embodiment. DETAILED DESCRIPTION
[0024] To further illustrate various embodiments, the present invention provides drawings. These drawings are part of the disclosure of the present invention, which are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in this field should be able to understand other possible implementations and advantages of the present invention.
[0025] The present invention will now be further described with reference to the accompanying drawings and specific implementation methods.
[0026] Embodiment 1:
[0027] The embodiment of the present invention provides a method for detecting a target crossing a line based on a thermopile. Figure 2 As shown, the method comprises the following steps:
[0028] S1: Collect thermopile video images and extract the target frame corresponding to the moving target in each frame as the real target frame.
[0029] Thermopiles are usually installed on top of the head and will collect the temperature value of the area below. In this embodiment, a thermopile with a resolution of 16*8 is used. Since the temperature will change when someone is under the thermopile, the color of the thermopile image will change. By filtering each frame of the thermopile image through the existing algorithm, the target box Box(x1,y1,x2,y2) of the moving target in each frame can be obtained, where (x1,y1) is the coordinate of the upper left corner of the target box, and (x2,y2) is the coordinate of the lower right corner of the target box. Figure 3 The image shown is a person walking from top to bottom, where the rectangular box is the target box.
[0030] S2: For each frame image, determine whether the number of real target frames therein is 1. If so, split the real target frame into two target frames, and use the two target frames as virtual target frames.
[0031] The virtual target box is used to form the trajectory later.
[0032] When two people pass by side by side, and the area of the detected target frame only meets the area of a single person, the number of real target frames detected is 1, expressed as Box(x1, y1, x2, y2). At this time, it is necessary to assume that there are two people, that is, there are two target frames. In order to split into two target frames, this embodiment is symmetrical, and the first virtual target frame is set to Box1(x1-s, y1, x2-s, y2), and the second virtual target frame is Box2(x1+s, y1, x2+s, y2), that is, the two target frames after splitting are the real target frames before splitting, which are moved s in both directions of the x-axis, and the x-axis is parallel to the straight line used for crossing the line judgment. s represents the translation distance, and its size is set according to the actual situation. In this embodiment, it is set to 2 pixels. It should be noted that the translation distance must satisfy the non-overlapping area of the two target frames obtained.
[0033] S3: The two target frames contained in the connected frame images are connected correspondingly through a tracking algorithm to form two tracks; the two target frames are two real target frames or two virtual target frames.
[0034] The tracking algorithm can adopt the existing algorithm and is not limited here.
[0035] Since each of the adjacent frames has two target frames, when connecting, the target frame to be connected can be selected based on the principle of minimum distance.
[0036] Since no matter it is a single person or a double person, when finally forming a trajectory, each frame has two target frames, so two trajectories will inevitably be formed.
[0037] S4: Determine whether the number of frames containing two real target frames in all frame images corresponding to the two trajectories is greater than a frame number threshold. If so, retain the two trajectories; otherwise, retain only one of the two trajectories.
[0038] The trajectory described in this embodiment is a complete trajectory, that is, from the first time the target appears in the image to the last time it appears in the image. Therefore, the frame images corresponding to the two trajectories formed are fixed. For example, if it is a trajectory formed by the t-th frame to the t+5-th frame image, it is only necessary to count the number of two real target frames contained in the t-th frame to the t+5-th frame image. If the number is greater than the frame number threshold (set to 2 in this embodiment), it is determined that both trajectories are real trajectories and are retained; otherwise, it is determined that only one of the two trajectories is the real trajectory, and one of the trajectories is randomly deleted, leaving only one trajectory.
[0039] S5: judging whether it is a crossing line trajectory based on whether the retained trajectory has an intersection with the straight line, and judging the number of people crossing the line based on the number of crossing line trajectories in the retained trajectory.
[0040] This straight line is used for line crossing judgment. When there is an intersection with this straight line, it is determined that the track crosses the line, that is, it is a line crossing track.
[0041] If two trajectories are retained and both cross the line, the number of people who cross the line is determined to be 2; if only one trajectory is retained and crosses the line, the number of people who cross the line is determined to be 1; if none of the retained trajectories cross the line, the number of people who cross the line is determined to be 0.
[0042] The above method is explained below through an example.
[0043] like Figure 4 As shown in the figure, the left and right images are schematic diagrams of the trajectory of two people becoming one person in the conventional detection method. The first one is that one target frame is detected more often, and the second one is that two target frames are detected more often, but in the end there is only one trajectory.
[0044] like Figure 5As shown in the figure, after being processed by the method of this embodiment, the single track becomes two, where the frame with a light gray background is the original real target frame with only one, and after splitting, it becomes two virtual target frames on the left and right. For the left picture, the number of frames containing two real target frames is 1, which is less than the frame number threshold of 2. Therefore, it is considered that one person crossed the line and one track needs to be eliminated. For the right picture, the number of frames containing two real target frames is 3, which is greater than the frame number threshold of 2. Therefore, it is considered that two people crossed the line and there is no need to eliminate the track.
[0045] In order to solve the problem that the imaging area of a single person and two persons cannot be distinguished, the embodiment of the present invention proposes a hypothesis method when only one person is imaged, and pre-assumes that there are two persons at present. If there are two persons in the image, keep the two persons. Then, the number of real detection frames (2 or 1) is counted by probability. If the number of 2 counted exceeds a threshold set by an artificial person, it is considered that there are two persons at present, and the situation of two persons side by side can be effectively detected.
[0046] Embodiment 2:
[0047] The present invention also provides a target crossing line detection terminal device based on thermopile, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the above method embodiment of embodiment 1 of the present invention when executing the computer program.
[0048] Further, as an executable solution, the target crossing line detection terminal device based on thermopile can be a computing device such as a desktop computer, a notebook, a PDA and a cloud server. The target crossing line detection terminal device based on thermopile can include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the composition structure of the target crossing line detection terminal device based on thermopile is only an example of a target crossing line detection terminal device based on thermopile, and does not constitute a limitation on the target crossing line detection terminal device based on thermopile. It can include more or less components than the above, or a combination of certain components, or different components. For example, the target crossing line detection terminal device based on thermopile can also include input and output devices, network access devices, buses, etc., and the embodiments of the present invention do not limit this.
[0049] Further, as an executable solution, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the target over-the-line detection terminal device based on thermopile, and uses various interfaces and lines to connect the various parts of the entire target over-the-line detection terminal device based on thermopile.
[0050] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the target over-line detection terminal device based on thermopile by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and an application required for at least one function; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0051] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method in the embodiment of the present invention are implemented.
[0052] If the module / unit integrated in the target over-line detection terminal device based on the thermopile is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory) and software distribution medium, etc.
[0053] Although the present invention has been specifically shown and described in conjunction with the preferred embodiments, it should be understood by those skilled in the art that various changes may be made to the present invention in form and details without departing from the spirit and scope of the present invention as defined by the appended claims, all of which are within the scope of protection of the present invention.
Claims
1. A method for detecting a target crossing a line based on a thermopile, characterized in that: The following steps are involved: S1: Collect thermopile video images and extract the target frame corresponding to the moving target in each frame as the real target frame; S2: for each frame image, determine whether the number of real target frames in it is 1. If yes, split the real target frame into two target frames, and use the two target frames as virtual target frames; S3: Connect the two target frames contained in the connected frame images correspondingly through a tracking algorithm to form two tracks; the two target frames are two real target frames or two virtual target frames; S4: Determine whether the number of frames containing two real target frames in all frame images corresponding to the two trajectories is greater than the frame number threshold. If so, retain the two trajectories; otherwise, retain only one of the two trajectories. S5: judging whether it is a crossing line trajectory based on whether the retained trajectory has an intersection with the straight line, and judging the number of people crossing the line based on the number of crossing line trajectories in the retained trajectory.
2. The method for detecting a target crossing a line based on a thermopile according to claim 1, characterized in that: When the real target frame is split into two target frames, the real target frame is moved to both sides along a direction parallel to the straight line used for line crossing judgment, and the distances moved to both sides are the same.
3. The method for detecting a target crossing a line based on a thermopile according to claim 2, characterized in that: The distance moved is 2 pixels.
4. The method for detecting a target crossing a line based on a thermopile according to claim 1, characterized in that: The frame number threshold is 2.
5. A target crossing line detection terminal device based on thermopile, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 4 when executing the computer program.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.