Image enhancement method based on adaptive mapping function and local contrast adjustment
By adopting adaptive mapping function and local contrast adjustment technology in infrared image processing, the problems of contrast reduction and blurring of details during infrared image conversion are solved, and effective enhancement of image details and improvement of contrast are achieved.
Patent Information
- Application Number
- CN202411701838.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-11-26
AI Technical Summary
The prior art causes problems of lower contrast and blurring of details when converting a 14-bit infrared image to an 8-bit image.
The image enhancement method based on adaptive mapping function and local contrast adjustment is adopted, and the dynamic range compression and detail enhancement of the image are achieved through adaptive median filtering, grayscale histogram analysis and local contrast factor calculation.
It effectively improves the detail clarity and contrast of infrared images, solves the problems of blurred details and reduced contrast during image conversion, and can better present the real situation of the target.
Smart Images

Figure CN119205594B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of infrared image detail enhancement, and in particular relates to an image enhancement method based on adaptive mapping function and local contrast adjustment. Background Art
[0002] Infrared imaging systems, with their excellent concealment and strong anti-interference capabilities, as well as their all-weather working capabilities without weather restrictions, play an indispensable role in many military and civilian fields such as military reconnaissance, night monitoring and disaster relief. However, this technology is not perfect in practical applications, especially the quality of infrared images, which has become a key factor restricting its further development. First, the low contrast and blurred edge details of infrared images are two major problems. These problems mainly stem from the basic principle of infrared imaging, that is, imaging using the thermal radiation emitted by objects. Since the difference in thermal radiation between different objects may be relatively small, coupled with the influence of complex factors such as heat exchange, infrared images often present a relatively blurred visual effect, and the edges and details of the target are difficult to present clearly. This not only increases the difficulty of target detection, but also brings great challenges to subsequent image analysis and recognition. Secondly, the dynamic range mismatch between infrared detectors and displays cannot be ignored. Modern infrared detectors usually use high-resolution analog-to-digital converters (such as 14-bit ADCs) to capture extremely rich image details and grayscale information. However, traditional displays can only display 256 grayscale levels, which is far from meeting the high dynamic range requirements of infrared images. This mismatch causes a large amount of important image information to be lost or compressed during the display process, making it impossible to fully present the true situation of the target. Summary of the invention
[0003] In view of this, the present invention aims to provide an image enhancement method based on adaptive mapping function and local contrast adjustment to solve the problems of reduced contrast and blurred details when the original 14-bit infrared image is converted into an 8-bit image in the prior art. The present invention can compress the dynamic range of the original infrared image within the display range and enhance the image details.
[0004] To achieve the above object, the technical solution created by the present invention is implemented as follows:
[0005] An image enhancement method based on adaptive mapping function and local contrast adjustment specifically comprises the following steps:
[0006] S1: Acquire an image to be processed, perform adaptive median filtering on the image to be processed, and obtain a denoised image to be processed;
[0007] S2: Obtaining a grayscale histogram of the image to be processed after denoising, and calculating a pixel number threshold of the image to be processed after denoising based on the grayscale histogram;
[0008] S3: constructing an adaptive mapping function based on the grayscale histogram and the pixel number threshold, and using the adaptive mapping function to map the image to be processed after denoising;
[0009] S4: Calculate a local contrast factor and a brightness shift factor, and use the local contrast factor and the brightness shift factor to perform detail enhancement on the mapped image to be processed to obtain a detail enhanced image.
[0010] Furthermore, step S1 specifically includes the following steps:
[0011] S11: Set the adaptive median filter window of the pixel point (x, y) of the image to be processed to , and the maximum median filter window of the pixel point (x, y) of the image to be processed is set to , adaptive median filter window value Less than the maximum median filter window value ;
[0012] S12: Determine the median gray value in the adaptive median filter window Whether the first condition is met, if so, execute step S13, otherwise, expand the adaptive median filter window value and execute step S14;
[0013] S13: Determine the gray value of the pixel (x, y) Whether the second condition is met, if so, the gray value of the pixel (x, y) Remain unchanged, otherwise replace the grayscale value of the pixel (x, y) with the median grayscale value Output;
[0014] S14: If the expanded adaptive median filter window value is greater than the maximum median filter window value, the gray value of the pixel point (x, y) Remain unchanged, otherwise re-execute step S12;
[0015] S15: Replace the current pixel with the next pixel, and repeat steps S11-S14 until the denoising operation on all pixels of the image to be processed is completed.
[0016] Furthermore, in step S12, the first condition is the median gray value satisfy ;
[0017] is the adaptive median filter window The minimum gray value in is the adaptive median filter window The maximum gray value in .
[0018] Furthermore, in step S13, the second condition is the gray value satisfy .
[0019] Furthermore, in step S2, the formula used to calculate the pixel number threshold k of the image to be processed after noise reduction is:
[0020] ;
[0021] in, Grayscale histogram The number of non-zero gray levels in is the number of rows of the image to be processed after denoising, is the number of columns of the image to be processed after denoising, is the adaptive median filter window The maximum gray value in .
[0022] Furthermore, in step S3, the specific steps of constructing the adaptive mapping function are as follows:
[0023] S31: Traverse the grayscale histogram , set the first gray level greater than the pixel number threshold as L min ;
[0024] S32: Set the growth step , the gray level L min As the starting point, follow the growth step size to The gray level is searched and the last gray level greater than the pixel number threshold is set as L max ;
[0025] S33: Construct an adaptive mapping function:
[0026] ;
[0027] in, is the mapping result of the jth gray level, , is The index of the pixel number threshold within the gray level interval is greater than the pixel number threshold, and K is the pixel number threshold.
[0028] Further, in step S32, the step length is increased The calculation formula is:
[0029] ;
[0030] in, For the grayscale histogram The gray level is greater than the pixel number threshold The total number of .
[0031] Furthermore, in step S4, the calculation formula of the local contrast factor is:
[0032] ;
[0033] in, is the local contrast factor of the pixel (x, y), is a local window centered at pixel point (x, y), is the number of pixels in the local window; is the gray value of the center pixel of the neighborhood; is the gray value of other pixels in the neighborhood except the center pixel of the neighborhood.
[0034] Furthermore, in step S4, the calculation formula of the brightness shift factor is:
[0035] ;
[0036] in, is the brightness offset factor of the pixel (x, y), is a local window centered at pixel point (x, y), is the number of pixels in the local window; is the gray value of the center pixel of the neighborhood; is the gray value of other pixels in the neighborhood except the center pixel of the neighborhood.
[0037] Compared with the prior art, the invention can achieve the following beneficial effects:
[0038] The present invention creates the image enhancement method based on adaptive mapping function and local contrast adjustment. In order to achieve perfect compression of infrared image data, the present invention designs an adaptive mapping function and its mapping rules. First, the original high-bit infrared image is subjected to noise reduction processing using adaptive median filtering. Then, the pixel number threshold is obtained using the grayscale histogram of the infrared image after noise reduction, and an adaptive mapping function is constructed using the pixel number threshold. The 14-bit data is mapped to the 8-bit data according to the adaptive mapping function. On the basis of global mapping, detail enhancement is also performed on the local area. This detail enhancement process uses a local contrast adjustment technology, that is, the local contrast factor and the brightness offset factor are calculated using the neighborhood pixel information, and the final grayscale value of the infrared image is adjusted in combination with the local contrast factor and the adaptive mapping function. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The drawings constituting part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments and descriptions of the present invention are used to explain the present invention and do not constitute an improper limitation on the present invention. In the drawings:
[0040] Figure 1 A schematic diagram of a flow chart of an image enhancement method based on an adaptive mapping function and local contrast adjustment according to an embodiment of the present invention;
[0041] Figure 2 In the first type of scenario described in the embodiments of the present invention, a comparison diagram is obtained after the image to be processed is processed by using the present invention and histogram linear mapping;
[0042] Figure 3 In the second scenario described in the embodiment of the present invention, a comparison diagram is obtained after the image to be processed is processed by using the present invention and histogram linear mapping. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the invention more clear, the invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described here are only used to explain the invention and do not constitute a limitation of the invention.
[0044] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0045] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, the terms "first", "second", etc. are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", etc. may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.
[0046] In the description of the invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installation", "connection" and "connection" 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 it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the invention can be understood according to specific circumstances.
[0047] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments.
[0048] like Figure 1 As shown, the present invention provides an image enhancement method based on adaptive mapping function and local contrast adjustment, which specifically includes the following steps:
[0049] S1: Acquire an image to be processed (the image to be processed is an infrared image), perform adaptive median filtering on the image to be processed, and obtain a denoised image to be processed.
[0050] When performing noise reduction on the image to be processed, in order to smooth the impulse noise with a higher probability and retain more high-frequency details when smoothing the non-impulse noise, an adaptive median filter is used to perform noise reduction on the target image, specifically:
[0051] S11: Set the adaptive median filter window of the pixel point (x, y) of the image to be processed to , and the maximum median filter window of the pixel point (x, y) of the image to be processed is set to , adaptive median filter window value Less than the maximum median filter window value .
[0052] S12: Determine the median gray value in the adaptive median filter window Whether the first condition is met, if so, execute step S13, otherwise, expand the adaptive median filter window value and execute step S14.
[0053] The first condition is the median gray value satisfy , for ease of understanding, the following equation can be set to describe the first condition: , ,if and , then it represents the median gray value The first condition is met. Z1 and Z2 are coefficients describing the first condition and have no physical meaning.
[0054] S13: Determine the gray value of the pixel (x, y) Whether the second condition is met, if so, the gray value of the pixel (x, y) Remain unchanged, otherwise replace the grayscale value of the pixel (x, y) with the median grayscale value Output.
[0055] The second condition is the gray value satisfy , similarly, the following equation can be set to describe the second condition: , ,if and , then it represents the gray value The second condition is met. g1 and g2 are coefficients describing the second condition and have no physical meaning.
[0056] S14: If the expanded adaptive median filter window value (the maximum expanded adaptive median filter window value is 5×5) is greater than the maximum median filter window value, the gray value of the pixel (x, y) Remain unchanged, otherwise re-execute step S12.
[0057] S15: Replace the current pixel with the next pixel, and repeat steps S11-S14 until the denoising operation on all pixels of the image to be processed is completed.
[0058] The above processing can not only remove impulse noise and non-impulse noise, but also better preserve the details of the image.
[0059] S2: Obtain a grayscale histogram of the image to be processed after denoising, and calculate a pixel number threshold of the image to be processed after denoising based on the grayscale histogram.
[0060] Calculate the grayscale histogram of the image to be processed , if each pixel of the image to be processed is 14 bits, then ,definition is the pixel number threshold of the image, which can be expressed as follows:
[0061] ;
[0062] In the formula, The average number of pixels in each gray level when all gray levels of the infrared camera are output with equal probability; It is the ratio of the grayscale in the image actually output by the infrared camera to the total grayscale.
[0063] ;
[0064] In the formula, Grayscale histogram The number of non-zero gray levels in is the maximum gray level.
[0065] ;
[0066] In the formula, is the number of rows of the image to be processed after denoising, is the number of columns of the image to be processed after denoising.
[0067] That is, the formula used to calculate the pixel number threshold k of the image to be processed after denoising is:
[0068] ;
[0069] in, Grayscale histogram The number of non-zero gray levels in is the number of rows of the image to be processed after denoising, is the number of columns of the image to be processed after denoising, is the adaptive median filter window The maximum gray value in .
[0070] S3: constructing an adaptive mapping function based on the grayscale histogram and the pixel number threshold, and using the adaptive mapping function to map the image to be processed after denoising;
[0071] The specific steps to construct an adaptive mapping function are as follows:
[0072] S31: Traverse the grayscale histogram , set the first gray level greater than the pixel number threshold as L min .
[0073] S32: Set the growth step , the gray level L min As the starting point, follow the growth step size to The gray level is searched and the last gray level greater than the pixel number threshold is set as L max .
[0074] Growth step ( The calculation formula for the growth step when converting a 14-bit image to an 8-bit image is:
[0075] ;
[0076] in, For the grayscale histogram In the middle, the gray level is greater than The total number of .
[0077] In the grayscale histogram In the equation, the following equation is used for the position [0, L min ) interval and located at [ L max , H max ) interval to process the gray level:
[0078] ;
[0079] in, is the mth grayscale processing result, is the maximum gray level;
[0080] S33: Construct an adaptive mapping function:
[0081] ;
[0082] in, is the mapping result of the jth gray level, , is The index of the pixel number threshold within the gray level interval is greater than the pixel number threshold, and K is the pixel number threshold.
[0083] S4: Calculate a local contrast factor and a brightness shift factor, and use the local contrast factor and the brightness shift factor to perform detail enhancement on the mapped image to be processed to obtain a detail enhanced image.
[0084] Most of the details of the image are located at the edges where there are slight differences between pixels and neighboring pixels. In order to highlight the details of the image to be processed, it is necessary to appropriately reduce the grayscale pixels with low grayscale levels and appropriately increase the grayscale pixels with high grayscale levels. This can achieve the effect of improving the local image contrast.
[0085] is the adaptive median filter window The minimum gray value in is the adaptive median filter window The maximum gray value in .
[0086] The calculation formula of the local contrast factor is:
[0087] ;
[0088] in, is the local contrast factor of the pixel (x, y), is a local window centered at pixel point (x, y), is the number of pixels in the local window; is the gray value of the center pixel of the neighborhood; is the gray value of other pixels in the neighborhood except the center pixel of the neighborhood.
[0089] The calculation formula of the brightness shift factor is:
[0090] ;
[0091] in, is the brightness offset factor of the pixel (x, y), is a local window centered at pixel point (x, y), is the number of pixels in the local window; is the gray value of the center pixel of the neighborhood; is the gray value of other pixels in the neighborhood except the center pixel of the neighborhood.
[0092] like Figure 2 As shown, in the first scenario, the left picture is a detail enhanced image obtained after the image to be processed is processed using histogram linear mapping, and the right picture is a detail enhanced image obtained after the image to be processed is processed using the method of the present invention. It can be seen from the detail restoration effects of the two images that the image detail enhancement effect of the present invention is better.
[0093] like Figure 3 As shown, in the second scenario, the left picture is a detail enhanced image obtained after the image to be processed is processed using histogram linear mapping, and the right picture is a detail enhanced image obtained after the image to be processed is processed using the method of the present invention. It can be seen from the detail restoration effects of the two images that the image detail enhancement effect of the present invention is better.
[0094] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the disclosure of the present invention can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in the present invention can be achieved, and this document does not limit this.
[0095] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An image enhancement method based on adaptive mapping function and local contrast adjustment, characterized in that: The specific steps include: S1: Acquire an image to be processed, and perform adaptive median filtering on the image to be processed to obtain a denoised image to be processed; S2: Obtaining a grayscale histogram of the image to be processed after denoising, and calculating a pixel number threshold of the image to be processed after denoising based on the grayscale histogram; S3: constructing an adaptive mapping function based on the grayscale histogram and the pixel number threshold, and mapping the image to be processed after noise reduction using the adaptive mapping function; S4: calculating a local contrast factor and a brightness shift factor, and using the local contrast factor and the brightness shift factor to perform detail enhancement on the mapped image to be processed to obtain a detail enhanced image; The calculation formula of the local contrast factor is: ; in, is the local contrast factor of the pixel (x, y), is a local window centered at the pixel point (x, y), is the number of pixels in the local window; is the gray value of the center pixel of the neighborhood; is the gray value of other pixels in the neighborhood except the center pixel of the neighborhood; The calculation formula of the brightness shift factor is: ; in, is the brightness offset factor of the pixel (x, y), is a local window centered at the pixel point (x, y), is the number of pixels in the local window; is the gray value of the center pixel of the neighborhood; is the gray value of other pixels in the neighborhood except the center pixel of the neighborhood.
2. The image enhancement method based on adaptive mapping function and local contrast adjustment according to claim 1, characterized in that: Step S1 specifically includes the following steps: S11: Set the adaptive median filter window of the pixel point (x, y) of the image to be processed to , and the maximum median filter window of the pixel point (x, y) of the image to be processed is set to , adaptive median filter window value Less than the maximum median filter window value ; S12: Determine the median gray value in the adaptive median filter window Whether the first condition is met, if so, execute step S13, otherwise, expand the adaptive median filter window value and execute step S14; S13: Determine the gray value of the pixel (x, y) Whether the second condition is met, if so, the gray value of the pixel (x, y) Remain unchanged, otherwise replace the grayscale value of the pixel (x, y) with the median grayscale value Output; S14: If the expanded adaptive median filter window value is greater than the maximum median filter window value, the gray value of the pixel point (x, y) Remain unchanged, otherwise re-execute step S12; S15: Replace the current pixel with the next pixel, and repeat steps S11-S14 until the denoising operation on all pixels of the image to be processed is completed.
3. The image enhancement method based on adaptive mapping function and local contrast adjustment according to claim 2, characterized in that: In step S12, the first condition is the median gray value satisfy ; is the adaptive median filter window The minimum gray value in is the adaptive median filter window The maximum gray value in .
4. The image enhancement method based on adaptive mapping function and local contrast adjustment according to claim 3, characterized in that: In step S13, the second condition is the gray value satisfy .
5. The image enhancement method based on adaptive mapping function and local contrast adjustment according to claim 1, characterized in that: In step S2, the formula used to calculate the pixel number threshold k of the image to be processed after noise reduction is: ; in, Grayscale histogram The number of non-zero gray levels in is the number of rows of the image to be processed after denoising, is the number of columns of the image to be processed after denoising, is the adaptive median filter window The maximum gray value in .
6. The image enhancement method based on adaptive mapping function and local contrast adjustment according to claim 1, characterized in that: In step S3, the specific steps of constructing the adaptive mapping function are as follows: S31: Traverse the grayscale histogram , set the first gray level greater than the pixel number threshold as L min ; S32: Set the growth step , the gray level L min As the starting point, follow the growth step size to The gray level is searched and the last gray level greater than the pixel number threshold is set as L max ; S33: Construct an adaptive mapping function: ; in, is the mapping result of the jth gray level, , is The index of the pixel number threshold within the gray level interval is greater than the pixel number threshold, and K is the pixel number threshold.
7. The image enhancement method based on adaptive mapping function and local contrast adjustment according to claim 6, characterized in that: In step S32, the step size is increased The calculation formula is: ; in, For the grayscale histogram The gray level is greater than the pixel number threshold The total number of .
Citation Information
Patent Citations
Image enhancement method and device, readable storage medium and computer device
CN109191394A
Large-size X-ray image enhancement method and device, electronic equipment and storage medium
CN113888436A