Infrared image edge enhancement method, device and equipment, and storage medium
By combining the temperature data matrix and image data matrix of infrared images, and using adaptive weight matrix and edge gradient matrix for adaptive weighted enhancement, the problem of insufficient distinction between target and background in infrared imaging equipment is solved. This achieves clear highlighting of heat source targets and preservation of details, simplifies the computation, and facilitates portability to various devices.
Patent Information
- Application Number
- CN202311094644.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-28
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2043-08-28
AI Technical Summary
Existing infrared imaging devices do not distinguish between targets and backgrounds sufficiently, resulting in inaccurate target localization. Furthermore, existing edge detection algorithms are computationally complex and not easily portable to low-cost devices.
By acquiring the temperature data matrix and image data matrix of infrared images, adaptive weighted enhancement is performed using the edge gradient matrix and adaptive weight matrix to distinguish pixels in different temperature ranges, highlighting heat source targets and suppressing cluttered edge information in the background.
It achieves varying degrees of highlighting of target edge information within different temperature ranges, emphasizes internal details of heat source targets, simplifies algorithm computation, and facilitates its widespread application in various infrared imaging devices.
Smart Images

Figure CN117115029B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an infrared image edge enhancement method and apparatus, an image processing device, and a computer-readable storage medium. Background Technology
[0002] With advancements in the production and manufacturing processes of infrared detectors, the cost of infrared imaging equipment has decreased significantly, leading to its increasing prevalence in daily life. People are becoming accustomed to using infrared imaging devices, such as thermal imagers, in various activities, including outdoor exploration for detecting small animals, and workplace inspections for outdoor patrols or indoor circuit checks. In these activities, thermal imagers typically present ambient temperature information directly to the user through thermal imaging. In real-world scenarios, thermal imagers receive not only the infrared radiation from the target but also background radiation. During infrared imaging algorithm processing, this data often undergoes global and local contrast stretching to reveal the internal details and contours of targets at different temperatures. This process clearly displays the details of both the target and background, meeting the optimization goals of image processing. However, in practical use, while ensuring image clarity and detail, the distinction between the target and background is often insufficient, hindering rapid and accurate positioning. Therefore, it is often necessary to add edge detection-based target highlighting functions to adapt to different scenario requirements.
[0003] Currently, known edge detection algorithms typically rely on infrared images captured by thermal imagers for calculations. In infrared images, the distinction between the target and background is often insufficient, leading to the detection and display of background edges and details. These known edge detection algorithms are usually global edge detection methods, followed by simple thresholding. This approach easily removes internal contours of the target, hindering detailed observation of thermal sources. Furthermore, deep learning-based algorithms often require significant computational power and are difficult to train, making them impractical for most infrared imaging devices due to cost considerations. Summary of the Invention
[0004] To address the existing technical problems, this application provides an infrared image edge enhancement method and apparatus, image processing equipment, and computer-readable storage medium that are computationally simple, easily portable to various devices, highlight the heat source target, and effectively preserve the internal details of the heat source target.
[0005] To achieve the above objectives, the technical solution of this application embodiment is implemented as follows:
[0006] In a first aspect, embodiments of this application provide an infrared image edge enhancement method, including:
[0007] Obtain the temperature data matrix and image data matrix corresponding to the infrared image to be enhanced;
[0008] Edge detection is performed based on the image data matrix. The edge gradient value of each pixel in the infrared image to be enhanced is calculated according to the gradient in at least two directions, and the edge gradient matrix of the infrared image to be enhanced is obtained.
[0009] Based on the temperature data matrix, a temperature range threshold is determined. Based on the comparison between the temperature value corresponding to each pixel in the infrared image to be enhanced and the temperature range threshold, different strategies are used to calculate the corresponding weight values for the pixels in different temperature ranges, thereby obtaining the adaptive weight matrix of the infrared image to be enhanced.
[0010] The infrared image to be enhanced is adaptively weighted and enhanced using the adaptive weight matrix and the edge gradient matrix to obtain an edge-enhanced image.
[0011] Secondly, embodiments of this application provide an infrared image edge enhancement device, comprising:
[0012] The acquisition module is used to acquire the temperature data matrix and image data matrix corresponding to the infrared image to be enhanced;
[0013] An edge extraction module is used to perform edge detection based on the image data matrix, and calculate the corresponding edge gradient value of each pixel in the infrared image to be enhanced in at least two directions to obtain the edge gradient matrix of the infrared image to be enhanced.
[0014] The weighting module is used to determine the temperature range threshold based on the temperature data matrix, and to calculate the corresponding weight value for each pixel in the infrared image to be enhanced by using different strategies based on the comparison result between the temperature value corresponding to each pixel and the temperature range threshold, so as to obtain the adaptive weight matrix of the infrared image to be enhanced.
[0015] An adaptive enhancement module is used to adaptively weight and enhance the infrared image to be enhanced using the adaptive weight matrix and the edge gradient matrix to obtain an edge-enhanced image.
[0016] Thirdly, embodiments of this application provide an image processing device, including a processor, a memory connected to the processor, and a computer program stored in the memory and executable by the processor; when the computer program is executed by the processor, it implements the infrared image edge enhancement method described in any embodiment of this application.
[0017] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by the processor, implements the infrared image edge enhancement method as described in any embodiment of this application.
[0018] The infrared image edge enhancement method provided in the above embodiments obtains the temperature data matrix corresponding to the infrared image to be enhanced, divides the infrared image to be enhanced into different temperature ranges using the temperature data matrix, and calculates the corresponding weight values for pixels in different temperature ranges using different strategies to obtain an adaptive weight matrix that can enhance the target edge information to different degrees in different temperature ranges. In this way, by comprehensively utilizing the temperature data matrix and the image data matrix of the infrared image to be enhanced, based on the edge information extracted from the image using the image data matrix, the temperature data matrix identifies the target edge information belonging to different temperature ranges. For example, it can effectively identify and distinguish the edge information inside the heat source target. By forming an adaptive weight matrix, it achieves different degrees of enhancement and highlighting effect on the target edge information in different temperature ranges, realizing the purpose of highlighting the heat source target, effectively preserving the internal details of the heat source target, and effectively ignoring the messy edge information in the background of non-heat source targets. Moreover, the algorithm is relatively simple, does not require excessive computing power, and is easy to port to various infrared imaging devices, thus making it easy to promote and apply.
[0019] In the above embodiments, the infrared image edge enhancement device, infrared imaging equipment, and computer-readable storage medium are based on the same concept as the corresponding infrared image edge enhancement method embodiments, and thus have the same technical effects as the corresponding infrared image edge enhancement method embodiments, which will not be repeated here. Attached Figure Description
[0020] Figure 1 This is a schematic diagram illustrating an application scenario of an infrared image edge processing method in one embodiment;
[0021] Figure 2 This is a flowchart of an infrared image edge processing method in one embodiment;
[0022] Figure 3 A flowchart of an infrared image edge processing method in an optional specific example;
[0023] Figure 4 This is an example of a raw infrared image to be enhanced;
[0024] Figure 5 for Figure 4 The effect of edge detection results obtained after adaptive weighting enhancement of edge information;
[0025] Figure 6 for Figure 4 An image showing the edge enhancement effect obtained by adaptively weighting and enhancing edge information and then fusing it with the background;
[0026] Figure 7 This is a schematic diagram of an infrared image edge processing device in one embodiment;
[0027] Figure 8 This is a schematic diagram of the structure of an image processing device in one embodiment. Detailed Implementation
[0028] The technical solution of this application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0029] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0030] In the following description, the phrase "some embodiments" refers to a subset of all possible embodiments. It should be noted that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.
[0031] In the following description, the terms "first, second, and third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, and third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0032] Please see Figure 1This is a schematic diagram of an optional application scenario of the infrared image edge processing method provided in this application embodiment. The infrared imaging device 11 includes a processor 12, a memory 13 connected to the processor 12, and an infrared detector 14. The infrared detector 14 receives radiation emitted by the surrounding environment and the target, sequentially converting the thermal radiation into electrical signals and then into digital signals. These digital signals serve as response signals characterizing the temperature data of each point in the detector array. Then, through calibration and non-uniformity correction, the relationship between the response and temperature of each point in the detector array can be established. Utilizing this non-linear relationship between response and temperature, a temperature data matrix corresponding to the infrared image can be obtained. The resulting temperature data can relatively accurately reflect the temperature distribution of the environment within the imaging range, making it easy to accurately detect heat source targets. Infrared image imaging typically involves the processor 12 directly compressing and mapping the electrical signal containing temperature data obtained from the photoelectric conversion of the infrared detector 14 into 8-bit data for image display. For example, on the response data of a 14-bit detector that has undergone non-uniform correction, a series of image data processing steps are performed, including data bit compression, filtering and noise reduction, contrast enhancement, and detail enhancement, thereby improving the imaging effect in terms of image cleanliness, contrast, and detail representation. However, these operations can affect the relationship between response and temperature to some extent, resulting in inaccuracies in reflecting the environmental temperature distribution based on the features of the image after imaging. In this embodiment, the infrared detector 14 is used to receive thermal radiation and convert it into a response signal characterizing the temperature data of each point in the detector array. The response signal is used to provide the processor 12 with a temperature data matrix obtained using the relationship between response and temperature, and an image data matrix obtained through image data processing.
[0033] The processor 12 obtains a temperature data matrix by utilizing the electrical signal generated by the photoelectric conversion of the infrared detector 14 and the relationship between the response and temperature. It then performs an infrared image imaging process through a series of image data processing steps to obtain the corresponding image data matrix. The memory 13 stores a computer program for implementing the infrared image edge processing method provided in this application embodiment. By executing the computer program, the processor 12 enhances the edge information in the infrared image based on the obtained temperature data matrix and image data matrix. It combines the temperature data and image data to obtain an edge-enhanced image that distinguishes and enhances the edge information of the heat source target and the background, thus preserving the accuracy of the temperature measurement data while ensuring the visual effect of the image.
[0034] Please see Figure 2 The infrared image edge processing method provided in one embodiment of this application can be applied to... Figure 1 The infrared imaging device is shown in the application scenario. The infrared image edge processing method includes the following steps:
[0035] S101, acquire the temperature data matrix and image data matrix corresponding to the infrared image to be enhanced.
[0036] An infrared image to be enhanced refers to an infrared image that requires image enhancement processing. It can refer to infrared video data or separate, single-image infrared-like data. Specifically, the infrared image to be enhanced can be an infrared image acquired in real-time by an infrared imaging device. For example, during real-time infrared image acquisition, the infrared imaging device can use an infrared detector to collect infrared light signals within the imaging scene, convert them into electrical signals through photoelectric conversion, and simultaneously obtain an infrared image data matrix based on the electrical signals. At the same time, it can also obtain a temperature data matrix corresponding to the current infrared image based on the electrical signals. Optionally, the infrared image to be enhanced can also refer to an infrared image already acquired by any infrared imaging device with infrared image capture capabilities. For example, during infrared image acquisition, any infrared imaging device can use an infrared detector to collect infrared light signals within the imaging scene, convert them into electrical signals through photoelectric conversion, and simultaneously obtain an infrared image data matrix based on the electrical signals. The temperature data matrix and the infrared image are then associated and stored for later retrieval.
[0037] The image data matrix refers to the data matrix formed by the grayscale values corresponding to each pixel in the infrared image. The temperature data matrix refers to the data matrix formed by the original temperature values corresponding to each pixel in the infrared image. The original temperature value of each pixel is obtained by using the electrical signal obtained by photoelectric conversion from the infrared detector and the relationship between the response and temperature. This temperature value directly and accurately reflects the temperature distribution information in the imaging scene.
[0038] S103, perform edge detection based on the image data matrix, calculate the corresponding edge gradient value of each pixel in the infrared image to be enhanced in at least two directions, and obtain the edge gradient matrix of the infrared image to be enhanced.
[0039] Edge detection of the infrared image to be enhanced based on the image data matrix can be performed using any known edge detection algorithm, such as the Sobel edge detection operator or the Roborts edge detection operator, to extract edge information from the image. The edge gradient value is calculated based on the gradients of each pixel in the infrared image to be enhanced in at least two directions, resulting in the edge gradient matrix of the infrared image to be enhanced, which serves as preliminary edge detection information. In the edge gradient matrix, each element is the edge gradient value calculated for each pixel in the image based on its gradients in at least two directions. The magnitude of this edge gradient value indicates whether the pixel belongs to an edge in the image.
[0040] S105, Based on the temperature data matrix, determine the temperature range threshold. Based on the comparison result between the temperature value corresponding to each pixel in the infrared image to be enhanced and the temperature range threshold, calculate the corresponding weight value for each pixel in different temperature ranges using different strategies to obtain the adaptive weight matrix of the infrared image to be enhanced.
[0041] Temperature range thresholds refer to the segmentation values that divide the temperature values in a temperature data matrix into different temperature ranges. There can be two or more temperature ranges, each corresponding to different types of heat source targets, background, or other image regions. By identifying different temperature ranges in the image, different strategies are applied to calculate the corresponding weight values for pixels falling within each range. This allows for the differentiation of whether each pixel is located at the edge of different types of heat source targets, background, or other image regions. Different strategies are then used to assign weight values to adjust the degree of edge enhancement, achieving the desired edge enhancement effect. The adaptive weight matrix is a data matrix formed by the weight values corresponding to each pixel in the infrared image.
[0042] S107, The infrared image to be enhanced is adaptively weighted and enhanced using the adaptive weight matrix and the edge gradient matrix to obtain an edge information enhanced image.
[0043] The edge gradient matrix represents all edge information extracted based on the grayscale values of each pixel in the image. The adaptive weight matrix represents the enhancement level information of pixels within different regions corresponding to heat source targets or backgrounds, divided based on the temperature values of each pixel in the image. By adaptively weighting the infrared image to be enhanced using the adaptive weight matrix and the edge gradient matrix, edge information in different temperature regions can be suppressed or preserved. For example, edge information in high-temperature regions can be preserved and enhanced, while edge information in low-temperature regions can be suppressed. This ensures that the details and contour information within the heat source target region in the image are fully preserved and highlighted, while edge information extracted from the background is suppressed, which can better enhance the edge details of the heat source target against relatively complex backgrounds. Adaptive weighted enhancement expresses the adaptive adjustment of the degree of enhancement processing for edge information extracted in different temperature regions.
[0044] The infrared image edge enhancement method provided in the above embodiments obtains the temperature data matrix corresponding to the infrared image to be enhanced, divides the infrared image to be enhanced into different temperature ranges using the temperature data matrix, and calculates the corresponding weight values for pixels in different temperature ranges using different strategies to obtain an adaptive weight matrix that can enhance the target edge information to different degrees in different temperature ranges. In this way, by comprehensively utilizing the temperature data matrix and the image data matrix of the infrared image to be enhanced, based on the edge information extracted from the image using the image data matrix, the temperature data matrix identifies the target edge information belonging to different temperature ranges. For example, it can effectively identify and distinguish the edge information inside the heat source target. By forming an adaptive weight matrix, it achieves different degrees of enhancement and highlighting effect on the target edge information in different temperature ranges, realizing the purpose of highlighting the heat source target, effectively preserving the internal details of the heat source target, and effectively ignoring the messy edge information in the background of non-heat source targets. Moreover, the algorithm is relatively simple, does not require excessive computing power, and is easy to port to various infrared imaging devices, thus making it easy to promote and apply.
[0045] In some embodiments, before performing adaptive weighted enhancement on the infrared image to be enhanced using the adaptive weight matrix and the edge gradient matrix to obtain an edge-enhanced image, the process includes:
[0046] The edge information of the infrared image to be enhanced, obtained from the edge gradient matrix, is used for enhancement processing to obtain the enhanced and updated edge gradient matrix.
[0047] In the edge gradient matrix, the magnitude of each element represents whether each pixel in the infrared image to be enhanced belongs to an edge in the image. The edge gradient matrix is obtained by edge extraction based on the image data matrix. It contains the edges of the background and the outer contours and internal details of all targets in the image. By enhancing the edge information of the infrared image to be enhanced based on the edge gradient matrix, the edges of the background and the outer contours and internal details of all targets can be delineated together to obtain the enhanced and updated edge gradient matrix.
[0048] In the above embodiments, since the signal strength of the extracted edge information is usually much weaker than the average gray level of the image, the edge information in the image can be enhanced by performing edge enhancement processing based on the edge gradient matrix, thereby achieving an absolute enhancement of the edge signal in the image.
[0049] In some embodiments, the enhancement processing of the edge information of the infrared image to be enhanced based on the edge gradient matrix to obtain an enhanced and updated edge gradient matrix includes:
[0050] The enhanced and updated edge gradient matrix is obtained by multiplying the edge gradient matrix by a preset enhancement factor; or,
[0051] The gradient value range is determined based on the edge gradient matrix. The edge gradient matrix is then normalized according to the gradient value range and multiplied by a preset linear stretching coefficient to obtain the enhanced and updated edge gradient matrix.
[0052] Based on the enhancement of edge information in an image by the edge gradient matrix, one can simply multiply by a preset enhancement factor. This preset enhancement factor can be determined by considering the difference between the gradient values in the edge gradient matrix and the average grayscale value of the image, or it can be preset based on empirical values.
[0053] The enhancement of edge information in an image based on the edge gradient matrix can also be achieved by calculating the gradient value range, normalizing it, and then linearly stretching it. Let the gradient value range of the edge gradient matrix G be represented as the maximum value grad_max and the minimum value grad_min. With a preset linear stretching coefficient of range, the calculation based on the gradient value range, followed by linear stretching to the upper limit range, can be represented by the following formula:
[0054] G_enhance[i,j]=(G[i,j]-grad_min) / (grad_max-grad_min)*range (Formula 1)
[0055] Where G[i,j] refers to the edge gradient matrix, and G_enhance[i,j] refers to the edge gradient matrix updated after enhancement. The preset linear stretching coefficient range is greater than the maximum gray value of 255, and is generally between one and five times 255.
[0056] In some embodiments, obtaining the enhanced and updated edge gradient matrix includes:
[0057] The enhanced edge gradient matrix is divided according to a set threshold, and the values of elements in the edge gradient matrix that are less than the set threshold are set to zero to obtain the enhanced and updated edge gradient matrix.
[0058] The edge gradient matrix is segmented according to a set threshold. Elements in the enhanced edge gradient matrix whose values are less than the set threshold are set to zero, thus discarding gradients that remain small after enhancement. In one example, a hard threshold `level` is set, where `level` can be less than one-tenth of the range. If the data in the i-th row and j-th column of `G_enhance[i,j]` is less than `level`, then the data in the i-th row and j-th column is set to zero. This process is repeated to update the enhanced edge gradient matrix, resulting in the enhanced and updated edge gradient matrix.
[0059] In some embodiments, the edge detection based on the image data matrix, which involves calculating the corresponding edge gradient values of each pixel in the infrared image to be enhanced in at least two directions to obtain the edge gradient matrix of the infrared image to be enhanced, includes:
[0060] Gaussian filtering is performed based on the image data matrix;
[0061] Edge detection is performed on the Gaussian-filtered image data matrix, and the gradient of each pixel in the infrared image to be enhanced is calculated in at least two directions.
[0062] The edge gradient matrix of the infrared image to be enhanced is obtained by summing the absolute values of the gradients of each pixel in each direction.
[0063] Gaussian filtering of enhanced infrared images, based on the image data matrix, can ignore weak details while preserving main contours and strong details. It also removes noise, ensuring cleaner edge information extraction. The values of the standard deviation (sigma) and the filter window (window) in the Gaussian filter can be determined based on the magnitude of image noise; smaller values are preferable to minimize contour loss and ensure more complete preservation of edge information. Edge detection essentially detects discontinuities or abrupt changes in grayscale values between adjacent regions in an image. A gradient is a vector with direction and magnitude; the gradient direction represents the local direction of the estimated edge. The gradient magnitude is used to determine if an edge is detected. It should be noted that edge detection can be implemented using currently known edge detection algorithms.
[0064] Optionally, the step of performing edge detection on the Gaussian-filtered image data matrix and calculating the gradient of each pixel in the infrared image to be enhanced in at least two directions includes:
[0065] Edge detection is performed on the Gaussian filtered image data matrix, and corresponding convolution kernels are set for directions with multiple preset angles.
[0066] For each pixel in the infrared image to be enhanced, the gradient of the pixel in the multiple preset angle directions is obtained by convolving it with the convolution kernels in the multiple preset angle directions.
[0067] In this embodiment, edge detection uses the four-directional Sobel operator as an example. The gradients of each pixel are calculated in the horizontal and vertical diagonal directions, namely 0 degrees, 45 degrees, 90 degrees, and 135 degrees. The absolute values are then summed to obtain the edge gradient matrix, which serves as the initial edge detection information output from the infrared image to be enhanced based on the image data matrix. The corresponding convolution kernels for the four directions of 0 degrees, 45 degrees, 90 degrees, and 135 degrees are set as shown in Formula 2 below:
[0068]
[0069] Let I[i,j] be the data in the i-th row and j-th column of the image data matrix I. The gradients of this pixel in each direction are shown in Formula 3 below:
[0070]
[0071] The edge gradient value is calculated by summing the absolute values of the gradients of each pixel in each direction, as shown in Formula 4 below:
[0072] grad = abs(grad_0)+abs(grad_45)+abs(grad_90)+abs(grad_135) (Formula 4)
[0073] By performing the same operation on each pixel in the image data matrix, the edge gradient matrix G[i,j] based on the image data matrix can be obtained.
[0074] The above embodiments provide an implementation scheme for outputting edge detection information by calculating the gradient information of the infrared image to be enhanced in four directions, which can achieve better results by balancing the amount of computation and obtaining more complete edge information.
[0075] In some embodiments, determining a temperature range threshold based on the temperature data matrix, and calculating corresponding weight values for pixels in different temperature ranges using different strategies based on the comparison results between the temperature values corresponding to each pixel in the infrared image to be enhanced and the temperature range threshold, to obtain an adaptive weight matrix for the infrared image to be enhanced, includes:
[0076] Based on the temperature data matrix, statistical analysis is used to obtain statistical data indicators as temperature interval thresholds for dividing the temperature data into multiple temperature intervals; the statistical data indicators are selected from one of the following: mean, median, mode, quartiles;
[0077] Based on the comparison between the temperature value corresponding to each pixel in the infrared image to be enhanced and the temperature range threshold, the temperature range in which each pixel is located is determined.
[0078] Different strategies are used to calculate the corresponding weight values for the pixels in different temperature ranges to obtain the adaptive weight matrix of the infrared image to be enhanced.
[0079] There can be two or more temperature ranges, which can distinguish the regions containing different heat source targets and heat-free backgrounds in the infrared image to be enhanced. The temperature range thresholds can be set accordingly to differentiate the temperature ranges corresponding to the different heat source targets and heat-free backgrounds. Specifically, the temperature range thresholds are obtained through statistical analysis of the temperature values in the temperature data matrix corresponding to the current infrared image to be enhanced. The thresholds are adaptively calculated using the global temperature information of the infrared image itself to divide the image into different temperature ranges. Different strategies are used to calculate the corresponding weight values for pixels within different temperature ranges, thereby achieving different degrees of enhancement and highlighting effects for the edge information extracted within different temperature ranges.
[0080] In some embodiments, the temperature range threshold includes a temperature average, and the temperature range includes a high-temperature range and a low-temperature range divided by the temperature average; the step of calculating the corresponding weight values for the pixels in different temperature ranges using different strategies to obtain the adaptive weight matrix of the infrared image to be enhanced includes:
[0081] For each pixel in the low temperature range, the normalized value of the pixel's temperature data is used as its corresponding weight value.
[0082] For each pixel in the high temperature range, the product of the difference between the pixel's temperature data and the mean temperature and the weighted intensity control parameter, plus the mean temperature, is used as its corresponding weight value.
[0083] An adaptive weight matrix for the infrared image to be enhanced is obtained based on the weight values of each pixel.
[0084] In this embodiment, the infrared image to be enhanced can be divided into high-temperature and low-temperature regions based solely on whether it is a heat source target. The temperature range threshold is taken as the mean temperature t_mean calculated from the temperature data matrix. For a pixel in the i-th row and j-th column of the temperature data matrix T, if T[i,i] < t_mean, the pixel belongs to the low-temperature range. The corresponding weight value is calculated using the normalized temperature data, as shown in Formula 5 below.
[0085] W[i,j] = T[i,j] / t_mean (Formula 5)
[0086] The weight values of each pixel calculated in the low-temperature range are usually less than 1, so the edge information in the low-temperature range is suppressed after weighted calculation.
[0087] If T[i,i]≥t_mean, it means that the pixel is in the high temperature range and should be given a larger weight. The corresponding weight value is calculated as shown in Formula 6 below:
[0088] W[i,j] = (T[i,j] - t_mean) * k + t_mean (Formula 6)
[0089] Where k is a weighted intensity control parameter, usually greater than 1. The larger the value, the greater the weighting multiple of the edges in the high temperature range, the more prominent the edges and details of the high temperature range, and the more obvious the difference in temperature will be reflected in the intensity of edge enhancement.
[0090] The calculation of the adaptive weight matrix is not limited to dividing the temperature range first and then calculating. Alternatively, it can be done by first obtaining the temperature mean, denoted as t_mean, from the temperature data matrix T, and using the normalized value of the temperature data matrix as the initial value of the weight matrix W, i.e., W[i,j] = T[i,j] / t_mean. Then, the temperature mean is used as the threshold for high and low temperature discrimination. If T[i,i] < t_mean, it indicates that the temperature at that point is low, so the weight remains unchanged, i.e., W[i,j] = W[i,j]. If T[i,i] ≥ t_mean, it indicates that the point is in the high temperature region, and the weight value is updated according to Formula 6, where k is the weighting intensity control parameter.
[0091] It should be noted that, for implementation schemes that set more than two temperature ranges, the calculation of the weight value of the heat source target corresponding to the temperature range within different temperature ranges can all be done using the calculation method shown in Formula 6, only by adjusting the weighting intensity control parameter k to be different. Of course, it is also possible to use different weight values to calculate the weight value of the heat source target corresponding to the temperature range within different temperature ranges.
[0092] In some embodiments, the step of adaptively weighting the infrared image to be enhanced using the adaptive weight matrix and the edge gradient matrix to obtain an edge-enhanced image includes:
[0093] The edge gradient matrix is weighted and enhanced using the adaptive weight matrix to obtain the edge information matrix;
[0094] A background data matrix is extracted by performing a nonlinear transformation on the image data matrix of the infrared image to be enhanced. The background data matrix is then attenuated by a preset ratio and superimposed on the edge information matrix to obtain an edge information enhanced image.
[0095] To perform adaptive weighted enhancement on the infrared image to be enhanced, the edge information matrix can be obtained by weighting the edge gradient matrix with an adaptive weight matrix, as shown in Formula 7 below:
[0096] Edge[i, j] = G_enhance[i, j] * W[i,j] (Formula 7)
[0097] The edge information matrix is Edge[i,j], the adaptive weight matrix is W[i,j], and the edge gradient matrix is G_enhance[i,j]. The edge information matrix Edge can be rounded within the range of [0,255] before being superimposed onto the original infrared image to be enhanced to achieve the enhancement effect. Typically, the original infrared image to be enhanced already has a certain brightness. Further superposition of the edge information matrix may result in excessively bright edge information, affecting the comfort of human observation. To better meet observation requirements, in this embodiment, the image data matrix of the original infrared image to be enhanced undergoes a nonlinear transformation to suppress dark areas and extract the background data matrix. The background data matrix is then attenuated by a preset ratio before being superimposed with the edge information matrix for fusion, resulting in the final edge-enhanced image of the infrared image to be enhanced. Here, the nonlinear transformation of the image data matrix can be an exponential transformation, as shown in Formula 8 below:
[0098] Back[i,j] = (I[i,j] / 255) γ *255 (Formula 8)
[0099] Where γ is the gamma coefficient, and its value is greater than 1.
[0100] The background data matrix is denoted as 'back', the attenuation ratio is 'ratio', and the edge information matrix is 'Edge'. The superposition of the background data matrix after attenuation according to a preset ratio and the edge information matrix can be expressed as Equation 9:
[0101] Fusion = Back * ratio + Edge (Formula 9)
[0102] The ratio value is between [0,1]. Finally, the fused image information Fusion is restricted to the range of [0,255] and then rounded to output the edge information enhanced image.
[0103] To gain a more comprehensive understanding of the infrared image edge processing method provided in the embodiments of this application, please refer to... Figure 3 And using the original infrared image as Figure 4 As shown in the example, the infrared image edge processing method includes:
[0104] S11, acquire the temperature data matrix T and image data matrix I of the infrared detector;
[0105] S12 performs Gaussian filtering on the infrared image data I; Gaussian filtering preserves the main contours and strong details while reducing image noise.
[0106] S13, extract edge information from the filtered infrared image data I to obtain the edge gradient matrix; wherein, the gradient value corresponding to each pixel is calculated, and the calculation of the gradient value and the obtaining of the edge gradient matrix can be shown in the aforementioned formula 2-4, which will not be repeated here.
[0107] S14, enhance the edge information; where enhancement can be achieved by simply multiplying by a factor, or by calculating the range of edge information values, normalizing and then linearly stretching it, as shown in Formula 1 above, which will not be elaborated here.
[0108] S15, adaptive weighting of edge information is performed based on temperature data; temperature data corresponding to the infrared image is extracted, and the edge image is weighted according to the temperature data to retain high-temperature edge information and suppress low-temperature edge information, thereby ensuring that the details and contour information of the heat source target area are completely preserved. Global temperature information is used to adaptively calculate high and low temperature cutoff thresholds to better enhance the edge details of the heat source target in relatively complex backgrounds. The calculation of the adaptive weight matrix is shown in Formula 5-6 above, and will not be elaborated further here. Figure 5 The image shows a schematic diagram illustrating the effect of edge detection with adaptive weighting of edge information.
[0109] S16, extract background information; whereby the original infrared image data is subjected to nonlinear transformation to suppress the dark areas as the background image data matrix as shown in Formula 8 above, which will not be repeated here.
[0110] S17: After attenuating the background information by a certain proportion, the enhanced edge information is superimposed to output an edge-enhanced image with prominent edges. The edge-enhanced image is a fusion of the attenuated background and the enhanced edge information, as shown in Formula 9 above, and will not be elaborated further here. Figure 6 As shown, this is an image of the edge enhancement effect obtained by fusing the edge detection results with the background after adaptive weighting of the edge information.
[0111] The infrared image edge processing method provided in the above embodiments has at least the following characteristics:
[0112] First, by using the raw temperature data provided by the infrared detector, adaptive edge enhancement is performed on the infrared image. This retains the advantage of image processing algorithms in clearly representing local details and textures, while also efficiently utilizing temperature data to highlight heat source targets and distinguish background information.
[0113] Secondly, by combining temperature data and image data, the heat source area can be effectively distinguished from the background, and the edge details of the heat source target area can be preserved and adaptively enhanced, making the target more prominent and clearer.
[0114] Third, it does not require complex algorithms; it only combines temperature data for adaptive calculation, which is computationally intensive and convenient, and can be ported to various terminals and mobile infrared devices.
[0115] Please see Figure 7 In another aspect, this application provides an infrared image edge enhancement device, comprising: an acquisition module 21, configured to acquire a temperature data matrix and an image data matrix corresponding to an infrared image to be enhanced; an edge extraction module 22, configured to perform edge detection based on the image data matrix, and calculate the corresponding edge gradient value of each pixel in the infrared image to be enhanced according to the gradient in at least two directions, to obtain an edge gradient matrix of the infrared image to be enhanced; a weighting module 23, configured to determine a temperature range threshold based on the temperature data matrix, and calculate the corresponding weight value of each pixel in the infrared image to be enhanced according to different strategies based on the comparison result between the temperature value corresponding to each pixel in the infrared image to be enhanced and the temperature range threshold, to obtain an adaptive weighting matrix of the infrared image to be enhanced; and an adaptive enhancement module 24, configured to perform adaptive weighted enhancement on the infrared image to be enhanced using the adaptive weighting matrix and the edge gradient matrix, to obtain an edge information enhanced image.
[0116] The edge extraction module 22 is further used to perform enhancement processing on the edge information of the infrared image to be enhanced based on the edge gradient matrix, so as to obtain an enhanced and updated edge gradient matrix.
[0117] The edge extraction module 22 is further configured to obtain an enhanced and updated edge gradient matrix based on the product of the edge gradient matrix and a preset enhancement factor; or, to determine the gradient value range based on the edge gradient matrix, normalize the edge gradient matrix based on the gradient value range, and then multiply it with a preset linear stretching coefficient to obtain an enhanced and updated edge gradient matrix.
[0118] The edge extraction module 22 is further configured to divide the enhanced edge gradient matrix according to a set threshold, and set the values of elements in the edge gradient matrix that are less than the set threshold to zero, thereby obtaining the enhanced and updated edge gradient matrix.
[0119] The weighting module 23 is further configured to perform Gaussian filtering based on the image data matrix; perform edge detection on the Gaussian-filtered image data matrix; calculate the gradient of each pixel in the infrared image to be enhanced in at least two directions; and calculate the corresponding edge gradient value by summing the absolute values of the gradients of each pixel in each direction to obtain the edge gradient matrix of the infrared image to be enhanced.
[0120] The weighting module 23 is further configured to perform edge detection on the Gaussian-filtered image data matrix, and set corresponding convolution kernels for multiple preset angle directions respectively; for each pixel in the infrared image to be enhanced, the gradient of the pixel in the multiple preset angle directions is obtained by convolution calculation with the convolution kernels of the multiple preset angle directions respectively.
[0121] The weighting module 23 is further configured to obtain statistical data indicators as temperature interval thresholds for dividing the temperature data into multiple temperature intervals based on the temperature data matrix through statistical analysis; the statistical data indicators are selected from one of the following: mean, median, mode, quartiles; the temperature interval of each pixel is determined based on the comparison result between the temperature value corresponding to each pixel in the infrared image to be enhanced and the temperature interval threshold; and different strategies are used to calculate the corresponding weight values for the pixels in different temperature intervals to obtain the adaptive weight matrix of the infrared image to be enhanced.
[0122] The weighting module 23 is further configured to: for each pixel in the low-temperature range, use the normalized temperature data of the pixel as its corresponding weight value; for each pixel in the high-temperature range, use the product of the difference between the temperature data of the pixel and the mean temperature and the weighting intensity control parameter, plus the mean temperature, as its corresponding weight value; and obtain the adaptive weighting matrix of the infrared image to be enhanced based on the weight values of each pixel.
[0123] The adaptive enhancement module 24 is further configured to use the adaptive weight matrix to perform weighted enhancement on the edge gradient matrix to obtain an edge information matrix; perform nonlinear transformation on the image data matrix of the infrared image to be enhanced to extract a background data matrix; attenuate the background data matrix according to a preset ratio and then superimpose it with the edge information matrix to obtain an edge information enhanced image.
[0124] It should be noted that the infrared image edge enhancement device provided in the above embodiments is only illustrated by the division of the above-described program modules in the process of achieving adaptive edge enhancement and highlighting. In practical applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the method steps described above. In addition, the infrared image edge enhancement device and the infrared image edge processing method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.
[0125] This application also provides an image processing device; please refer to [link to related information]. Figure 8 This is a schematic diagram of an optional hardware structure of an image processing device provided in an embodiment of this application. The image processing device includes a processor 111 and a memory 112 connected to the processor 111. The memory 112 is used to store various types of data to support the operation of the image processing device, and stores a computer program for implementing the infrared image edge processing method provided in any embodiment of this application. When the computer program is executed by the processor, it implements the steps of the infrared image edge processing method provided in any embodiment of this application and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0126] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the various processes of the infrared image edge processing method embodiments described above, achieving the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0127] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0128] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, infrared imaging device, etc.) to execute the methods described in the various embodiments of the present invention.
[0129] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for enhancing the edges of an infrared image, characterized in that, include: Obtain the temperature data matrix and image data matrix corresponding to the infrared image to be enhanced; Edge detection is performed based on the image data matrix. The edge gradient value of each pixel in the infrared image to be enhanced is calculated according to the gradient in at least two directions, and the edge gradient matrix of the infrared image to be enhanced is obtained. Based on the temperature data matrix, statistical analysis is used to obtain statistical data indicators as temperature interval thresholds for dividing the temperature data into multiple temperature intervals; the statistical data indicators are selected from one of the following: mean, median, mode, quartiles; Based on the comparison between the temperature value corresponding to each pixel in the infrared image to be enhanced and the temperature range threshold, the temperature range in which each pixel is located is determined. Different strategies are used to calculate the corresponding weight values for the pixels in different temperature ranges to obtain the adaptive weight matrix of the infrared image to be enhanced. The infrared image to be enhanced is adaptively weighted and enhanced using the adaptive weight matrix and the edge gradient matrix to obtain an edge-enhanced image.
2. The infrared image edge enhancement method as described in claim 1, characterized in that, Before performing adaptive weighted enhancement on the infrared image to be enhanced using the adaptive weight matrix and the edge gradient matrix to obtain an edge-enhanced image, the process includes: The edge information of the infrared image to be enhanced, obtained from the edge gradient matrix, is used for enhancement processing to obtain the enhanced and updated edge gradient matrix.
3. The infrared image edge enhancement method as described in claim 2, characterized in that, The enhancement process, which involves processing the edge information of the infrared image to be enhanced based on the edge gradient matrix to obtain an enhanced and updated edge gradient matrix, includes: The enhanced and updated edge gradient matrix is obtained by multiplying the edge gradient matrix by a preset enhancement factor; or, The gradient value range is determined based on the edge gradient matrix. The edge gradient matrix is then normalized according to the gradient value range and multiplied by a preset linear stretching coefficient to obtain the enhanced and updated edge gradient matrix.
4. The infrared image edge enhancement method as described in claim 2, characterized in that, The enhanced and updated edge gradient matrix includes: The enhanced edge gradient matrix is divided according to a set threshold, and the values of elements in the edge gradient matrix that are less than the set threshold are set to zero to obtain the enhanced and updated edge gradient matrix.
5. The infrared image edge enhancement method as described in claim 1, characterized in that, The edge detection based on the image data matrix involves calculating the corresponding edge gradient values of each pixel in the infrared image to be enhanced in at least two directions to obtain the edge gradient matrix of the infrared image to be enhanced, including: Gaussian filtering is performed based on the image data matrix; Edge detection is performed on the Gaussian-filtered image data matrix, and the gradient of each pixel in the infrared image to be enhanced is calculated in at least two directions. The edge gradient matrix of the infrared image to be enhanced is obtained by summing the absolute values of the gradients of each pixel in each direction.
6. The infrared image edge enhancement method as described in claim 5, characterized in that, The step of edge detection on the Gaussian-filtered image data matrix, and calculating the gradient of each pixel in the infrared image to be enhanced in at least two directions, includes: Edge detection is performed on the Gaussian filtered image data matrix, and corresponding convolution kernels are set for directions with multiple preset angles. For each pixel in the infrared image to be enhanced, the gradient of the pixel in the multiple preset angle directions is obtained by convolving it with the convolution kernels in the multiple preset angle directions.
7. The infrared image edge enhancement method as described in claim 1, characterized in that, The temperature range threshold includes the average temperature, and the temperature range includes a high-temperature range and a low-temperature range divided by the average temperature; the step of calculating the corresponding weight values for the pixels in different temperature ranges using different strategies to obtain the adaptive weight matrix of the infrared image to be enhanced includes: For each pixel in the low temperature range, the normalized value of the pixel's temperature data is used as its corresponding weight value. For each pixel in the high temperature range, the product of the difference between the pixel's temperature data and the mean temperature and the weighted intensity control parameter, plus the mean temperature, is used as its corresponding weight value. Based on the weight values of each pixel, an adaptive weight matrix is obtained for the infrared image to be enhanced.
8. The infrared image edge enhancement method as described in claim 1, characterized in that, The step of adaptively weighting and enhancing the infrared image to be enhanced using the adaptive weight matrix and the edge gradient matrix to obtain an edge-enhanced image includes: The edge gradient matrix is weighted and enhanced using the adaptive weight matrix to obtain the edge information matrix; A background data matrix is extracted by performing a nonlinear transformation on the image data matrix of the infrared image to be enhanced. The background data matrix is then attenuated by a preset ratio and superimposed on the edge information matrix to obtain an edge information enhanced image.
9. An infrared image edge enhancement device, characterized in that, include: The acquisition module is used to acquire the temperature data matrix and image data matrix corresponding to the infrared image to be enhanced; An edge extraction module is used to perform edge detection based on the image data matrix, and calculate the corresponding edge gradient value of each pixel in the infrared image to be enhanced in at least two directions to obtain the edge gradient matrix of the infrared image to be enhanced. The weighting module is used to obtain statistical data indicators as temperature interval thresholds for dividing the temperature data into multiple temperature intervals based on the temperature data matrix through statistical analysis. The statistical data indicators are selected from one of the following: mean, median, mode, quartiles. The temperature interval of each pixel is determined based on the comparison between the temperature value corresponding to each pixel in the infrared image to be enhanced and the temperature interval threshold. Different strategies are used to calculate the corresponding weight values for the pixels in different temperature ranges to obtain the adaptive weight matrix of the infrared image to be enhanced. An adaptive enhancement module is used to adaptively weight and enhance the infrared image to be enhanced using the adaptive weight matrix and the edge gradient matrix to obtain an edge-enhanced image.
10. An image processing device, characterized in that, It includes a processor, a memory connected to the processor, and a computer program stored in the memory and executable by the processor; When the computer program is executed by the processor, it implements the infrared image edge enhancement method as described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the infrared image edge enhancement method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Edge detection method for infrared image target of power equipment
CN111931785A
Steel plate surface defect detection method based on gray texture analysis
CN115601347A