A scene-adaptive infrared image dimming method based on CLAHE
Through histogram statistics and adaptive shear filling mechanism, the scene adaptability of the CLAHE algorithm is improved, the problem of insufficient brightness enhancement effect of infrared images is solved, and more reasonable contrast improvement and noise control are achieved.
Patent Information
- Application Number
- CN202411433321.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-10-15
AI Technical Summary
The existing CLAHE algorithm lacks scene adaptability in infrared image brightness enhancement. The shear factor setting is too small, resulting in insufficient brightness enhancement. If it is too large, it will be overly enhanced, making it difficult to adapt to the needs of different scenarios.
Through histogram statistics, sub-block histogram shear fill, sub-block histogram mapping table generation and bilinear look-up table mapping, the shear factor and fill radius are adaptively calculated to improve the scene adaptability of the CLAHE algorithm.
The scene adaptability of the CLAHE algorithm in infrared image brightness enhancement effect is improved, and more reasonable image contrast is improved, avoiding the problem of excessive brightness of targets and noise amplification.
Smart Images

Figure CN118941481B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of infrared image processing, and in particular to a scene-adaptive infrared image dimming method based on CLAHE. Background Art
[0002] The infrared detector image data has the characteristics of wide dynamic range and low contrast. After brightness enhancement, it presents clear 8-bit image data with reasonable brightness distribution. The existing brightness enhancement methods include: histogram processing, HDR, adaptive gamma, etc. Among them, the histogram enhancement method is the most widely used because of its low complexity, low space resource consumption, and easy hardware implementation. The histogram projection, platform histogram enhancement, gradient histogram enhancement, CLAHE enhancement, etc. developed on it all have different characteristics of brightness enhancement effects. Because the contribution of each gray level is the same, the histogram projection effect is close to linear stretching, and the image contrast enhancement is limited; the platform histogram enables the upper and lower platform thresholds to distinguish the contribution of gray levels, so that the image contrast is improved; the gradient histogram uses the gradient information to count the histogram. Because the thermal target gradient information is rich, the image contrast enhancement ability is improved; CLAHE enhancement is a block + cut and fill idea. Blocking improves the local resolution of the image, and the cut and fill mechanism makes the image contrast enhancement more reasonable.
[0003] HDR wide dynamic enhancement refers to the synthesis of multiple images with different exposures, retinex, etc.; synthesis of images with different exposures is often used in visible light technology, the algorithm is complex, and it is difficult to implement, and it is not suitable for infrared image processing; the retinex method is brightness stretching (usually log, enhancing dark areas and compressing bright areas) + texture component enhancement, which can easily make the target too bright and amplify noise in infrared images. Adaptive gamma uses the histogram CDF curve to calculate the gamma factor of each gray level, and the use of power functions is not conducive to hardware implementation.
[0004] CLAHE is an image brightness enhancement algorithm that is easy to implement and has a better image enhancement effect through a block + shearing mechanism. However, the degree of image enhancement is affected by the key parameter shearing factor. If the shearing factor is set too small, the brightness enhancement is insufficient; otherwise, the brightness enhancement is excessive. In practical applications, different shearing factors need to be set according to different scenes, so the scene adaptability of the CLAHE algorithm needs to be improved. Summary of the invention
[0005] The purpose of the present invention is to provide a scene-adaptive infrared image dimming method based on CLAHE, aiming to solve the technical problem of how to improve the brightness enhancement effect of the CLAHE algorithm applied to infrared images.
[0006] The object of the present invention is to adopt the following technical solution to achieve: a scene adaptive infrared image dimming method based on CLAHE, comprising the following steps:
[0007] S1: histogram statistics;
[0008] S2: sub-block histogram clipping and filling;
[0009] S3: Sub-block histogram mapping table generation;
[0010] S4: Bilinear lookup table mapping.
[0011] Furthermore, the histogram statistics include full-image histogram statistics and block histogram statistics, wherein the full-image histogram statistics are histogram statistics for the input image Ysrc, and the full-image histogram gHist and image information are obtained; the block histogram statistics are to divide the Ysrc image into N×M sub-blocks, and perform histogram statistics on each block image to obtain N×M sub-block histograms .
[0012] Furthermore, step S1 includes the following sub-steps:
[0013] S11: Full image histogram statistics, traverse each pixel of the input image Ysrc, the input image height is recorded as gH, the width is recorded as gW, the total number of pixels is recorded as gPixelNum, the full image histogram gHist statistics are as follows:
[0014] ;
[0015] Among them, the Ysrc pixel value range is 0~16383, and the nbins of the full image histogram gHist is 16384;
[0016] S12: Statistical image mean ,variance , valid grayscale level, minimum pixel value of the image , maximum pixel value of the image ;
[0017] S13: Block histogram statistics, divide the Ysrc image into N×M sub-blocks, and each sub-block image is recorded as , the sub-block image height bH = gH / N, width bW = gW / M, and gH is divisible by N, gW is divisible by M; for the sub-block image Perform histogram statistics to obtain the sub-block histogram , the nbins of each sub-block histogram is 16384.
[0018] Furthermore, step S2 specifically includes: calculating an adaptive shearing factor, and shearing and filling each sub-block histogram.
[0019] Further, step S2 includes the following sub-steps:
[0020] S21: Calculate the adaptive shear factor fCliplimit:
[0021] ;
[0022] wherein, calculated from the image variance, ; ; is an empirical parameter;
[0023] S22: Calculate the shear fill gray level ranges yclipL and yclipR:
[0024] ;
[0025] ;
[0026] wherein, represents the minimum pixel value of the image; represents the maximum pixel value of the image; is an empirical parameter representing the tolerance of the variance deviation from the mean;
[0027] S23: Shear and fill each sub-block histogram.
[0028] Further, step S23 includes the following sub-steps:
[0029] S231: Calculate the shear total area Sclip;
[0030] S232: Fill in a loop until Sclip is equal to 0.
[0031] Further, step S3 is specifically: Generate a sub-block histogram mapping table :
[0032] ;
[0033] wherein, valid represents the number of valid gray levels, s represents the pixel value corresponding to the sub-block histogram during each loop, k ∈ [ymin, ymax], when k < ymin, ; when k > ymax, .
[0034] Further, step S3 is specifically: For the point at coordinates (m, n) on the Ysrc image, its mapped value y map (m,n) is obtained by bilinear weighted summation of the mapped values looked up from the 4 mapping tables corresponding to the location:
[0035] ;
[0036] Among them, lMap UL 、lMap UR 、lMap DL 、lMap DR For the corresponding 4 mapping tables, W UL , W UR , W DL , W DR is the bilinear weight.
[0037] The beneficial effect of the present invention is that the present invention adaptively calculates the shearing factor and the shearing filling radius by statistically analyzing the histogram information, thereby improving the scene adaptability of the CLAHE algorithm, and further improving the brightness enhancement effect of the CLAHE algorithm applied to infrared images. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, 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 the structures shown in these drawings without paying creative work.
[0039] Figure 1 It is a flow chart of the present invention;
[0040] Figure 2 This is a histogram statistics flow chart;
[0041] Figure 3 Cut and fill flow chart for sub-block histogram;
[0042] Figure 4 It is the flow chart of purifying feature point pairs of N frames of images;
[0043] Figure 5 This is the flow chart of feature point pair deduplication and fusion;
[0044] Figure 6 is a bilinear mapping table. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0046] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0047] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0048] See also Figure 1 , a scene adaptive infrared image dimming method based on CLAHE, comprising the following steps:
[0049] S1: histogram statistics;
[0050] S2: sub-block histogram clipping and filling;
[0051] S3: Sub-block histogram mapping table generation;
[0052] S4: Bilinear lookup table mapping.
[0053] In this embodiment, in step S1, the histogram statistics are divided into two steps: full-image histogram statistics and block histogram statistics. The full-image histogram statistics are histogram statistics for the input image Ysrc, and the full-image histogram gHist and image information are obtained; the block histogram statistics are to divide the Ysrc image into N×M sub-blocks, and perform histogram statistics on each block image to obtain N×M sub-block histograms. , see Figure 2 , the specific process is described as follows:
[0054] S11: Full image histogram statistics, traverse each pixel of the input image Ysrc, the input image height is recorded as gH, the width is recorded as gW, the total number of pixels is recorded as gPixelNum, the full image histogram gHist statistics are as follows:
[0055] ; Among them, the Ysrc pixel value range is 0~16383, and the nbins of the full image histogram gHist is 16384.
[0056] S12: Statistical image mean ,variance , valid grayscale level, minimum pixel value of the image , maximum pixel value of the image :
[0057] Image mean: ;
[0058] Image variance: ;
[0059] Valid grayscale number valid: the total number of grayscales whose gHist value is greater than the threshold thr (which can be 20) within the grayscale range [ymin, ymax];
[0060] Image minimum pixel value: , where i represents the pixel position in the image Ysrc, as described in S11;
[0061] Maximum pixel value of the image: , where i represents the pixel position in the image Ysrc, as described in S11;
[0062] gNum is the sum of the histogram of the entire image in the grayscale range [ymin, ymax]:
[0063] .
[0064] S13: Block histogram statistics, divide the Ysrc image into N×M sub-blocks, and each sub-block image is recorded as , the sub-block image height bH = gH / N, width bW = gW / M, and gH is divisible by N, gW is divisible by M, N = M = 4; for the sub-block image Perform histogram statistics to obtain the sub-block histogram , the statistical process is as follows: traverse the sub-block image:
[0065] .
[0066] See also Figure 3 , step S2 cuts and fills each sub-block histogram by calculating the adaptive shear factor. The specific steps are as follows:
[0067] S21: Calculate the adaptive clipping factor fCliplimit:
[0068] ;
[0069] in, Calculated by image variance, , , is an empirical parameter, where f v0 =2, f bin = 16383.
[0070] S22: Calculate the cut-fill grayscale range yclipL, yclipR:
[0071] ;
[0072] ;
[0073] Among them, represents the minimum pixel value of the image; represents the maximum pixel value of the image; is an empirical parameter, representing the tolerance of the variance deviating from the mean, and can take 3.
[0074] S23: Clip and fill each sub-block histogram. Taking the sub-block as an example, see Figure 4 The specific steps are as follows:
[0075] S231: Calculate the total clip area Sclip:
[0076] ;
[0077] The gray level k ∈ [ymin, ymax], fClip = 3;
[0078] S232: Loop to fill until Sclip is equal to 0. See Figure 5 The filling steps are as follows:
[0079] S2321: Calculate the filling mean Smean, ;
[0080] S2322: k ∈ [ymin, ymax], traverse k,
[0081] When lHisti(k) > fCliplimt is satisfied, lHisti(k) = fCliplimt, and at the same time Sclip changes accordingly, Sclip = Sclip + (lHisti(k) - fCliplimt);
[0082] When fCliplimt > lHisti(k) > fCliplimt - Smean is satisfied, lHisti(k) = fCliplimt, and at the same time Sclip changes accordingly, Sclip = Sclip + (lHisti(k) - fCliplimt);
[0083] When lHisti(k) < fCliplimt - Smean and k ∈ [yclipL, yclipR] are satisfied, lHisti(k) = lHisti(k) + Smean, and at the same time Sclip changes accordingly, Sclip = Sclip – Smean.
[0084] In this embodiment, step S3 is specifically: generating a sub-block histogram mapping table Taking the sub-block histogram lHisti as an example, calculate the cumulative distribution:
[0085] ;
[0086] Among them, valid represents the number of valid gray levels, s represents the pixel value corresponding to the sub-block histogram in each cycle, k ∈ [ymin, ymax], when k < ymin, ; when k > ymax, .
[0087] In this embodiment, step S4 is specifically: bilinear look-up table mapping. For the point at coordinates (m, n) on the Ysrc image, its mapped value ymap(m, n) is obtained by bilinearly weighted summation of the look-up table mapped values of the 4 corresponding look-up tables:
[0088] ;
[0089] Among them, lMap UL 、lMap UR 、lMap DL 、lMap DR are the corresponding 4 look-up tables, and W UL 、W UR 、W DL 、W DR are the bilinear weights, and the corresponding rules are as Figure 6 shown. Among them, the Ysrc image is as Figure 6 shown by the solid-line square frame in the figure. Ysrc is divided into M × N sub-blocks (in the figure, M = N = 4), with the sub-block height bH and width bW.
[0090] Expand the boundaries of Ysrc, expand horizontally in each direction, and expand vertically in each direction. The expansion method is replication, and the expansion area is as Figure 6 shown by the area outside the solid-line square frame. The dotted-line frame is the moving frame, with the same size as the sub-block. As the dotted-line frame moves, the mapping of each point on the Ysrc image will be completed. The dotted-line frame moves within the expanded image area, with a horizontal movement step of bW and a vertical movement step of bH. The vertex coordinates of the dotted-line frame are:
[0091] ;
[0092] The dotted-line frame is divided into 2 × 2 areas, and each area corresponds to a look-up table. The look-up table corresponding to the upper-left area inside the dotted-line frame is denoted as lMap UL , and the weight is denoted as W ULThe same is true for other areas. The mapping table selection principle follows: the pixel at the center of a certain area inside the dotted box comes from which sub-block of Ysrc, and the mapping table of the corresponding sub-block is selected as the mapping table of the area. According to the position of the dotted box, the corresponding 4 mapping table rules are divided into 3 categories:
[0093] The first type, the dotted box where the point (m1, n1) is located, is a vertex type box. The pixels covered by the dotted box all belong to the same sub-block block11 of the Ysrc image, so the four mapping tables are all mapping tables of this sub-block.
[0094] The second type, the dotted box where the point (m2, n2) is located, is a boundary type box. The centers of the dotted boxes UL and DL areas come from sub-block block12, so the mapping tables selected by UL and DL come from block12; similarly, the mapping tables of UR and DR come from block13.
[0095] The third category, the dotted box where the point (m3, n3) is located, is a center type box. The central pixels of the four areas of the dotted box come from different sub-blocks, so the mapping tables of UL, UR, DL, and DR respectively select the mapping tables of sub-blocks block21, block22, block31, and block32.
[0096] Bilinear weight W UL , W UR , W DL , W DR It is generated by the distance between the point and the dotted box. Take point (m1,n1) as an example. The distance from the left border of the dotted line is xdiff, and the distance from the top border is ydiff. Then:
[0097] W UL = (bW - xdiff) * (bH - ydiff);
[0098] W UR = (xdiff) * (bH - ydiff);
[0099] W DL = (bW - xdiff) * (ydiff);
[0100] W UR = (xdiff) * (ydiff).
[0101] The present invention adaptively calculates the shearing factor and the shearing filling radius by statistically analyzing the histogram information, thereby improving the scene adaptability of the CLAHE algorithm, and further improving the brightness enhancement effect of the CLAHE algorithm when applied to infrared images.
[0102] It should be noted that, for the above embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification belong to preferred embodiments, and the actions involved are not necessarily required by the present application.
[0103] The above embodiments describe the basic principles and main features of the present invention and the advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the changes and modifications made by those skilled in the art shall be within the scope of protection of the appended claims of the present invention without departing from the spirit and scope of the present invention.
Claims
1. A scene-adaptive infrared image dimming method based on CLAHE, characterized in that: The steps include: S1: histogram statistics; S2: Cut and fill sub-block histograms; Step S2 specifically includes: calculating an adaptive cut factor, and cutting and filling each sub-block histogram; Step S2 includes the following sub-steps: S21: Calculate the adaptive clipping factor fCliplimit: ; in, Calculated by image variance, ; ; is an empirical parameter; S22: Calculate the clipping fill grayscale range yclipL, yclipR: ; ; in, Indicates the minimum pixel value of the image; Indicates the maximum pixel value of the image; is an empirical parameter, indicating the tolerance of the variance to deviate from the mean; S23: cutting and filling each sub-block histogram; S3: Sub-block histogram mapping table generation; S4: Bilinear lookup table mapping.
2. The scene-adaptive infrared image dimming method based on CLAHE as claimed in claim 1, characterized in that: The histogram statistics include full-image histogram statistics and block histogram statistics, wherein the full-image histogram statistics are for the histogram statistics of the input image Ysrc, and the full-image histogram gHist image information is obtained; the block histogram statistics are to divide the Ysrc image into N×M sub-blocks, and perform histogram statistics on each block image to obtain N×M sub-block histograms. .
3. The scene-adaptive infrared image dimming method based on CLAHE as claimed in claim 2, characterized in that: Step S1 includes the following sub-steps: S11: Full image histogram statistics, traverse each pixel of the input image Ysrc, the input image height is recorded as gH, the width is recorded as gW, the total number of pixels is recorded as gPixelNum, the full image histogram gHist statistics are as follows: ; Among them, the Ysrc pixel value range is 0~16383, and the nbins of the full image histogram gHist is 16384; S12: Statistical image mean ,variance , valid grayscale level, minimum pixel value of the image , maximum pixel value of the image ; S13: Block histogram statistics, divide the Ysrc image into N×M sub-blocks, and each sub-block image is recorded as , the sub-block image height bH = gH / N, width bW = gW / M, and gH is divisible by N, gW is divisible by M; for the sub-block image Perform histogram statistics to obtain the sub-block histogram , the nbins of each sub-block histogram is 16384.
4. The scene-adaptive infrared image dimming method based on CLAHE as claimed in claim 1, characterized in that: Step S23 includes the following sub-steps: S231: Calculate the total shear area Sclip; S232: Loop filling until Sclip is equal to 0.
5. The scene-adaptive infrared image dimming method based on CLAHE as claimed in claim 4, characterized in that: Step S3 is specifically: generating a sub-block histogram mapping table : ; Among them, valid represents the number of valid gray levels, s represents the pixel value corresponding to the sub-block histogram in each loop, k ∈ [ymin, ymax]. When k < ymin, ; when k > ymax, .
6. The scene-adaptive infrared image dimming method based on CLAHE as claimed in claim 5, characterized in that: Step S3 is as follows: for the point at coordinate (m, n) on the Ysrc image, its mapping value y map (m,n) is obtained by summing the lookup mapping values of the 4 mapping tables corresponding to the position through bilinear weights: ; Among them, lMap UL 、lMap UR 、lMap DL 、lMap DR For the corresponding 4 mapping tables, W UL , W UR , W DL , W DR is the bilinear weight.
