Human body tracking method and related equipment
By constructing the distance matrix and hit matrix in infrared images, determining the user's moving distance and setting preset values, the existing human tracking technology has solved the problems of high cost and low accuracy, and high-precision and low-cost human tracking are achieved.
Patent Information
- Application Number
- CN202210278391.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-21
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2042-03-21
AI Technical Summary
The existing human body tracking technology is costly, and the algorithms for model training and position box marking are complex.
By determining the moving distance between users in two adjacent infrared images, a distance matrix and a hit matrix are constructed, the minimum distance is determined and the preset value of the hit matrix element is set, interference from tracked users is eliminated, and human body tracking is realized.
It reduces the cost of human body tracking, improves tracking accuracy, and achieves high-precision human body tracking at lower costs.
Smart Images

Figure CN114693734B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of thermal imaging technology, and in particular to a human body tracking method and related equipment. Background Art
[0002] Human tracking technology is a technology that uses monitoring equipment to track tasks and can be applied to areas such as security prevention and control.
[0003] At present, human body tracking technology obtains videos through monitoring equipment, marks the position frame of the human body in the previous frame of the video, and then uses the position frame to track the human body in the next frame. This method requires the use of a trained model to mark the position frame, which requires a high cost for model training, and the algorithm used for marking the position frame is relatively complex, making the cost of human body tracking high. Summary of the invention
[0004] The present invention provides a human body tracking method and related equipment to solve the problem of high cost of human body tracking.
[0005] In one aspect, the present invention provides a human body tracking method, comprising:
[0006] Determine a moving distance between each first user in the first infrared image and each second user in the second infrared image, and construct a distance matrix and a hit matrix according to each of the moving distances, wherein the first infrared image and the second infrared image are adjacent frame images, and each element in the hit matrix corresponds to a moving distance in the distance matrix;
[0007] Determining a minimum distance in the distance matrix, and determining a first user and a second user corresponding to the minimum distance as the same user;
[0008] The values of the first elements on the target row and the target column of the hit matrix are set to preset values so that the moving distance corresponding to the first element in the distance matrix does not participate in the determination of the minimum distance in the next round, wherein the target row and the target column are the rows and columns where the elements corresponding to the minimum distance in the hit matrix are located;
[0009] When the values of the elements in the hit matrix are not all preset values, the step of determining the minimum distance in the distance matrix is returned to be executed.
[0010] In one embodiment, the step of determining the first user and the second user corresponding to the minimum distance as the same user includes:
[0011] Determining whether the minimum distance is less than a preset distance;
[0012] When the minimum distance is less than a preset distance, the first user and the second user corresponding to the minimum distance are determined to be the same user.
[0013] In one embodiment, the acquisition time point of the second infrared image is later than the acquisition time point of the first infrared image, and the method further includes:
[0014] When the minimum distance is greater than or equal to a preset distance, acquiring a third infrared image, wherein the third infrared image and the second infrared image are adjacent frame images;
[0015] updating the second infrared image to the first infrared image, updating each of the second users to the first user, and updating the third infrared image to the second infrared image;
[0016] The step of determining the moving distance between each first user in the first infrared image and each second user in the second infrared image is performed again.
[0017] In one embodiment, the acquisition time point of the second infrared image is later than the acquisition time point of the first infrared image, and the step of determining the moving distance between each first user in the first infrared image and each second user in the second infrared image comprises:
[0018] Determine an area of a first sub-region corresponding to each of the first users in the first infrared image and a maximum temperature of each first pixel in the first sub-region;
[0019] Acquire a first coordinate of each of the first users in the first infrared image, and a second coordinate of each of the second users in the second infrared image;
[0020] determining, according to the first coordinates of each of the first users and the second coordinates of each of the second users, the Euclidean distance between each of the first users and each of the second users;
[0021] The moving distance between each of the first users and each of the second users is determined according to the Euclidean distance corresponding to each of the first users, the maximum temperature, and the area.
[0022] In one embodiment, the step of determining the moving distance between each of the first users and each of the second users according to the Euclidean distance corresponding to each of the first users, the maximum temperature, and the area includes:
[0023] Acquire a first distance between each of the first users and the center of the first infrared image;
[0024] determining a first correction value corresponding to each of the first users according to a first coefficient, a first distance corresponding to each of the first users, and a maximum temperature, and determining a second correction value according to a second coefficient, a first distance corresponding to each of the first users, and an area;
[0025] The Euclidean distance corresponding to each of the first users is corrected according to the first correction value and the second correction value corresponding to each of the first users, so as to obtain the moving distance between each of the first users and each of the second users.
[0026] In one embodiment, determining the area of the first sub-region corresponding to each of the first users in the first infrared image includes:
[0027] Processing the temperature of the pixel points in the first infrared image that exceed a preset temperature range to obtain a fourth infrared image, wherein the temperature of the pixel points after the processing is less than a lower limit of the preset temperature range, and the preset temperature range is determined according to a human body temperature range;
[0028] Dividing the fourth infrared image into a plurality of second sub-regions, determining a second pixel point with the maximum temperature in each second sub-region, and synthesizing each of the second pixel points into a fifth infrared image;
[0029] Dividing the fifth infrared image into a plurality of third sub-regions, determining a third pixel point with the largest temperature in each third sub-region, and setting the third sub-region where the third pixel point with a temperature greater than a first preset temperature is located to a first preset color to obtain a fourth sub-region, wherein the first preset temperature is greater than the lower limit value;
[0030] Combining the adjacent fourth sub-regions into a first sub-region, and determining the non-adjacent fourth sub-regions as a first sub-region;
[0031] An area of a first sub-region corresponding to the first user is determined.
[0032] In one embodiment, the step of obtaining the first coordinates of each of the first users in the first infrared image includes:
[0033] Acquire a third coordinate of each first pixel point in the first sub-area corresponding to the first user in the first infrared image;
[0034] Determine an average abscissa and an average ordinate according to each of the third coordinates;
[0035] A first coordinate of the first user is determined according to the average horizontal coordinate and the average vertical coordinate.
[0036] In one embodiment, after the step of determining the non-adjacent fourth sub-regions as a first sub-region, the method further includes:
[0037] The number of first users is determined according to the number of the first sub-areas.
[0038] In one embodiment, the determining of the number of first users according to the number of the first sub-areas
[0039] The steps of measurement include:
[0040] determining whether parameters of the first sub-regions meet set conditions, the parameters including the number and / or area of the first sub-regions, the set conditions including that the number of the first sub-regions is greater than an expected number and / or the area of the first sub-regions is less than a preset area;
[0041] When the parameters of the first sub-areas meet the set conditions, the number of first users is determined according to the number of the first sub-areas.
[0042] In one embodiment, after the step of determining whether the parameters of the first sub-area meet the set conditions, the method further includes:
[0043] When the parameter of the first sub-region does not meet the set condition, reducing the first preset temperature to obtain a second preset temperature, and the second preset temperature is greater than the lower limit value;
[0044] The third sub-region where the third pixel point having a temperature greater than the second preset temperature is located is set to the first preset color to obtain a fourth sub-region;
[0045] Return to the step of combining the adjacent fourth sub-regions into one first sub-region.
[0046] In one embodiment, the step of setting the third sub-region where the third pixel point having a temperature greater than the first preset temperature is located to the first preset color comprises:
[0047] The third sub-region where the third pixel point having a temperature greater than the first preset temperature is located is set to the first preset color, and the third sub-region where the third pixel point having a temperature less than or equal to the first preset temperature is located is set to the second preset color.
[0048] In one embodiment, after the step of determining the non-adjacent fourth sub-region as a first sub-region, the method further includes:
[0049] When the maximum temperature in the first sub-area is greater than a third preset temperature, an alarm message is output, the third preset temperature is greater than the first preset temperature, and the third preset temperature is determined according to a normal body temperature of a human body.
[0050] In one embodiment, the first infrared image and the second infrared image are collected in a vertical direction.
[0051] In another aspect, the present invention further provides a human body tracking device, comprising:
[0052] a determination module, configured to determine a moving distance between each first user in the first infrared image and each second user in the second infrared image, and construct a distance matrix and a hit matrix according to each of the moving distances, wherein the first infrared image and the second infrared image are adjacent frame images;
[0053] The determination module is further used to determine a minimum distance in the distance matrix, and determine the first user and the second user corresponding to the minimum distance as the same user, and each element in the hit matrix corresponds to a moving distance in the distance matrix;
[0054] A setting module, used to set the value of each first element on the target row and target column of the hit matrix to a preset value, so that the moving distance corresponding to the first element in the distance matrix does not participate in the determination of the minimum distance in the next round, wherein the target row and the target column are the row and column where the element corresponding to the minimum distance in the hit matrix is located;
[0055] The execution module is used to return to the step of determining the minimum distance in the distance matrix when the values of the elements in the hit matrix are not all preset values.
[0056] On the other hand, the present invention also provides a human body tracking device, comprising: a memory and a processor;
[0057] The memory stores computer-executable instructions;
[0058] The processor executes the computer-executable instructions stored in the memory, so that the processor performs the human body tracking method as described above.
[0059] On the other hand, the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the human body tracking method as described above.
[0060] The human body tracking method and related equipment provided by the present invention determine the moving distance between each first user in the first infrared image and each second user in the second infrared image, construct a distance matrix and a hit matrix according to each moving distance, determine the minimum distance in the distance matrix, determine the first user and the second user corresponding to the minimum distance as the same user, and set the value of each first element of the hit matrix to a preset value so that the moving distance of the first element in the distance matrix does not participate in the determination of the minimum distance in the next round, and then return to execute the step of determining the minimum distance in the distance matrix to perform the next round of human body tracking. In the present invention, human body tracking can be achieved through the moving distance between users in two adjacent frames of infrared images, without the need to use a model for human body tracking, thereby reducing the cost of human body tracking. Furthermore, by changing the value of the elements in the hit matrix, the interference of the tracked human body is eliminated, and the accuracy of human body tracking is improved, that is, high-precision human body tracking is achieved at a lower tracking cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0062] Figure 1 A schematic diagram of a scene of a human body tracking method of the present invention;
[0063] Figure 2 It is a flowchart of the first embodiment of the human body tracking method of the present invention;
[0064] Figure 3 This is a detailed flow chart of step S20 in the second embodiment of the human body tracking method of the present invention;
[0065] Figure 4 This is a detailed flow chart of step S10 in the third embodiment of the human body tracking method of the present invention;
[0066] Figure 5 This is a detailed flow chart of step S14 in the fourth embodiment of the human body tracking method of the present invention;
[0067] Figure 6 This is a detailed flow chart of step S11 in the fifth embodiment of the human body tracking method of the present invention;
[0068] Figure 7 It is a schematic diagram of the modules of the human body tracking device of the present invention;
[0069] Figure 8 It is a schematic diagram of the structure of the human body tracking device of the present invention.
[0070] The above drawings show clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0071] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0072] The present invention provides a human body tracking method. Figure 1 As shown, the human tracking device 100 obtains infrared images of adjacent frames, and can determine the user in each infrared image based on the temperature of the pixels in the infrared image, and then determine the distance between the user in one infrared image and the user in another infrared image, and the relationship between the user in the next infrared image and the user in the previous infrared image can be determined by the distance. Figure 1 As shown, there are four users A, B, C, and D in the previous frame of infrared image 10 acquired by the human tracking device 100 (A, B, C, and D are customized users), and there are also four users in the next frame of infrared image 20. After tracking based on the human tracking device 100, the users of the next frame of infrared image 20 are determined to be A1, B1, C1, and D1, wherein A1 is user A in the previous frame of infrared image 10, B1 is user B in the previous frame of infrared image 10, C1 is user C in the previous frame of infrared image 10, and D1 is user D in the previous frame of infrared image 10.
[0073] The following specific embodiments are used to describe in detail the technical solutions of the present invention and how the technical solutions of the present application solve the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.
[0074] Reference Figure 2 , Figure 2 The first embodiment of the human body tracking method of the present invention comprises the following steps:
[0075] Step S10, determine the moving distance between each first user in the first infrared image and each second user in the second infrared image, and construct a distance matrix and a hit matrix according to each moving distance. The first infrared image and the second infrared image are adjacent frame images, and each element in the hit matrix corresponds to a moving distance in the distance matrix.
[0076] In this embodiment, the execution subject is a human body tracking device. For the convenience of description, the term "device" is used below to refer to the human body tracking device. The device can be any terminal device with image processing capabilities.
[0077] The device obtains two infrared images of adjacent frames for tracking, and the two infrared images of adjacent frames are defined as the first infrared image and the second infrared image. Infrared image refers to an image formed by thermal imaging. Each pixel in the infrared image has a corresponding temperature, and the temperature of the human body is known, so each human body can be identified in the infrared image, and each human body corresponds to a user. The user in the first infrared image is defined as the first user, and the user in the second infrared image is defined as the second user.
[0078] The device can calculate the distance between each first user in the first infrared image and each second user in the second infrared image, and the distance is defined as the movement distance. Specifically, the first user and the second user are both located in the image coordinate system, and the movement distance can be determined based on the coordinates of the first user and the second user in the image coordinate system.
[0079] The device then constructs a distance matrix and a hit matrix based on each moving distance. For example, the first infrared image includes four first users numbered 1, 2, 3, and 4, and the second infrared image includes four second users numbered 1, 2, 3, and 4, then A 11 represents the moving distance between the first user numbered 1 and the second user numbered 1, and so on to obtain multiple A nm . Arrange the numbers of each moving distance to get an n*m distance matrix. For example, if there are 3 first users and 3 second users, then the distance matrix A is:
[0080]
[0081] The device also constructs a hit matrix, each element of the hit matrix corresponds to a distance matrix in the distance matrix, and the value of each element of the hit matrix is a default value. For example, the default value is 1, and the distance matrix is a 3*3 matrix, then the hit matrix B:
[0082]
[0083] Step S20, determining the minimum distance in the distance matrix, and determining the first user and the second user corresponding to the minimum distance as the same user, each element in the hit matrix corresponds to a moving distance in the distance matrix.
[0084] Since the acquisition time points between the infrared images of adjacent frames are small, if the first user moves, a small displacement will occur, that is, the same user in the two infrared images will have a small displacement. In this regard, the device determines the minimum distance in the distance matrix. The first user and the second user corresponding to the minimum distance are the same user, thereby completing the tracking of a first user in the first infrared image. For example, the minimum distance is A 22 , then the first user numbered 2 in the first infrared image and the second user numbered 2 in the second infrared image are the same user.
[0085] Step S30, sets the value of each first element on the target row and target column of the hit matrix to a preset value so that the moving distance corresponding to the first element in the distance matrix does not participate in the determination of the next round of minimum distance, wherein the target row and target column are the rows and columns where the element corresponding to the minimum distance in the hit matrix is located.
[0086] After completing the tracking of a first user, it is necessary to track other first users in the first infrared image. The movement distances of the successfully tracked users can be deleted, thereby reducing the calculation amount for the next first user. 22 is the minimum distance, then the moving distances of the successfully tracked users also include all moving distances with the number 2, that is, A 12 , A 22 , A 32 , A 21 and A 23 . In this regard, the device sets the value of each first element in the hit matrix to a preset value, which can be any value, for example, the preset value is 0. Each first element is the row and column where the target element is located in the hit matrix, and the target element is the element corresponding to the minimum distance in the hit matrix, that is, the value of each first element of the target row and target column in the hit matrix is set to a preset value, and the target row and target column are the row and column where the element corresponding to the minimum distance in the hit matrix is located. For example, the minimum distance is A 22 , then the row of each first element in the hit matrix is the second row and the column is the second column, that is, the values of the elements in the second row and the second column are set to the preset values, then the matrix B:
[0087]
[0088] The value of each first element is set to the preset value, and the moving distance corresponding to the first element in the distance matrix does not participate in the determination of the minimum distance in the next round. The current minimum distance is A 22 , after setting the value of the first element to the preset value, A 12 , A 22 , A 32 , A 21 and A 23 Do not participate in the determination of the minimum distance of the next round, that is, the minimum distance of the next round is A 11 , A 13 , A 31 and A 33 In the confirmation.
[0089] Step S40, determining whether the values of the elements in the hit matrix are all preset values.
[0090] When the values of the elements in the hit matrix are not all preset values, it is necessary to determine the minimum distance for the next round, that is, return to step S20 to track other first users. If the values of the elements in the hit matrix are all preset values, it can be determined that all first users in the first infrared image have been tracked.
[0091] In the technical solution provided in this embodiment, the moving distance between each first user in the first infrared image and each second user in the second infrared image is determined, and a distance matrix and a hit matrix are constructed according to each moving distance, and the minimum distance is determined in the distance matrix, and the first user and the second user corresponding to the minimum distance are determined as the same user, and the value of each first element of the hit matrix is set to a preset value so that the moving distance of the first element in the distance matrix does not participate in the determination of the minimum distance in the next round, and then the step of determining the minimum distance in the distance matrix is returned to perform the next round of human body tracking. In the present invention, human body tracking can be achieved through the moving distance between users in two adjacent frames of infrared images, and there is no need to use a model for human body tracking, which reduces the cost of human body tracking. Furthermore, by changing the value of the elements in the hit matrix, the interference of the tracked human body is eliminated, and the accuracy of human body tracking is improved, that is, high-precision human body tracking is achieved at a lower tracking cost.
[0092] Reference Figure 3 , Figure 3 This is the second embodiment of the tracking method of the present inventor, based on the first embodiment, step S20 includes:
[0093] Step S21, determining whether the minimum distance is less than a preset distance.
[0094] In this embodiment, a new user may appear in the infrared image collected at a later time point, and the moving distance between the new user and the user in the infrared image collected at an earlier time point may be relatively large.
[0095] For this, a preset distance is set in the device. After the minimum distance is obtained, it is determined whether the minimum distance is less than the preset distance.
[0096] Step S22: when the minimum distance is less than a preset distance, the first user and the second user corresponding to the minimum distance are determined to be the same user.
[0097] If the distance is less than the preset distance, it can be determined that the first user and the second user corresponding to the minimum distance are the same user.
[0098] If the minimum distance is greater than or equal to the preset distance, all first users in the first infrared image have been tracked. The device can start a new round of human body tracking. For example, there are three first users A, B, and C in the first infrared image, and four second users A, C, D, and E in the second infrared image. The minimum distance obtained in the third round is greater than or equal to the preset distance, which means that the tracking of users AC in the first infrared image is completed, and the tracking of the four second users A, C, D, and E in the second infrared image can be performed in the third infrared image.
[0099] In this regard, the device acquires a third infrared image, the third infrared image and the second infrared image are adjacent frame images, and the acquisition time point of the third infrared image is later than that of the second infrared image. The device updates the second infrared image to the first infrared image, updates each second user to the first user, and updates the third infrared image to the second infrared image, thereby returning to step S10 to perform a new round of human body tracking.
[0100] In this embodiment, after determining the minimum distance in the distance matrix, it is determined whether the minimum matrix is less than the preset distance. If the minimum distance is less than the preset distance, the first user and the second user corresponding to the minimum distance are determined to be the same user. If the minimum distance is greater than or equal to the preset distance, the tracking of all human bodies in the infrared image is completed.
[0101] Reference Figure 4 , Figure 4 This is the third embodiment of the human body tracking method of the present invention, based on the first or second embodiment, step S10 includes:
[0102] Step S11: determining the area of a first sub-region corresponding to each of the first users in the first infrared image and the maximum temperature of each first pixel in the first sub-region.
[0103] In this embodiment, the farther the human body is from the lens of the acquisition device for acquiring infrared images, the lower the temperature of the human body represented in the infrared image will be. In addition, according to the principle of lens imaging, the farther the human body is from the optical axis of the lens, the larger the obtained image will be. In addition, when the user moves, the temperature of the collected user will rise or fall. Therefore, the moving distance between the first user and the second user has a certain relationship with the temperature of the human body in the first infrared image and the area occupied by the human body in the first infrared image.
[0104] The first user corresponds to a sub-region on the first infrared image, and the sub-region is defined as a first sub-region, and each pixel point in the first sub-region defines a first pixel point. Each first pixel point has a corresponding temperature, and the device determines the maximum temperature among each first pixel point corresponding to each first user, and obtains the area of the first sub-region corresponding to the first user.
[0105] Step S12, obtaining a first coordinate of each first user in the first infrared image, and a second coordinate of each second user in the second infrared image.
[0106] The device obtains the first coordinates of each first user in the first infrared image and the second coordinates of each second user in the second infrared image.
[0107] Step S13: determining the Euclidean distance between each first user and each second user according to the first coordinate of each first user and the second coordinate of each second user.
[0108] Based on each first coordinate and each second coordinate, the Euclidean distance between each first user and each second user can be determined.
[0109] Step S14: determining the moving distance between each first user and each second user according to the Euclidean distance, maximum temperature, and area corresponding to each first user.
[0110] The device corrects the Euclidean distance corresponding to each first user according to the maximum temperature and the area, and obtains the moving distance between each first user and each user.
[0111] In this embodiment, the device corrects the Euclidean distance between the first user and the second user based on the maximum temperature and area corresponding to the first user, thereby more accurately tracking the human body.
[0112] Reference Figure 5 , Figure 5 This is the fourth embodiment of the human body tracking method of the present invention. Based on the fourth embodiment, step S14 includes:
[0113] Step S141, obtaining a first distance between each first user and the center of the first infrared image.
[0114] In this embodiment, the infrared image will be distorted, and the farther away from the center of the picture, the more serious the distortion. Therefore, the distortion needs to be taken into account. In this regard, the device obtains the distance between each first user and the central paper of the first infrared image, that is, determines the distance between the first user and the center of the picture, which is defined as the first distance L0.
[0115] Step S142, determining a first correction value corresponding to each first user according to the first coefficient, the first distance corresponding to each first user, and the maximum temperature, and determining a second correction value according to the second coefficient, the first distance corresponding to each first user, and the area.
[0116] The distortion will affect the maximum temperature and the temperature. To this end, the influence of the distortion on the maximum temperature can be converted into a first coefficient, and the influence of the distortion on the area can be converted into a second coefficient.
[0117] The device obtains a first correction value corresponding to each first user according to the first coefficient, the first distance corresponding to each first user, and the maximum temperature. The first correction value Pt=Tmax+0.001*L0, where Tmax is the maximum temperature, 0.001 is the first coefficient, and L0 is the first distance. The first coefficient is not limited to 0.001 and can be set according to actual conditions.
[0118] The device then determines a second correction value according to the second coefficient, the first distance corresponding to each first user, and the area, the second correction value Ps=S-0.002*L0, where S is the area, 0.002 is the second coefficient, and L0 is the first distance. The second coefficient is not limited to 0.002 and can be set according to actual conditions.
[0119] Step S143: Correct the Euclidean distance corresponding to each first user according to the first correction value and the second correction value corresponding to each first user, and obtain the moving distance between each first user and each second user.
[0120] After obtaining the first correction value and the second correction value corresponding to each first user, the device can correct the Euclidean distance of the first user according to the first correction value and the second correction value of each first user to obtain the moving distance of the first user. For example, the moving distance A = 0.01Ln + Ps + Pt, where Ln is the Euclidean distance.
[0121] It should be noted that, in this embodiment, the moving distance is not the actual distance between the first user and the second user, but a score value representing the actual distance between the two obtained according to 0.01Ln+Ps+Pt, and the preset distance is also a preset score value.
[0122] In this embodiment, the moving distance is corrected by the center of the first user and the infrared image, so that human body tracking is performed more accurately.
[0123] Reference Figure 6 , Figure 6 This is the fifth embodiment of the human body tracking method of the present invention, based on the third embodiment or the fourth embodiment, step S11 includes:
[0124] Step S111, processing the temperature of the pixel points in the first infrared image that exceed the preset temperature range to obtain a fourth infrared image, wherein the temperature of the processed pixel points is less than the lower limit of the preset temperature range, and the preset temperature range is determined according to the human body temperature range.
[0125] In this embodiment, after obtaining the first infrared image, the device processes the temperature of the pixels in the first infrared image that exceed the preset temperature range to obtain a fourth infrared image, and the temperature of the processed pixels is less than the lower limit of the preset temperature range, and the preset temperature range is determined according to the human body temperature range, and the preset temperature range is, for example, 32°C to 42°C, that is, the preset temperature range includes the human body temperature range. The temperatures of the processed pixels are the same, for example, all are 0°C.
[0126] Step S112: divide the fourth infrared image into a plurality of second sub-regions, determine a second pixel point with the maximum temperature in each second sub-region, and synthesize each second pixel point into a fifth infrared image.
[0127] In this embodiment, the acquisition direction of all infrared images is vertical, that is, the camera connected to the device is installed on the top of the place, so that the human body in the infrared image includes hair, and hair has no temperature, so it is necessary to filter the hair without temperature. In this regard, the device can divide the fourth infrared image into multiple second sub-areas. For example, the pixels of the fourth infrared image are 640*480, and the image is divided into 64*48 second sub-areas according to the size of 10*10. The device determines the second pixel with the highest temperature in each second sub-area, and then merges each pixel to obtain the fifth infrared image.
[0128] By collecting infrared images from the top, there is no need to collect the user's face, thus avoiding the leakage of user privacy.
[0129] Step S113, dividing the fifth infrared image into multiple third sub-areas, determining the third pixel point with the largest temperature in each third sub-area, and setting the third sub-area where the third pixel point with a temperature greater than the first preset temperature is located to the first preset color to obtain a fourth sub-area, and the first preset temperature is greater than the lower limit value.
[0130] The fifth infrared image includes a plurality of third sub-regions. The device determines the third pixel point with the maximum temperature in each third sub-region, and then sets the third sub-region where the third pixel point with a temperature greater than the first preset temperature is located to the first preset color. For example, the pixel value of each pixel point in the third sub-region is set to 1, that is, the third sub-region is set to the first preset color.
[0131] Furthermore, the third sub-region where the third pixel point whose temperature is less than or equal to the first preset temperature is located can be set to the second preset color to obtain the fourth sub-region. For example, the pixel value of each pixel point in the third sub-region is set to 0, that is, the third sub-region is set to the second preset color.
[0132] Step S114: combining the adjacent fourth sub-regions into a first sub-region, and determining the non-adjacent fourth sub-regions as a first sub-region.
[0133] The device merges the connected fourth sub-areas, that is, merges the adjacent fourth sub-areas, and determines the merged fourth sub-areas as the first sub-area, which is the area corresponding to one user. The device determines all the unconnected fourth sub-areas as the first sub-areas, that is, determines the non-adjacent fourth sub-areas as one first sub-area.
[0134] Step S115: determine the area of the first sub-region corresponding to the first user.
[0135] After each first sub-region is determined, the area of the first sub-region may be determined according to the number of pixels in each first sub-region.
[0136] It should be noted that the process of determining the area corresponding to the second user in the second infrared image is the same as the process of determining the first sub-area, which will not be described in detail herein.
[0137] In addition, the first sub-region is merged by each second pixel point, that is, the pixel points of the first sub-region are dispersed in the first infrared image, therefore, the coordinates of the first user need to be determined according to the third coordinates of each pixel point of each first sub-region in the first infrared image. The device determines the average horizontal coordinate and the average vertical coordinate according to each third coordinate, that is, the horizontal coordinates of each third coordinate are summed and averaged to obtain the average horizontal coordinate, and the vertical coordinates of each third coordinate are summed and averaged to obtain the average vertical coordinate, and the average horizontal coordinate and the average vertical coordinate can constitute the first coordinate of the first user.
[0138] The process of determining the second coordinates of the second user is consistent with the process of determining the first coordinates of the first user, and will not be described in detail here.
[0139] After determining the first sub-area, the device can determine the number of first users according to the number of the first sub-areas, so as to count the number of people in the place.
[0140] Furthermore, the device needs to determine whether the parameters of the first sub-area meet the set conditions. If the parameters of the first sub-area meet the set conditions, the number of first users can be determined based on the number of the first sub-area, that is, the number of first users is accurate. The parameters include the number and / or area of the first sub-area, and the set conditions include that the number of the first sub-area is less than the expected number and / or the area of the first sub-area is greater than the preset area. That is, the number in the first sub-area is greater than the expected number and / or the area of the first sub-area is less than the preset area, and the set conditions are met. The expected number refers to the expected number in the place where the camera is located. For example, there will be at least 15 people in the office from 10 to 11 o'clock, and the expected number is 15.
[0141] When the parameters of the first sub-area do not meet the set conditions, the first preset temperature is reduced to obtain the second preset temperature, and the second preset temperature must be greater than the lower limit to avoid the inability to determine the number of human bodies. The device sets the third sub-area where the third pixel point greater than the second preset temperature is located to the first preset color to obtain the fourth sub-area, and then returns to the step of combining the adjacent fourth sub-areas into a first sub-area, thereby performing a new round of human body number determination.
[0142] In this embodiment, the device can accurately determine the area where the first user is located in the first infrared image by processing the temperature of the pixel points in the first infrared image.
[0143] The present invention also provides a human body tracking device, referring to Figure 7 , the human body tracking device 700 includes:
[0144] A determination module 710 is used to determine the moving distance between each first user in the first infrared image and each second user in the second infrared image, and to construct a distance matrix and a hit matrix according to each moving distance, wherein the first infrared image and the second infrared image are adjacent frame images, and each element in the hit matrix corresponds to a moving distance in the distance matrix;
[0145] A determination module 710, configured to determine a minimum distance in the distance matrix, and determine the first user and the second user corresponding to the minimum distance as the same user;
[0146] A setting module 720 is used to set the value of each first element on the target row and target column of the hit matrix to a preset value so that the moving distance corresponding to the first element in the distance matrix does not participate in the determination of the minimum distance in the next round, wherein the target row and target column are the row and column where the element corresponding to the minimum distance in the hit matrix is located;
[0147] The execution module 730 is used to return to the step of determining the minimum distance in the distance matrix when the values of the elements in the hit matrix are not all preset values.
[0148] In one embodiment, the human body tracking device 700 includes:
[0149] A determination module 710 is used to determine whether the minimum distance is less than a preset distance;
[0150] The determination module 710 is configured to determine, when the minimum distance is less than a preset distance, that the first user and the second user corresponding to the minimum distance are the same user.
[0151] In one embodiment, the human body tracking device 700 includes:
[0152] An acquisition module, used for acquiring a third infrared image when the minimum distance is greater than or equal to a preset distance, wherein the third infrared image and the second infrared image are adjacent frame images;
[0153] An updating module, configured to update the second infrared image to the first infrared image, update each second user to the first user, and update the third infrared image to the second infrared image;
[0154] The execution module 730 is used to return to the step of determining the moving distance between each first user in the first infrared image and each second user in the second infrared image.
[0155] In one embodiment, the human body tracking device 700 includes:
[0156] A determination module 710, configured to determine the area of a first sub-region corresponding to each first user in the first infrared image and the maximum temperature of each first pixel in the first sub-region;
[0157] An acquisition module, used to acquire a first coordinate of each first user in the first infrared image, and a second coordinate of each second user in the second infrared image;
[0158] A determination module 710, configured to determine the Euclidean distance between each first user and each second user according to the first coordinate of each first user and the second coordinate of each second user;
[0159] The determination module 710 is used to determine the moving distance between each first user and each second user according to the Euclidean distance, maximum temperature, and area corresponding to each first user.
[0160] In one embodiment, the human body tracking device 700 includes:
[0161] An acquisition module, used for acquiring a first distance between each first user and the center of the first infrared image;
[0162] A determination module 710, configured to determine a first correction value corresponding to each first user according to the first coefficient, the first distance corresponding to each first user, and the maximum temperature, and to determine a second correction value according to the second coefficient, the first distance corresponding to each first user, and the area;
[0163] The correction module is used to correct the Euclidean distance corresponding to each first user according to the first correction value and the second correction value corresponding to each first user, so as to obtain the moving distance between each first user and each second user.
[0164] In one embodiment, the human body tracking device 700 includes:
[0165] a processing module, configured to process the temperature of the pixel points in the first infrared image that exceed a preset temperature range to obtain a fourth infrared image, wherein the temperature of the pixel points after the processing is less than a lower limit of the preset temperature range, and the preset temperature range is determined according to a human body temperature range;
[0166] A determination module 710, configured to divide the fourth infrared image into a plurality of second sub-regions, determine a second pixel point with the maximum temperature in each second sub-region, and synthesize each second pixel point into a fifth infrared image;
[0167] A determination module 710 is used to divide the fifth infrared image into a plurality of third sub-regions, determine the third pixel point with the largest temperature in each third sub-region, and set the third sub-region where the third pixel point with a temperature greater than a first preset temperature is located to the first preset color to obtain a fourth sub-region, wherein the first preset temperature is greater than a lower limit value;
[0168] a synthesis module, used for synthesizing adjacent fourth sub-regions into a first sub-region, and determining non-adjacent fourth sub-regions as a first sub-region;
[0169] The determination module 710 is configured to determine the area of the first sub-region corresponding to the first user.
[0170] In one embodiment, the human body tracking device 700 includes:
[0171] An acquisition module, used for acquiring a third coordinate of each first pixel point in the first sub-area corresponding to the first user in the first infrared image;
[0172] A determination module 710, configured to determine an average horizontal coordinate and an average vertical coordinate according to each third coordinate;
[0173] The determination module 710 is configured to determine a first coordinate of a first user according to an average horizontal coordinate and an average vertical coordinate.
[0174] In one embodiment, after the step of determining the non-adjacent fourth sub-region as a first sub-region, the method further includes:
[0175] The number of first users is determined according to the number of first sub-areas.
[0176] In one embodiment, the human body tracking device 700 includes:
[0177] A determination module 710 is used to determine whether parameters of the first sub-region meet a set condition, the parameters including the number and / or area of the first sub-region, and the set condition including that the number of the first sub-region is greater than an expected number and / or the area of the first sub-region is less than a preset area;
[0178] The determination module 710 is configured to determine the number of first users according to the number of the first sub-areas when the parameters of the first sub-areas meet the set conditions.
[0179] In one embodiment, the human body tracking device 700 includes:
[0180] A processing module, configured to reduce the first preset temperature to obtain a second preset temperature when the parameters of the first sub-region do not meet the set conditions, and the second preset temperature is greater than a lower limit value;
[0181] A setting module, used for setting the third sub-region where the third pixel point having a temperature greater than the second preset temperature is located to the first preset color to obtain a fourth sub-region;
[0182] The execution module 730 is used to return to the step of combining the adjacent fourth sub-regions into one first sub-region.
[0183] In one embodiment, the human body tracking device 700 includes:
[0184] The setting module is used to set the third sub-region where the third pixel point with a temperature greater than the first preset temperature is located to the first preset color, and set the third sub-region where the third pixel point with a temperature less than or equal to the first preset temperature is located to the second preset color.
[0185] In one embodiment, the human body tracking device 700 includes:
[0186] The output module is used to output an alarm message when the maximum temperature in the first sub-area is greater than a third preset temperature, the third preset temperature is greater than the first preset temperature, and the third preset temperature is determined according to the normal body temperature of the human body.
[0187] Figure 8 is a hardware structure diagram of a human body tracking device according to an exemplary embodiment.
[0188] The human body tracking device 800 may include: a processor 81, such as a CPU, a memory 82, and a transceiver 83. Those skilled in the art will appreciate that Figure 8The structure shown in the figure does not constitute a limitation of the human tracking device, and may include more or less components than shown in the figure, or combine certain components, or arrange components differently. The memory 82 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0189] The processor 81 may call a computer program stored in the memory 82 to complete all or part of the steps of the above-mentioned human body tracking method.
[0190] The transceiver 83 is used to receive information sent by an external device and send information to the external device.
[0191] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a human tracking device, enables the human tracking device to perform the above-mentioned human tracking method.
[0192] A computer program product comprises a computer program. When the computer program is executed by a processor of a human body tracking device, the human body tracking device is enabled to perform the human body tracking method.
[0193] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0194] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A human body tracking method, characterized in that: include: Determine a moving distance between each first user in the first infrared image and each second user in the second infrared image, and construct a distance matrix and a hit matrix according to each of the moving distances, wherein the first infrared image and the second infrared image are adjacent frame images, and each element in the hit matrix corresponds to a moving distance in the distance matrix; Determining a minimum distance in the distance matrix, and determining a first user and a second user corresponding to the minimum distance as the same user; The values of the first elements on the target row and the target column of the hit matrix are set to preset values so that the moving distance corresponding to the first element in the distance matrix does not participate in the determination of the minimum distance in the next round, wherein the target row and the target column are the rows and columns where the elements corresponding to the minimum distance in the hit matrix are located; When the values of the elements in the hit matrix are not all preset values, the step of determining the minimum distance in the distance matrix is returned to be executed.
2. The human body tracking method according to claim 1, characterized in that: The step of determining the first user and the second user corresponding to the minimum distance as the same user comprises: Determining whether the minimum distance is less than a preset distance; When the minimum distance is less than a preset distance, the first user and the second user corresponding to the minimum distance are determined to be the same user.
3. The human body tracking method according to claim 2, characterized in that: The acquisition time point of the second infrared image is later than the acquisition time point of the first infrared image, and the method further includes: When the minimum distance is greater than or equal to a preset distance, acquiring a third infrared image, wherein the third infrared image and the second infrared image are adjacent frame images; updating the second infrared image to the first infrared image, updating each of the second users to the first user, and updating the third infrared image to the second infrared image; The step of determining the moving distance between each first user in the first infrared image and each second user in the second infrared image is performed again.
4. The human body tracking method according to claim 1, characterized in that: The acquisition time point of the second infrared image is later than the acquisition time point of the first infrared image, and the step of determining the moving distance between each first user in the first infrared image and each second user in the second infrared image comprises: Determine an area of a first sub-region corresponding to each of the first users in the first infrared image and a maximum temperature of each first pixel in the first sub-region; Acquire a first coordinate of each of the first users in the first infrared image, and a second coordinate of each of the second users in the second infrared image; determining, according to the first coordinates of each of the first users and the second coordinates of each of the second users, the Euclidean distance between each of the first users and each of the second users; The moving distance between each of the first users and each of the second users is determined according to the Euclidean distance corresponding to each of the first users, the maximum temperature, and the area.
5. The human body tracking method according to claim 4, characterized in that: The step of determining the moving distance between each of the first users and each of the second users according to the Euclidean distance corresponding to each of the first users, the maximum temperature, and the area comprises: Acquire a first distance between each of the first users and the center of the first infrared image; determining a first correction value corresponding to each of the first users according to a first coefficient, a first distance corresponding to each of the first users, and a maximum temperature, and determining a second correction value according to a second coefficient, a first distance corresponding to each of the first users, and an area; The Euclidean distance corresponding to each of the first users is corrected according to the first correction value and the second correction value corresponding to each of the first users, so as to obtain the moving distance between each of the first users and each of the second users.
6. The human body tracking method according to claim 4, characterized in that: The determining the area of the first sub-region corresponding to each of the first users in the first infrared image comprises: Processing the temperature of the pixel points in the first infrared image that exceed a preset temperature range to obtain a fourth infrared image, wherein the temperature of the pixel points after the processing is less than a lower limit of the preset temperature range, and the preset temperature range is determined according to a human body temperature range; Dividing the fourth infrared image into a plurality of second sub-regions, determining a second pixel point with the maximum temperature in each second sub-region, and synthesizing each of the second pixel points into a fifth infrared image; Dividing the fifth infrared image into a plurality of third sub-regions, determining a third pixel point with the largest temperature in each third sub-region, and setting the third sub-region where the third pixel point with a temperature greater than a first preset temperature is located to a first preset color to obtain a fourth sub-region, wherein the first preset temperature is greater than the lower limit value; Combining the adjacent fourth sub-regions into a first sub-region, and determining the non-adjacent fourth sub-regions as a first sub-region; An area of a first sub-region corresponding to the first user is determined.
7. The human body tracking method according to claim 6, characterized in that: The step of obtaining the first coordinates of each of the first users in the first infrared image comprises: Acquire a third coordinate of each first pixel point in the first sub-area corresponding to the first user in the first infrared image; Determine an average abscissa and an average ordinate according to each of the third coordinates; A first coordinate of the first user is determined according to the average horizontal coordinate and the average vertical coordinate.
8. The human body tracking method according to claim 6, characterized in that: After the step of determining the non-adjacent fourth sub-region as a first sub-region, the method further includes: The number of first users is determined according to the number of the first sub-areas.
9. The human body tracking method according to claim 8, characterized in that: The step of determining the number of first users according to the number of the first sub-areas comprises: determining whether parameters of the first sub-regions meet set conditions, the parameters including the number and / or area of the first sub-regions, the set conditions including that the number of the first sub-regions is greater than an expected number and / or the area of the first sub-regions is less than a preset area; When the parameters of the first sub-areas meet the set conditions, the number of first users is determined according to the number of the first sub-areas.
10. The human body tracking method according to claim 9, characterized in that: After the step of determining whether the parameters of the first sub-area meet the set conditions, the method further includes: When the parameter of the first sub-region does not meet the set condition, reducing the first preset temperature to obtain a second preset temperature, and the second preset temperature is greater than the lower limit value; The third sub-region where the third pixel point having a temperature greater than the second preset temperature is located is set to the first preset color to obtain a fourth sub-region; Return to the step of combining the adjacent fourth sub-regions into one first sub-region.
11. The human body tracking method according to claim 6, characterized in that: The step of setting the third sub-region where the third pixel point having a temperature greater than the first preset temperature is located to the first preset color comprises: The third sub-region where the third pixel point having a temperature greater than the first preset temperature is located is set to the first preset color, and the third sub-region where the third pixel point having a temperature less than or equal to the first preset temperature is located is set to the second preset color.
12. The human body tracking method according to claim 6, characterized in that: After the step of determining the non-adjacent fourth sub-region as a first sub-region, the method further includes: When the maximum temperature in the first sub-area is greater than a third preset temperature, an alarm message is output, the third preset temperature is greater than the first preset temperature, and the third preset temperature is determined according to a normal body temperature of a human body.
13. The human body tracking method according to any one of claims 1 to 12, characterized in that: The first infrared image and the second infrared image are collected in a vertical direction.
14. A human body tracking device, characterized in that: include: a determination module, configured to determine a moving distance between each first user in the first infrared image and each second user in the second infrared image, and construct a distance matrix and a hit matrix according to each of the moving distances, wherein the first infrared image and the second infrared image are adjacent frame images; The determination module is further used to determine a minimum distance in the distance matrix, and determine the first user and the second user corresponding to the minimum distance as the same user, and each element in the hit matrix corresponds to a moving distance in the distance matrix; A setting module, used to set the value of each first element on the target row and target column of the hit matrix to a preset value, so that the moving distance corresponding to the first element in the distance matrix does not participate in the determination of the minimum distance in the next round, wherein the target row and the target column are the row and column where the element corresponding to the minimum distance in the hit matrix is located; The execution module is used to return to the step of determining the minimum distance in the distance matrix when the values of the elements in the hit matrix are not all preset values.
15. A human body tracking device, characterized in that: include: Memory and processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the human body tracking method according to any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the human body tracking method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Unmanned vehicle intelligent tracking device and method based on infrared imaging
CN111275738A
Infrared video multi-target tracking method
CN113808164A