A method and system for automatically tracking personnel
By pre-processing and enhancing the indoor face image, combined with Kalman filtering, the problem of low indoor face recognition accuracy is solved, and a higher tracking accuracy is achieved.
Patent Information
- Application Number
- CN202510119800.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-25
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2045-01-25
AI Technical Summary
During the automatic tracking of indoor personnel, due to the occlusion of indoor buildings and external factors, it is difficult for face image acquisition equipment to obtain clear images, resulting in low facial recognition accuracy, affecting the accuracy of tracking.
By preprocessing the acquired face images, Gaussian filtering, dynamic threshold denoising and partition enhancement processing, the enhanced image is generated and inputted to the preset recognition model for identification, and the target tracking is achieved in combination with Kalman filtering processing.
Effectively eliminate noise in the image, improve the blur after image denoising, improve the noise removal effect, and improve the accuracy of recognition and tracking by enhancing the brightness and detail characteristics of the image.
Smart Images

Figure CN119559216B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of personnel tracking, and in particular relates to an automatic personnel tracking method and system. Background Art
[0002] Personnel tracking technology specifically includes personnel trajectory tracking. For some places, in order to improve work safety and risk management capabilities, it is very necessary to perform facial recognition on employees and track them based on the recognition structure. However, for the actual automatic personnel tracking process, when the tracking scene is indoors, due to the obstruction of indoor buildings or other external factors, the facial image obtained by the facial image acquisition device may have a series of problems such as unclearness and dim light, which may lead to low recognition accuracy during the facial recognition process, thereby affecting the accuracy of personnel tracking. Summary of the invention
[0003] In order to solve the above technical problems, the present invention provides a method and system for automatic personnel tracking, which are used to solve the technical problems in the prior art.
[0004] On the one hand, the present invention provides the following technical solution, a method for automatically tracking personnel, comprising:
[0005] Acquire a face image, and preprocess the face image to obtain a processed image;
[0006] Performing Gaussian filtering and dynamic threshold denoising on the processed image to obtain a denoised image;
[0007] Performing partition enhancement processing on the denoised image to obtain an enhanced image;
[0008] Acquire training face data, input the training face data into a preset recognition model for training, input the enhanced image into the trained preset recognition model for recognition, and output target identity information;
[0009] Performing Kalman filtering on the target based on the target identity information to output predicted position information, obtaining target identity information corresponding to a plurality of consecutive frames of face images, and outputting a tracking state of the target based on the predicted position information and the target identity information corresponding to the plurality of consecutive frames of face images;
[0010] The step of performing partition enhancement processing on the denoised image to obtain an enhanced image comprises:
[0011] Determine a denoising histogram of the denoised image, and remove zero values in the denoising histogram to obtain a removed histogram;
[0012] Performing median filtering on the eliminated histogram to obtain a filtered histogram, determining a mean of the filtered histogram, and adjusting the filtered histogram to a balanced histogram based on the mean;
[0013] Calculate the ideal pixel value based on the equalized histogram :
[0014] ;
[0015] In the formula, Indicates The ideal pixel value of pixels, Indicates that the gray value in the balanced histogram is The number of are the first range bit width and the second range bit width respectively, Indicates distribution interval;
[0016] An enhanced image is determined based on the ideal pixel values.
[0017] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention first obtains a face image and pre-processes the face image to obtain a processed image; then performs Gaussian filtering and dynamic threshold denoising on the processed image to obtain a denoised image; then performs partition enhancement on the denoised image to obtain an enhanced image; then obtains training face data, inputs the training face data into a preset recognition model for training, and inputs the enhanced image into the trained preset recognition model for recognition to output target identity information; then performs Kalman filtering on the target based on the target identity information to output predicted position information, obtains target identity information corresponding to several frames of continuous face images, and outputs the tracking state of the target based on the predicted position information and the target identity information corresponding to several frames of continuous face images. The present invention can effectively remove the noise in the image by filtering and denoising the image, improves the blurring of the image after denoising and improves the denoising effect. At the same time, the present invention performs enhancement on the image, effectively enhances the brightness characteristics and detail characteristics of the image, avoids the image from being dim and unclear, and thereby improves the accuracy of subsequent recognition and tracking.
[0018] Preferably, the step of preprocessing the face image to obtain a processed image includes:
[0019] The face image is scaled, cropped, and normalized in sequence to obtain a processed image.
[0020] Preferably, the step of performing Gaussian filtering and dynamic threshold denoising on the processed image to obtain a denoised image comprises:
[0021] Perform a first Gaussian filter on the processed image to obtain a filtered image :
[0022] ;
[0023] In the formula, is the first Gaussian filter, represents the first Gaussian filter standard deviation, Indicates processing image;
[0024] Based on the filtered image Determine the gradient matrix :
[0025] ;
[0026] In the formula, Respectively represent the filtered images in Directional gradient;
[0027] The gradient matrix is subjected to a second Gaussian filtering process to obtain a filter matrix :
[0028] ;
[0029] In the formula, is the second Gaussian filter, represents the second Gaussian filter standard deviation, Respectively represent the elements of the first row and first column, the first row and second column, the second row and first column, and the second row and second column in the filter matrix;
[0030] Determine a first threshold value based on the filter matrix With the second threshold :
[0031] ;
[0032] ;
[0033] The filtered image is divided into a plurality of sub-filtered images, and normalized judgment values of the plurality of sub-filtered images are calculated. :
[0034] ;
[0035] In the formula, , Respectively represent A first threshold value and a second threshold value corresponding to a sub-filter image;
[0036] A denoised image is determined based on the normalized judgment value.
[0037] Preferably, the step of determining the denoised image based on the normalized judgment value comprises:
[0038] like , then the corresponding sub-filtered image is stored in the first image set, and the images in the first image set are combined according to the original position to obtain the first image. If , then the corresponding sub-filtered image is stored in the second image set, and the images in the second image set are combined according to the original position to obtain the second image. If , then the corresponding sub-filtered image is stored in a third image set, and the images in the third image set are combined according to the original positions to obtain a third image, are respectively a first judgment threshold and a second judgment threshold;
[0039] Calculate the first denoising threshold of the first image , the second denoising threshold of the second image and the third denoising threshold for the third image :
[0040] ;
[0041] In the formula, , are the first adjustment coefficient and the second adjustment coefficient respectively. is the preset denoising threshold;
[0042] Based on the first denoising threshold Determine a first denoising image based on a second denoising threshold Determine a second denoised image and a third denoising threshold Determine the third denoised image:
[0043] ;
[0044] ;
[0045] ;
[0046] In the formula, , , They represent the first denoised image. The pixel value of the pixel point, the pixel value of the second denoised image The pixel value of the pixel point, the pixel value of the third denoised image The pixel value of a pixel, , Respectively represent the first image The pixel value of the pixel point in the second image The pixel value of the pixel point in the third image The pixel value of a pixel, , , Respectively represent the first denoised image The pixel value of the pixel point is the same as the pixel value of the first image. The Gaussian Euclidean distance between the pixel values of pixels, the The pixel value of the pixel point in the second image is The Gaussian Euclidean distance between the pixel values of the third pixel, the The pixel value of the pixel point is the same as the pixel value of the The Gaussian Euclidean distance between the pixel values of pixels, represents the third Gaussian filter standard deviation, Respectively represent the first image with , The neighborhood matrix centered at the pixel point, Respectively represent the second image with , The neighborhood matrix centered at the pixel point, Respectively represent the third image with , The neighborhood matrix centered at the pixel point, Indicates is the square of the second norm of the Gaussian weighted value;
[0047] The first denoised image, the second denoised image, and the third denoised image are combined to obtain a denoised image.
[0048] Preferably, the step of determining the enhanced image based on the ideal pixel value comprises:
[0049] Based on ideal pixel value An iterative equation is constructed and a number of distribution intervals are determined based on the iterative equation, wherein the iterative equation is:
[0050] ;
[0051] In the formula, represents the distribution interval value, represents the initial distribution interval of the iteration, Represents the initial ideal pixel value of the iteration;
[0052] Determine and adjust the grayscale mapping value based on several distribution intervals:
[0053] ;
[0054] In the formula, Indicates that the pixel gray value in the denoised image is The corresponding grayscale mapping value is adjusted when , Respectively represent distribution interval;
[0055] The grayscale value of the denoised image is adjusted based on the adjusted grayscale mapping value to obtain an enhanced image.
[0056] Preferably, the preset recognition model is specifically a YOLOv4 model.
[0057] In a second aspect, the present invention provides the following technical solution: an automatic personnel tracking system, the system adopts the above-mentioned automatic personnel tracking method, and the system comprises:
[0058] A processing module, used for acquiring a face image and preprocessing the face image to obtain a processed image;
[0059] A denoising module, used for performing Gaussian filtering and dynamic threshold denoising on the processed image to obtain a denoised image;
[0060] An enhancement module, used for performing partition enhancement processing on the denoised image to obtain an enhanced image;
[0061] A recognition module, used to obtain training face data, input the training face data into a preset recognition model for training, input the enhanced image into the trained preset recognition model for recognition, and output target identity information;
[0062] A tracking module is used to perform Kalman filtering on the target based on the target identity information to output predicted position information, obtain target identity information corresponding to several frames of continuous face images, and output the target tracking status based on the predicted position information and the target identity information corresponding to several frames of continuous face images.
[0063] In a third aspect, the present invention provides the following technical solution: a computer comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned automatic personnel tracking method when executing the computer program.
[0064] In a fourth aspect, the present invention provides the following technical solution: a storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-mentioned automatic personnel tracking method. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0066] Figure 1 A flowchart of a method for automatically tracking personnel provided in Embodiment 1 of the present invention;
[0067] Figure 2 A structural block diagram of an automatic personnel tracking system provided in Embodiment 2 of the present invention;
[0068] Figure 3 A schematic diagram of the hardware structure of a computer provided in another embodiment of the present invention.
[0069] The embodiments of the present invention will be further described below with reference to the accompanying drawings. DETAILED DESCRIPTION
[0070] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the embodiments of the present invention, and should not be construed as limiting the present invention.
[0071] In the description of the embodiments of the present invention, it should be understood that the terms "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside" and "outside" etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the embodiments of the present invention and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0072] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0073] In the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the embodiments of the present invention can be understood according to specific circumstances.
[0074] Embodiment 1
[0075] In the first embodiment of the present invention, Figure 1 As shown, a method for automatic personnel tracking includes:
[0076] S1. Acquire a face image, and preprocess the face image to obtain a processed image;
[0077] Wherein, the step S1 is specifically as follows:
[0078] The facial image is sequentially scaled, cropped, and normalized to obtain a processed image;
[0079] Specifically, the above preprocessing process is a commonly used image processing method in the prior art, so it will not be described in detail here.
[0080] S2, performing Gaussian filtering and dynamic threshold denoising on the processed image to obtain a denoised image;
[0081] Wherein, the step S2 comprises:
[0082] S21, performing a first Gaussian filtering process on the processed image to obtain a filtered image :
[0083] ;
[0084] In the formula, is the first Gaussian filter, represents the first Gaussian filter standard deviation, Represents processed images.
[0085] S22, based on the filtered image Determine the gradient matrix :
[0086] ;
[0087] In the formula, Respectively represent the filtered images in Direction gradient.
[0088] S23, performing a second Gaussian filter process on the gradient matrix to obtain a filter matrix :
[0089] ;
[0090] In the formula, is the second Gaussian filter, represents the second Gaussian filter standard deviation, They respectively represent the elements in the first row and first column, the first row and second column, the second row and first column, and the second row and second column in the filter matrix.
[0091] Specifically, the first Gaussian filter and the second Gaussian filter are both commonly used filters in the prior art, but the two Gaussian filters use different Gaussian parameters.
[0092] S24, determining a first limit value based on the filter matrix With the second threshold :
[0093] ;
[0094] ;
[0095] Specifically, for an image, it can be divided into a slow zone, a changing zone and an edge zone according to the distribution of its image pixels, and the first boundary value and the second boundary value in different areas are different. For the slow zone, the corresponding first boundary value and the second boundary value are approximately 0. For the edge zone, the first boundary value is much larger than the second boundary value, and both are greater than 0. The pixel contrast of the image in the slow zone is small, the pixel contrast of the image in the changing zone is medium, and the pixel contrast of the image in the edge zone is large.
[0096] S25, dividing the filtered image into a plurality of sub-filtered images, and calculating normalized judgment values of the plurality of sub-filtered images :
[0097] ;
[0098] In the formula, , Respectively represent A first threshold value and a second threshold value corresponding to a sub-filter image;
[0099] Specifically, the filtered image can be divided into several small sub-filtered images by rectangular segmentation, and because the first boundary value and the second boundary value corresponding to images in different regions are different, the type of the sub-filtered image can be determined by the normalized judgment value.
[0100] S26, determining a denoised image based on the normalized judgment value;
[0101] Wherein, the step S26 comprises:
[0102] S261, if , then the corresponding sub-filtered image is stored in the first image set, and the images in the first image set are combined according to the original position to obtain the first image. If , then the corresponding sub-filtered image is stored in the second image set, and the images in the second image set are combined according to the original position to obtain the second image. If , then the corresponding sub-filtered image is stored in a third image set, and the images in the third image set are combined according to the original positions to obtain a third image, are respectively a first judgment threshold and a second judgment threshold;
[0103] Specifically, the first judgment threshold and the second judgment threshold here can be based on actual conditions. When the normalized judgment value corresponding to a sub-filter image is not greater than the first judgment threshold, it means that the sub-filter image is an image in the slow area. When the normalized judgment value corresponding to a sub-filter image is between the first judgment threshold and the second judgment threshold, it means that the sub-filter image is an image in the changing area. When the normalized judgment value corresponding to a sub-filter image is greater than the second judgment threshold, it means that the sub-filter image is an image in the edge area.
[0104] S262: Calculate a first denoising threshold for the first image , the second denoising threshold of the second image and the third denoising threshold for the third image :
[0105] ;
[0106] In the formula, , are the first adjustment coefficient and the second adjustment coefficient respectively. is the preset denoising threshold;
[0107] Specifically, in this embodiment, the first adjustment coefficient is 0.8, and the second adjustment coefficient is 1.2.
[0108] S263: Based on the first denoising threshold Determine a first denoising image based on a second denoising threshold Determine a second denoised image and a third denoising threshold Determine the third denoised image:
[0109] ;
[0110] ;
[0111] ;
[0112] In the formula, , , They represent the first denoised image. The pixel value of the pixel point, the pixel value of the second denoised image The pixel value of the pixel point, the pixel value of the third denoised image The pixel value of a pixel, , Respectively represent the first image The pixel value of the pixel point in the second image The pixel value of the pixel point in the third image The pixel value of a pixel, , , They represent the first denoised image. The pixel value of the pixel point is the same as the pixel value of the first image. The Gaussian Euclidean distance between the pixel values of pixels, the The pixel value of the pixel point in the second image is The Gaussian Euclidean distance between the pixel values of the third pixel, the The pixel value of the pixel point is the same as the pixel value of the The Gaussian Euclidean distance between the pixel values of pixels, represents the third Gaussian filter standard deviation, Respectively represent the first image with , The neighborhood matrix centered at the pixel point, Respectively represent the second image with , The neighborhood matrix centered at the pixel point, Respectively represent the third image with , The neighborhood matrix centered at the pixel point, Indicates is the square of the second norm of the Gaussian weighted value;
[0113] Specifically, in the present application, different denoising thresholds are used for different types of images, so as to avoid the image being too smooth, while also being able to retain more image details and effectively remove noise from the image. At the same time, for the traditional filtering denoising algorithm, the weight function obtained is an exponential function, which obtains a high weight in areas with high pixel density, but due to its fast decay speed and unreasonable segmentation, the denoised image is blurred. Therefore, the present application determines an improved weight function, adjusts its exponent, slows down its decay speed, and accelerates the decay in the process of transitioning from high-similarity areas to low-similarity areas, so that a smaller weight or even close to 0 is obtained in the low-similarity area.
[0114] S264: Combine the first denoised image, the second denoised image, and the third denoised image to obtain a denoised image.
[0115] S3, performing partition enhancement processing on the denoised image to obtain an enhanced image;
[0116] Wherein, the step S3 comprises:
[0117] S31, determining a denoising histogram of the denoised image, and removing zero values in the denoising histogram to obtain a removed histogram.
[0118] S32, performing median filtering on the eliminated histogram to obtain a filtered histogram, determining a mean of the filtered histogram, and adjusting the filtered histogram to a balanced histogram based on the mean;
[0119] Specifically, the step is as follows: a number of sliding windows are determined in the filtering histogram, and when the ratio of the number of pixels contained in a grayscale value to the number of pixels of the grayscale value in the sliding window is the largest, the number of pixels contained in the grayscale value is taken as the local maximum value, and then the entire filtering histogram is traversed to obtain a maximum value set, and the mean of the maximum value set is calculated, and the mean is the mean of the filtering histogram, and then the mean is used as the first partition value, and the first partition value is compared with the product of the number of pixels in the maximum value set and the total number of pixels, and the minimum value is taken as the second partition value, and then the number of pixels contained in the grayscale value in the filtering histogram is greater than 0 and less than the second partition value. Increase to the size of the second partition value, and the number of pixels contained in the grayscale value in the filtering histogram is greater than the first partition value. Reduce to the size of the first partition value, thereby obtaining a balanced histogram.
[0120] S33, calculating the ideal pixel value based on the balanced histogram :
[0121] ;
[0122] In the formula, Indicates The ideal pixel value of pixels, Indicates that the gray value in the balanced histogram is The number of are the first range bit width and the second range bit width respectively, Indicates distribution interval;
[0123] Specifically, the first range bit width is a range bit width of a denoised image, and the second range bit width is an ideal range bit width of an enhanced image.
[0124] S34, determining an enhanced image based on the ideal pixel value;
[0125] Wherein, the step S34 comprises:
[0126] S341, based on ideal pixel value An iterative equation is constructed and a number of distribution intervals are determined based on the iterative equation, wherein the iterative equation is:
[0127] ;
[0128] In the formula, represents the distribution interval value, represents the initial distribution interval of the iteration, Represents the initial ideal pixel value of the iteration.
[0129] S342, determining and adjusting the grayscale mapping value based on a plurality of distribution intervals:
[0130] ;
[0131] In the formula, Indicates that the pixel gray value in the denoised image is The corresponding grayscale mapping value is adjusted when , Respectively represent A distribution interval.
[0132] S343, adjusting the grayscale value of the denoised image based on the adjusted grayscale mapping value to obtain an enhanced image;
[0133] Specifically, the enhanced image can be obtained by replacing the original grayscale value with the adjusted grayscale mapping value.
[0134] S4, obtaining training face data, inputting the training face data into a preset recognition model for training, and inputting the enhanced image into the trained preset recognition model for recognition, so as to output target identity information;
[0135] Specifically, the preset recognition model is a YOLOv4 model. After the YOLOv4 model is trained, the enhanced image is input into the model to output the corresponding target identity information.
[0136] S5, performing Kalman filtering on the target based on the target identity information to output predicted position information, obtaining target identity information corresponding to a plurality of consecutive frames of face images, and outputting the tracking state of the target based on the predicted position information and the target identity information corresponding to the plurality of consecutive frames of face images;
[0137] Specifically, assuming that the target identity information is recognized in the image of the previous frame, the target in the image is then subjected to Kalman filtering to obtain the predicted position information of the target in the current frame. Then, whether the target appears is identified in subsequent frames, and based on the predicted position information, the tracking status of the target can be obtained, which can be updated in real time.
[0138] The method for automatic tracking of personnel provided in the first embodiment of the present invention first obtains a face image, pre-processes the face image to obtain a processed image; then performs Gaussian filtering and dynamic threshold denoising on the processed image to obtain a denoised image; then performs partition enhancement on the denoised image to obtain an enhanced image; then obtains training face data, inputs the training face data into a preset recognition model for training, and inputs the enhanced image into the trained preset recognition model for recognition to output target identity information; then performs Kalman filtering on the target based on the target identity information to output predicted position information, obtains target identity information corresponding to a plurality of frames of continuous face images, and outputs the tracking state of the target based on the predicted position information and the target identity information corresponding to a plurality of frames of continuous face images. The present invention can effectively remove the noise existing in the image by filtering and denoising the image, improves the blurring of the image after denoising and improves the denoising effect. At the same time, the present invention performs enhancement on the image, effectively enhances the brightness feature and detail feature of the image, avoids the image from being dim and unclear, thereby improving the accuracy of subsequent recognition and tracking.
[0139] Embodiment 2
[0140] like Figure 2 As shown, in the second embodiment of the present invention, a personnel automatic tracking system is provided, and the system includes:
[0141] Processing module 1, used to obtain a face image and pre-process the face image to obtain a processed image;
[0142] De-noising module 2, used for performing Gaussian filtering and dynamic threshold denoising on the processed image to obtain a denoised image;
[0143] Enhancement module 3, used for performing partition enhancement processing on the denoised image to obtain an enhanced image;
[0144] Recognition module 4, used to obtain training face data, input the training face data into a preset recognition model for training, input the enhanced image into the trained preset recognition model for recognition, and output target identity information;
[0145] A tracking module 5, configured to perform Kalman filtering on the target based on the target identity information to output predicted position information, obtain target identity information corresponding to a plurality of consecutive frames of face images, and output a tracking state of the target based on the predicted position information and the target identity information corresponding to a plurality of consecutive frames of face images;
[0146] The processing module 1 is specifically used for:
[0147] The face image is scaled, cropped, and normalized in sequence to obtain a processed image.
[0148] The denoising module 2 comprises:
[0149] The first filtering submodule is used to perform a first Gaussian filtering process on the processed image to obtain a filtered image. :
[0150] ;
[0151] In the formula, is the first Gaussian filter, represents the first Gaussian filter standard deviation, Indicates processing image;
[0152] Gradient submodule, for filtering images based on the Determine the gradient matrix :
[0153] ;
[0154] In the formula, Respectively represent the filtered images in Directional gradient;
[0155] The second filtering submodule is used to perform a second Gaussian filtering process on the gradient matrix to obtain a filtering matrix :
[0156] ;
[0157] In the formula, is the second Gaussian filter, represents the second Gaussian filter standard deviation, Respectively represent the elements of the first row and first column, the first row and second column, the second row and first column, and the second row and second column in the filter matrix;
[0158] A limit submodule, configured to determine a first limit value based on the filter matrix With the second threshold :
[0159] ;
[0160] ;
[0161] A normalization submodule is used to divide the filtered image into several sub-filtered images and calculate the normalized judgment values of the several sub-filtered images. :
[0162] ;
[0163] In the formula, , Respectively represent A first threshold value and a second threshold value corresponding to a sub-filter image;
[0164] The denoising submodule is used to determine a denoised image based on the normalized judgment value.
[0165] The denoising submodule comprises:
[0166] Classification unit, used if , then the corresponding sub-filtered image is stored in the first image set, and the images in the first image set are combined according to the original position to obtain the first image. If , then the corresponding sub-filtered image is stored in the second image set, and the images in the second image set are combined according to the original position to obtain the second image. If , then the corresponding sub-filtered image is stored in a third image set, and the images in the third image set are combined according to the original positions to obtain a third image, are respectively a first judgment threshold and a second judgment threshold;
[0167] A threshold unit, used to calculate a first denoising threshold for the first image , the second denoising threshold of the second image and the third denoising threshold for the third image :
[0168] ;
[0169] In the formula, , are the first adjustment coefficient and the second adjustment coefficient respectively. is the preset denoising threshold;
[0170] A denoising unit is configured to: Determine a first denoising image based on a second denoising threshold Determine a second denoised image and a third denoising threshold Determine the third denoised image:
[0171] ;
[0172] ;
[0173] ;
[0174] In the formula, , , They represent the first denoised image. The pixel value of the pixel point, the pixel value of the second denoised image The pixel value of the pixel point, the pixel value of the third denoised image The pixel value of a pixel, , Respectively represent the first image The pixel value of the pixel point in the second image The pixel value of the pixel point in the third image The pixel value of a pixel, , , They represent the first denoised image. The pixel value of the pixel point is the same as the pixel value of the first image. The Gaussian Euclidean distance between the pixel values of pixels, the The pixel value of the pixel point in the second image is The Gaussian Euclidean distance between the pixel values of the third pixel, the The pixel value of the pixel point is the same as the pixel value of the The Gaussian Euclidean distance between the pixel values of pixels, represents the third Gaussian filter standard deviation, Respectively represent the first image with , The neighborhood matrix centered at the pixel point, Respectively represent the second image with , The neighborhood matrix centered at the pixel point, Respectively represent the third image with , The neighborhood matrix centered at the pixel point, Indicates is the square of the second norm of the Gaussian weighted value;
[0175] The combining unit is used to combine the first denoised image, the second denoised image and the third denoised image to obtain a denoised image.
[0176] The enhancement module 3 comprises:
[0177] A removal submodule, used for determining a denoising histogram of the denoised image, and removing zero values in the denoising histogram to obtain a removal histogram;
[0178] an equalization submodule, configured to perform median filtering on the eliminated histogram to obtain a filtered histogram, determine a mean of the filtered histogram, and adjust the filtered histogram to an equalized histogram based on the mean;
[0179] A calculation submodule, used to calculate the ideal pixel value based on the equalized histogram :
[0180] ;
[0181] In the formula, Indicates The ideal pixel value of pixels, Indicates that the gray value in the balanced histogram is The number of are the first range bit width and the second range bit width respectively, Indicates distribution interval;
[0182] The enhancement submodule is used to determine an enhanced image based on an ideal pixel value.
[0183] The enhancer module comprises:
[0184] Iteration unit for averaging based on ideal pixel values An iterative equation is constructed and a number of distribution intervals are determined based on the iterative equation, wherein the iterative equation is:
[0185] ;
[0186] In the formula, represents the distribution interval value, represents the initial distribution interval of the iteration, Represents the initial ideal pixel value of the iteration;
[0187] A mapping unit is used to determine and adjust the grayscale mapping value based on a number of distribution intervals:
[0188] ;
[0189] In the formula, Indicates that the pixel gray value in the denoised image is The corresponding grayscale mapping value is adjusted when , Respectively represent distribution interval;
[0190] An adjustment unit is used to adjust the grayscale value of the denoised image based on the adjusted grayscale mapping value to obtain an enhanced image.
[0191] In some other embodiments of the present invention, the embodiments of the present invention provide the following technical solutions: a computer, comprising a memory 102, a processor 101, and a computer program stored in the memory 102 and executable on the processor 101, wherein the processor 101 implements the automatic personnel tracking method as described above when executing the computer program.
[0192] Specifically, the processor 101 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiment of the present invention.
[0193] Among them, the memory 102 may include a large-capacity memory for data or instructions. By way of example and not limitation, the memory 102 may include a hard disk drive (HDD), a floppy disk drive, a solid state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 102 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 102 may be inside or outside the data processing device. In a specific embodiment, the memory 102 is a non-volatile memory. In a specific embodiment, the memory 102 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM) or a flash memory (FLASH), or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0194] The memory 102 may be used to store or cache various data files that need to be processed and / or used for communication, as well as possible computer program instructions executed by the processor 101 .
[0195] The processor 101 implements the above-mentioned automatic personnel tracking method by reading and executing the computer program instructions stored in the memory 102.
[0196] In some embodiments, the computer may further include a communication interface 103 and a bus 100. Figure 3 As shown, the processor 101, the memory 102, and the communication interface 103 are connected via a bus 100 and communicate with each other.
[0197] The communication interface 103 is used to implement communication between the modules, devices, units and / or equipment in the embodiment of the present invention. The communication interface 103 can also implement data communication with other components such as: external devices, image / data acquisition equipment, databases, external storage, and image / data processing workstations.
[0198] The bus 100 includes hardware, software or both, and couples the components of the computer device to each other. The bus 100 includes but is not limited to at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 100 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, bus 100 may include one or more buses. Although embodiments of the present invention describe and illustrate a particular bus, the present invention contemplates any suitable bus or interconnect.
[0199] The computer can execute the automatic personnel tracking method of the present invention based on the acquired automatic personnel tracking system, thereby realizing automatic personnel tracking.
[0200] In some further embodiments of the present invention, in combination with the above-mentioned automatic personnel tracking method, the embodiments of the present invention provide the following technical solutions: a storage medium having a computer program stored thereon, and the computer program implements the above-mentioned automatic personnel tracking method when executed by a processor.
[0201] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0202] More specific examples of readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0203] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0204] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0205] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A method for automatically tracking personnel, characterized in that: include: Acquire a face image, and preprocess the face image to obtain a processed image; Performing Gaussian filtering and dynamic threshold denoising on the processed image to obtain a denoised image; Performing partition enhancement processing on the denoised image to obtain an enhanced image; Acquire training face data, input the training face data into a preset recognition model for training, input the enhanced image into the trained preset recognition model for recognition, and output target identity information; Performing Kalman filtering on the target based on the target identity information to output predicted position information, obtaining target identity information corresponding to a plurality of consecutive frames of face images, and outputting a tracking state of the target based on the predicted position information and the target identity information corresponding to the plurality of consecutive frames of face images; The step of performing partition enhancement processing on the denoised image to obtain an enhanced image comprises: Determine a denoising histogram of the denoised image, and remove zero values in the denoising histogram to obtain a removed histogram; Performing median filtering on the eliminated histogram to obtain a filtered histogram, determining a mean of the filtered histogram, and adjusting the filtered histogram to a balanced histogram based on the mean; Calculate the ideal pixel value based on the equalized histogram : ; In the formula, Indicates The ideal pixel value of pixels, Indicates that the gray value in the balanced histogram is The number of are the first range bit width and the second range bit width respectively, Indicates distribution intervals, the first range width is the range width of the denoised image, and the second range width is the ideal range width of the enhanced image; determining an enhanced image based on the ideal pixel values; The step of determining an enhanced image based on an ideal pixel value comprises: Based on ideal pixel value An iterative equation is constructed and a number of distribution intervals are determined based on the iterative equation, wherein the iterative equation is: ; In the formula, represents the distribution interval value, represents the initial distribution interval of the iteration, Represents the initial ideal pixel value of the iteration; Determine and adjust the grayscale mapping value based on several distribution intervals: ; In the formula, Indicates that the pixel gray value in the denoised image is The corresponding grayscale mapping value is adjusted when , Respectively represent distribution interval; The grayscale value of the denoised image is adjusted based on the adjusted grayscale mapping value to obtain an enhanced image.
2. The method for automatically tracking personnel according to claim 1, characterized in that: The step of preprocessing the face image to obtain a processed image comprises: The face image is scaled, cropped, and normalized in sequence to obtain a processed image.
3. The method for automatically tracking personnel according to claim 1, characterized in that: The step of performing Gaussian filtering and dynamic threshold denoising on the processed image to obtain a denoised image comprises: Perform a first Gaussian filter on the processed image to obtain a filtered image : ; In the formula, is the first Gaussian filter, represents the first Gaussian filter standard deviation, Indicates processing image; Based on the filtered image Determine the gradient matrix : ; In the formula, Respectively represent the filtered images in Directional gradient; The gradient matrix is subjected to a second Gaussian filtering process to obtain a filter matrix : ; In the formula, is the second Gaussian filter, represents the second Gaussian filter standard deviation, Respectively represent the elements of the first row and first column, the first row and second column, the second row and first column, and the second row and second column in the filter matrix; Determine a first threshold value based on the filter matrix With the second threshold : ; ; The filtered image is divided into a plurality of sub-filtered images, and normalized judgment values of the plurality of sub-filtered images are calculated. : ; In the formula, , Respectively represent A first threshold value and a second threshold value corresponding to a sub-filter image; A denoised image is determined based on the normalized judgment value.
4. The method for automatically tracking people according to claim 3, characterized in that: The step of determining the denoised image based on the normalized judgment value comprises: like , then the corresponding sub-filtered image is stored in the first image set, and the images in the first image set are combined according to the original position to obtain the first image. If , then the corresponding sub-filtered image is stored in the second image set, and the images in the second image set are combined according to the original position to obtain the second image. If , then the corresponding sub-filtered image is stored in a third image set, and the images in the third image set are combined according to the original positions to obtain a third image, are respectively a first judgment threshold and a second judgment threshold; Calculate the first denoising threshold of the first image , the second denoising threshold of the second image and the third denoising threshold for the third image : ; In the formula, , are the first adjustment coefficient and the second adjustment coefficient respectively. is the preset denoising threshold; Based on the first denoising threshold Determine a first denoising image based on a second denoising threshold Determine a second denoised image and a third denoising threshold Determine the third denoised image: ; ; ; In the formula, , , They represent the first denoised image. The pixel value of the pixel point, the pixel value of the second denoised image The pixel value of the pixel point, the pixel value of the third denoised image The pixel value of a pixel, , Respectively represent the first image The pixel value of the pixel point in the second image The pixel value of the pixel point in the third image The pixel value of a pixel, , , They represent the first denoised image. The pixel value of the pixel point is the same as the pixel value of the first image. The Gaussian Euclidean distance between the pixel values of pixels, the The pixel value of the pixel point in the second image is The Gaussian Euclidean distance between the pixel values of the third pixel, the The pixel value of the pixel point is the same as the pixel value of the The Gaussian Euclidean distance between the pixel values of pixels, represents the third Gaussian filter standard deviation, Respectively represent the first image with , The neighborhood matrix centered at the pixel point, Respectively represent the second image with , The neighborhood matrix centered at the pixel point, Respectively represent the third image with , The neighborhood matrix centered at the pixel point, Indicates is the square of the second norm of the Gaussian weighted value; The first denoised image, the second denoised image, and the third denoised image are combined to obtain a denoised image.
5. The method for automatically tracking people according to claim 1, characterized in that: The preset recognition model is specifically a YOLOv4 model.
6. A personnel automatic tracking system, the system adopting the personnel automatic tracking method according to claim 1, characterized in that: The system comprises: A processing module, used for acquiring a face image and preprocessing the face image to obtain a processed image; A denoising module, used for performing Gaussian filtering and dynamic threshold denoising on the processed image to obtain a denoised image; An enhancement module, used for performing partition enhancement processing on the denoised image to obtain an enhanced image; A recognition module, used to obtain training face data, input the training face data into a preset recognition model for training, input the enhanced image into the trained preset recognition model for recognition, and output target identity information; A tracking module is used to perform Kalman filtering on the target based on the target identity information to output predicted position information, obtain target identity information corresponding to several frames of continuous face images, and output the target tracking status based on the predicted position information and the target identity information corresponding to several frames of continuous face images.
7. A computer 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 computer program, the automatic personnel tracking method according to any one of claims 1 to 5 is implemented.
8. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the method for automatically tracking personnel as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Image noise removal method and device and storage medium
CN113256505A
Lens foreign matter identification method and device of multispectral camera, equipment and medium
CN117911291A