Image histogram smoothing apparatus, method, electronic device and storage medium
By determining the reference brightness and weight curves, a smooth image histogram is constructed, which solves the problem that image histograms are susceptible to noise and illumination interference, and improves the stability and anti-interference ability of image processing.
Patent Information
- Application Number
- CN202310214427.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-01
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2043-03-01
AI Technical Summary
Existing image histograms are susceptible to interference from factors such as noise and lighting, resulting in poor anti-interference and stability, which affects the stability of image processing applications.
By determining the reference brightness of the target image, the weight curves of each bar in the initial image histogram are determined based on the reference brightness. Then, by extending multiple target weight curves to the current bar and considering the influence of adjacent bars, the smoothed target statistical values are determined, and a smoothed image histogram is constructed.
It improves the anti-interference ability and stability of image histograms, buffers the drastic changes between bars caused by environmental interference, and enhances the stability of image processing.
Smart Images

Figure CN116109529B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image histogram smoothing apparatus, method, electronic device, and storage medium. Background Technology
[0002] An image histogram is a function of image grayscale values, used to describe the statistical characteristics of each grayscale level in an image; that is, it counts the number of times or frequencies of each grayscale level appear in the image. Due to its low computational cost and numerous advantages such as invariance to image translation, rotation, and scaling, image histograms are widely used in image processing fields such as image enhancement, thresholding, image retrieval, and image classification. Taking a grayscale image as an example, from an image perspective, a grayscale image histogram is a two-dimensional image. The horizontal axis represents the grayscale level of each pixel in the grayscale image, and the vertical axis represents the number of times and the frequency of each grayscale level of the pixel appearing in the grayscale image.
[0003] However, the shape of existing image histograms is easily affected by factors such as noise or lighting, which affects the stability of image histograms in the field of image processing technology. Therefore, how to improve the anti-interference ability of image histograms is an urgent problem to be solved. Summary of the Invention
[0004] This application provides an image histogram smoothing apparatus, method, electronic device, and storage medium to address the shortcomings of poor anti-interference and stability of image histograms in the prior art, thereby achieving image histogram smoothing and improving the anti-interference and stability of image histograms.
[0005] At least one embodiment of this application provides an image histogram smoothing device, comprising: an initialization module, a weight curve determination module, a smoothing module, and a construction module, wherein:
[0006] The initialization module is used to determine the initial image histogram and reference brightness corresponding to the target image, wherein the reference brightness is determined based on the global brightness mean of the target image;
[0007] The weight curve determination module is used to determine the weight curve corresponding to each bar in the initial image histogram based on the reference brightness. The weight curve is used to characterize the weight corresponding to each brightness level in each bar.
[0008] The smoothing module is used to traverse each of the bars and determine the target statistical value of the current bar based on the target weight curves extending to the current bar. The target statistical value is used to characterize the mutual influence relationship between the bars.
[0009] The construction module is used to determine a smooth image histogram based on the target statistical values of each of the bars.
[0010] According to at least one embodiment of the image histogram smoothing apparatus provided in this application, the smoothing module is specifically used for:
[0011] Determine the current weight curve corresponding to the current bar and at least one target weight curve extending to the current bar;
[0012] Based on the current weight curve and each of the target weight curves, the target brightness level corresponding to the current bar is determined;
[0013] Determine the first statistical value corresponding to each of the target brightness levels, and the target weight value of each of the target brightness levels on the current weight curve;
[0014] Based on the first statistical value and the target weight value corresponding to each of the target brightness levels, the target statistical value corresponding to the current bar is determined.
[0015] According to at least one embodiment of the image histogram smoothing apparatus provided in this application, the smoothing module determines the target brightness level corresponding to the current bar, specifically including:
[0016] Determine the adjacent bars corresponding to each of the target weight curves;
[0017] Determine the first brightness level corresponding to the current bar, and the second brightness level corresponding to each of the adjacent bars;
[0018] The union of the first brightness level and each of the second brightness levels is determined as the target brightness level.
[0019] According to at least one embodiment of the image histogram smoothing apparatus provided in this application, the initialization module is specifically used for:
[0020] Determine at least two brightness ranges corresponding to the target image;
[0021] A first statistical value is determined for each of the brightness intervals, wherein the first statistical value is determined based on the number of pixels or the probability of pixel occurrence in each of the brightness intervals;
[0022] Based on each brightness interval and the first statistical value corresponding to each brightness interval, the initial image histogram is determined, wherein: each brightness interval is used as the horizontal axis of the initial image histogram, and the first statistical value corresponding to each brightness interval is used as the vertical axis of the initial image histogram.
[0023] According to at least one embodiment of the image histogram smoothing apparatus provided in this application, the initialization module determines the brightness range corresponding to the target image, specifically including:
[0024] Determine the brightness range corresponding to the target image;
[0025] Determine at least two brightness levels corresponding to the brightness range;
[0026] Based on the sorting of the brightness levels, the intervals corresponding to the N brightness levels are determined as the brightness intervals, where N is a positive integer greater than or equal to 1 and less than the number of brightness levels.
[0027] According to at least one embodiment of the image histogram smoothing apparatus provided in this application, the initialization module determines the reference brightness corresponding to the target image, specifically including:
[0028] Determine the initial brightness corresponding to each pixel in the target image;
[0029] Based on each of the initial brightness values, the global average brightness value corresponding to the target image and the local average brightness value of the first region in the target image are determined, wherein the lower limit of the brightness value of the first region is greater than the initial brightness value of each of the other pixels in the target image other than the first region.
[0030] Based on the global average brightness and the local average brightness, the reference brightness corresponding to the target image is determined.
[0031] According to at least one embodiment of the image histogram smoothing apparatus provided in this application, the weight curve determination module is specifically used for:
[0032] For each of the bars, determine the sub-statistical value corresponding to each brightness level in the bar;
[0033] Determine the statistical mean corresponding to each of the substatistics;
[0034] Based on the statistical mean and the reference brightness, the weight curve corresponding to the bar is determined.
[0035] At least one embodiment of this application also provides an image histogram smoothing method, including:
[0036] Determine the initial image histogram and reference brightness corresponding to the target image, wherein the reference brightness is determined based on the global brightness mean of the target image;
[0037] Based on the reference brightness, a weight curve corresponding to each bar in the initial image histogram is determined, and the weight curve is used to characterize the weight of each brightness level in each bar.
[0038] Traverse each of the bars, and determine the target statistical value of the current bar based on the target weight curves extending to the current bar. The target statistical value is used to characterize the mutual influence relationship between the bars.
[0039] Based on the target statistical values of each of the bars, a smooth image histogram is determined.
[0040] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the image histogram smoothing method as described above.
[0041] This application also provides a non-transitory computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the image histogram smoothing method as described above.
[0042] The image histogram smoothing apparatus, method, electronic device, and storage medium provided in this application, under conditions of good adaptability to environmental interference such as noise and illumination, determine a reference brightness, and further determine the weight curve corresponding to each bar in the initial image histogram based on the reference brightness. By extending multiple target weight curves to the current bar, and fully considering the influence of multiple adjacent bars on the current bar, the target statistical value of the current bar after smoothing is determined, and a smooth image histogram is constructed to buffer the drastic changes between the current bar and adjacent bars caused by environmental interference, thereby improving the anti-interference ability and stability of the image histogram. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 This is a schematic diagram of the structure of an image histogram smoothing device provided in at least one embodiment of this application;
[0045] Figure 2 This is an example schematic diagram of the initial image histogram provided in at least one embodiment of this application;
[0046] Figure 3 This is one of the example schematic diagrams of the weight curve provided in at least one embodiment of this application;
[0047] Figure 4 This is a second example schematic diagram of the weighting curve provided in at least one embodiment of this application;
[0048] Figure 5 This is an example schematic diagram of a smoothed image histogram provided in at least one embodiment of this application;
[0049] Figure 6This is the third example schematic diagram of the weight curve provided in at least one embodiment of this application;
[0050] Figure 7 This is a schematic flowchart of an image histogram smoothing method provided in at least one embodiment of this application;
[0051] Figure 8 This is a schematic diagram of the structure of an electronic device provided in at least one embodiment of this application. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0053] To address the problem of poor anti-interference and stability of image histograms in existing technologies, at least one embodiment of this application provides an image histogram smoothing device. Figure 1 This is a schematic diagram of the structure of an image histogram smoothing device provided in at least one embodiment of this application, such as... Figure 1 As shown, the image histogram smoothing device 100 includes: an initialization module 110, a weight curve determination module 120, a smoothing module 130, and a construction module 140, wherein:
[0054] The initialization module 110 is used to determine the initial image histogram and reference brightness corresponding to the target image, wherein the reference brightness is determined based on the global average brightness of the target image.
[0055] Specifically, when a target image is subjected to environmental interference such as noise or lighting, a large amount of noise will appear in the target image, affecting its clarity. When obtaining the image histogram corresponding to the target image, environmental interference will cause a large height difference between two adjacent bars in the image histogram, resulting in drastic changes between the bars of the entire image histogram, thereby affecting the stability of the image histogram corresponding to the target image in the field of image processing technology. Therefore, in at least one embodiment of this application, the interference of factors such as noise and lighting on the target image is fully considered, and a reference brightness is determined by the global average brightness of the target image, so as to determine the weight curve by the reference brightness.
[0056] The weight curve determination module 120 is used to determine the weight curve corresponding to each bar in the initial image histogram based on the reference brightness. The weight curve is used to characterize the weight corresponding to each brightness level in each bar.
[0057] Specifically, after determining the reference brightness, weighting curves can be further determined to facilitate the subsequent buffering of drastic changes between bars through each weighting curve.
[0058] The smoothing module 130 is used to traverse each of the bars and determine the target statistical value of the current bar based on the target weight curves extending to the current bar. The target statistical value is used to characterize the mutual influence relationship between the bars.
[0059] Specifically, after determining the weight curves corresponding to each bar, since the weight curves extend to both sides, there is mutual influence between adjacent bars. Therefore, in at least one embodiment of this application, by extending to the target weight curve of the current bar, the influence of adjacent bars on the current bar is fully reflected, and the target statistical value corresponding to each bar after smoothing is determined.
[0060] The construction module 140 is used to determine a smooth image histogram based on the target statistical values of each of the bars.
[0061] Specifically, after determining the target statistical values corresponding to each bar after smoothing, a smooth image histogram can be constructed, and the drastic changes in the constructed smooth image histogram are reduced, and the stability is increased.
[0062] Optionally, the initialization module 110 is specifically used for:
[0063] Determine at least two brightness ranges corresponding to the target image;
[0064] A first statistical value is determined for each of the brightness intervals, wherein the first statistical value is determined based on the number of pixels or the probability of pixel occurrence in each of the brightness intervals;
[0065] Based on each brightness interval and the first statistical value corresponding to each brightness interval, the initial image histogram is determined, wherein: each brightness interval is used as the horizontal axis of the initial image histogram, and the first statistical value corresponding to each brightness interval is used as the vertical axis of the initial image histogram.
[0066] Specifically, from an image perspective, the initial image histogram is a two-dimensional image. That is, the horizontal axis of the initial image histogram represents the brightness level of each pixel in the target image, and the vertical axis represents the number of times or frequencies that pixels at each brightness level appear in the target image. This number indicates the quantity of pixels belonging to each brightness level in the target image. In other words, the width of each bar in the initial image histogram represents the brightness level of each pixel in the target image, and the height of each bar represents the number of times or frequencies that pixels at each brightness level appear in the target image. Therefore, in at least one embodiment of this application, the brightness range of the target image is divided into multiple brightness intervals. Each brightness interval is used as the horizontal axis of the initial image histogram, and the number of times pixels appear in each brightness interval is counted, or the probability is further determined based on the number of occurrences. The number of occurrences or the probability are then used as the vertical axis corresponding to that brightness interval, thereby obtaining the unsmoothed initial image histogram corresponding to the target image.
[0067] Optionally, the initialization module 110 determines the brightness range corresponding to the target image, specifically including:
[0068] Determine the brightness range corresponding to the target image;
[0069] Determine at least two brightness levels corresponding to the brightness range;
[0070] Based on the sorting of the brightness levels, the intervals corresponding to the N brightness levels are determined as the brightness intervals, where N is a positive integer greater than or equal to 1 and less than the number of brightness levels.
[0071] Specifically, generally, the horizontal axis of the initial image histogram represents the brightness level of each pixel in the target image, and the vertical axis represents the number of times or frequency of pixels at each brightness level appear in the target image. The target image can have 256, 1024, or even more brightness levels. Therefore, it is necessary to determine the number of pixels corresponding to each of the 256 or more brightness levels in the grayscale image, which requires a large amount of storage space in the electronic device. However, for electronic devices with limited storage space, it is impossible to meet the storage space required for the initial image histogram, or allocating storage space for the initial image histogram may affect the normal operation of the electronic device. Therefore, in at least one embodiment of this application, considering the remaining storage space of the electronic device, after determining the multiple brightness levels corresponding to the target image, the brightness levels are sorted, and the intervals corresponding to the N brightness levels are determined as a brightness interval. The sum of the sub-statistics corresponding to multiple brightness levels belonging to the same brightness interval is determined as the first statistical value corresponding to the brightness interval. This sub-statistic is the number of pixels in the target image belonging to that brightness level, or the probability of pixels belonging to that brightness level appearing.
[0072] Optionally, the number of times each brightness level of the target image appears can be determined by image processing software or by programming based on the brightness level and the target image. For example, when the target image is a grayscale image, the number of pixels with a grayscale value of 255 in the grayscale image can be determined by programming in Matlab.
[0073] For example, Figure 2 This is an example schematic diagram of the initial image histogram provided in at least one embodiment of this application, such as... Figure 2 As shown, taking N=16 as an example, the intervals corresponding to the 16 brightness levels are divided into a brightness interval according to the sorting of each brightness level. That is, the width of each bar in the constructed initial image histogram is 16, and they are sorted along the X-axis. The height of each bar is the number of times or probability of the pixel point corresponding to the brightness interval appears. Figure 2 In the initial image histogram shown, there are four bars with relatively obvious heights. The brightness levels corresponding to bars A1 to A4 are 15 to 79. Meanwhile, since the first statistical values corresponding to other brightness ranges are small and negligible compared to bars A1 to A4, they are not displayed in the initial image histogram.
[0074] Optionally, the initialization module 110 determines the reference brightness corresponding to the target image, specifically including:
[0075] Determine the initial brightness corresponding to each pixel in the target image;
[0076] Based on each of the initial brightness values, the global average brightness value corresponding to the target image and the local average brightness value of the first region in the target image are determined, wherein the lower limit of the brightness value of the first region is greater than the initial brightness value of each of the other pixels in the target image other than the first region.
[0077] Based on the global average brightness and the local average brightness, the reference brightness corresponding to the target image is determined.
[0078] Specifically, since the initial image histogram is easily affected by factors such as noise or lighting, in at least one embodiment of this application, the global average brightness of the target image is determined by the ratio of the initial brightness of each pixel to the number of pixels in the target image, and the local average brightness is determined by the initial brightness of the first region in the target image and the number of pixels in the first region. Further, a reference brightness is determined using the global and local average brightness values, and a weight curve is determined using the reference brightness to smooth the initial image histogram. The first region is a bright region in the target image, and its lower brightness limit can be determined by setting a preset threshold.
[0079] Optionally, when the brightness level corresponding to the target image is 256, the formula for determining the reference brightness can be as shown in equation (1), which is:
[0080] Yref = Yapl * A + (255 - YMapl) * B
[0081] Where Yref represents the reference brightness, Yapl represents the global average brightness, YMapl represents the local average brightness of the first region, the brightness range of the first region is from the preset threshold Yth to 255, and A and B both represent weighting constants, which can be set according to experience.
[0082] Optionally, the weight curve determination module 120 is specifically used for:
[0083] For each of the bars, determine the sub-statistical value corresponding to each brightness level in the bar;
[0084] Determine the statistical mean corresponding to each of the substatistics;
[0085] Based on the statistical mean and the reference brightness, the weight curve corresponding to the bar is determined.
[0086] Specifically, the weight curve can be a Gaussian smoothed curve, meaning the weight curve follows a normal distribution with the vertical axis of the bar as its axis. When determining the weight curve, in the initial image histogram, sub-statistical values of each brightness level belonging to the same brightness range are determined, and the mean of each sub-statistical value is determined as the statistical mean. Since the Gaussian smoothed curve follows a normal distribution, the Gaussian smoothed curve is determined based on the statistical mean and the reference brightness. The reference brightness can be regarded as the variance value in the Gaussian distribution, which is used to determine the width of the Gaussian smoothed curve, that is, to determine the extension range of the Gaussian smoothed curve. Moreover, the Gaussian smoothed curve corresponding to the bar is axially symmetric with the vertical axis of the bar as its axis, that is, the weight value of the Gaussian smoothed curve corresponding to the midpoint of the width of the bar is the largest.
[0087] Optionally, if the weight curve is a Gaussian smooth curve, it can be easily implemented in software.
[0088] Optionally, Figure 3 This is one of the example schematic diagrams of the weight curve provided in at least one embodiment of this application. Figure 4 This is a second example schematic diagram of the weighting curve provided in at least one embodiment of this application. Before determining the reference brightness, a reference interval [Yrefmin, Yrefmax] corresponding to the reference brightness can be determined. If the determined reference brightness approaches the minimum reference brightness value Yrefmin, then the width of the Gaussian smoothing curve corresponding to that reference brightness is smaller, and the slope of the Gaussian smoothing curve changes more significantly. Figure 3The Gaussian smoothing curves are shown, and each bar chart yields one Gaussian smoothing curve. If the determined reference brightness approaches the maximum reference brightness Yrefmax, then the width of the Gaussian smoothing curve corresponding to that reference brightness is larger, and the slope of the Gaussian smoothing curve changes less, such as... Figure 4 The Gaussian smoothed curves are shown, and each bar chart yields a Gaussian smoothed curve.
[0089] Optionally, the smoothing module 130 is specifically used for:
[0090] Determine the current weight curve corresponding to the current bar and at least one target weight curve extending to the current bar;
[0091] Based on the current weight curve and each of the target weight curves, the target brightness level corresponding to the current bar is determined;
[0092] Determine the first statistical value corresponding to each of the target brightness levels, and the target weight value of each of the target brightness levels on the current weight curve;
[0093] Based on the first statistical value and the target weight value corresponding to each of the target brightness levels, the target statistical value corresponding to the current bar is determined.
[0094] Specifically, due to the mutual influence between multiple adjacent stripes, such as Figure 3 As shown, the weight curve corresponding to each bar extends to both sides, reaching multiple bars on both sides of the current bar. The weight value corresponding to the weight curve indicates the degree of influence of the corresponding bar on the current bar. Therefore, in at least one embodiment of this application, when determining the target statistical value of the smoothed bar, i.e., when determining the height value of the smoothed bar, the current weight curve corresponding to the current bar and at least one target weight curve extending to the current bar are first determined. Since the bars on both sides have an influence on the current bar, in this embodiment of the invention, when determining the target brightness level of the current bar, it is necessary to determine the first brightness level of the current bar and the second brightness level of the adjacent bars corresponding to each target weight curve that affects the current bar. On the current weight curve, the target weight value corresponding to the target brightness level is further determined. For the target brightness level corresponding to the current bar, the target statistical value of the brightness interval corresponding to the current bar is further determined by determining the weighted sum of each target brightness level and the target weight value. By traversing each bar, the target statistical value of each bar after smoothing can be determined, thereby buffering the drastic changes in the initial histogram and increasing the stability of the image histogram in application. The formula for determining the target statistical value is shown in equation (2), which is:
[0095] D = P1*W1 + P2*W2 + ... + Pn*Wn
[0096] Where D represents the target statistical value of the current bar, P1 to Pn represent the target brightness levels belonging to the current bar, and W1 to Wn represent the target weight values corresponding to each target brightness level.
[0097] Optionally, the smoothing module 130 determines the target brightness level corresponding to the current bar, specifically including:
[0098] Determine the adjacent bars corresponding to each of the target weight curves;
[0099] Determine the first brightness level corresponding to the current bar, and the second brightness level corresponding to each of the adjacent bars;
[0100] The union of the first brightness level and each of the second brightness levels is determined as the target brightness level.
[0101] Specifically, after determining the current weight curve corresponding to the current bar and the target weight curves extending to the current bar, based on the influence of adjacent bars on the current bar, when determining the target statistical value corresponding to the current bar, in addition to the first brightness level corresponding to the current bar, it is also necessary to determine the second brightness level of the adjacent bars corresponding to each target weight curve, and determine the union of the first brightness level and each second brightness level as the target brightness level corresponding to the current bar, so as to facilitate the subsequent determination of the target weight value corresponding to each target brightness level, and thus determine the target statistical value corresponding to the current bar.
[0102] Optionally, the target weight value can be set based on experience. For example, the maximum value of the target weight value can be set to 16, and the minimum value of the target weight value can be set to 0, that is, the range of the target weight value is [0, 16]; the range of the target weight value can also be set to [0, 1].
[0103] For example, such as Figure 3 As shown, taking bar A1 as an example, the determination of the target statistical value corresponding to bar A1 includes the following steps:
[0104] (1) Determine the current weight curve corresponding to bar A1 as weight curve A. There are two target weight curves extending to bar A1, namely weight curve B and weight curve C.
[0105] (2) Determine that the first brightness level corresponding to weight curve A is 15-31, the second brightness level corresponding to weight curve B is 31-47, and the second brightness level corresponding to weight curve C is 47-63.
[0106] (3) Take the union of the first brightness level 15-31, the second brightness level 31-47, and the second brightness level 47-63 to determine the target brightness level corresponding to bar A1 as 15-63.
[0107] (4) Taking brightness levels 15, 25, 47, and 63 as examples, determine the target weight value a corresponding to brightness level 15 on the weight curve A. 15 The target weight value corresponding to brightness level 25 is a. 25 The target weight value corresponding to brightness level 47 is a. 47 The target weight value corresponding to brightness level 63 is a 63 ;
[0108] (5) The target statistic corresponding to bar A1 is D. A1 :D A1 =15*a 15 +…+25*a 25 +…+47*a 47 +…+63*a 63 .
[0109] Furthermore, if the initial image histogram includes 16 brightness intervals, then the target statistical values corresponding to the 16 smoothed bars are determined. After smoothing, the bar corresponding to the smallest and negligible first statistical value will have its height increased due to the influence of multiple adjacent bars; that is, the height deviation between multiple adjacent bars will decrease. Figure 5 This is an example schematic diagram of a smoothed image histogram provided in at least one embodiment of this application, in which... Figure 3 As shown or as Figure 4 After smoothing, the initial image histogram shown can be obtained as follows: Figure 5 The smoothed image histogram shown buffers the drastic changes in the initial image histogram, increasing the stability when applying the smoothed image histogram.
[0110] Optionally, when the device is hardware-based, determining the Gaussian smoothing curve is quite complex. To reduce the complexity of determining the weight curve, linear interpolation can be used. Figure 6 This is the third example schematic diagram of the weighting curve provided in at least one embodiment of this application, such as... Figure 6As shown, taking the current bar and the two adjacent bars on both sides as an example of mutual influence, each point on the horizontal axis represents the brightness level corresponding to each bar, and the vertical axis represents the target weight value corresponding to each brightness level. Except for bars A1 and A16, the current weight curves corresponding to bars A2 to A15 are all symmetrical about the vertical central axis of the current bar, and are extended from the midpoint of the horizontal axis of the adjacent bars on both sides. That is, the weight curve corresponding to the current bar crosses the adjacent bars on both sides. Taking bar A2 as an example, the weight value of brightness level 23 at the vertical center axis of bar A2 is set to be the highest, with a weight value of 16. In contrast, the weight value of brightness level 8 at the vertical center axis of bar A1 is the lowest, with a weight value of 0. Therefore, two points on the weight curve can be determined as (23, 16) and (8, 0). To save hardware resources and improve the calculation efficiency of the weight values corresponding to each brightness level in the transition zone, the weight values of each brightness level in the transition zone corresponding to brightness level 8-23 can be calculated by interpolation using (23, 16) and (8, 0). By determining the slope of the interpolation line between (23, 16) and (8, 0), the weight values of each brightness level in the transition zone corresponding to brightness level 8-23 can be determined. Specifically, the slope of the interpolation line between (23, 16) and (8, 0) is... The interpolation line between (23, 16) and (8, 0) can be... That is, a weighted curve extending from bar A2 to bar A1, determined by the linear interpolation, is... Similarly, the weight curve y = -x + 39, which extends from bar A2 to bar A3 through linear interpolation, can be used to determine the weight values of each brightness level in the transition zone from brightness level 23 to brightness level 39. Furthermore, since weight curves A and C for bars A1 and A3 both extend to bar A2, weight curves A and C are used as target weight curves. The union of the brightness levels of bars A2, A1, and A3 is determined as the target brightness level. The target weight value for each target brightness level is then determined on weight curve B. Finally, the target statistical value for bar A2 is obtained by weighted summation with the first statistical value corresponding to each brightness level.
[0111] It should be noted that the current weight curves corresponding to bars A2 to A15 are all symmetrical about the vertical centerline of the current bar. They can be extended not only from the midpoint of the horizontal coordinate of the bars on both sides of the axis of symmetry, but also from any position on the width of the bars on both sides of the axis of symmetry. This application does not impose any restrictions on this.
[0112] The image histogram smoothing device provided in this application, under conditions of good adaptability to environmental interference such as noise and illumination, determines a reference brightness, and further determines the weight curve corresponding to each bar in the initial image histogram based on the reference brightness. By extending multiple target weight curves to the current bar, and fully considering the influence of multiple adjacent bars on the current bar, the target statistical value of the current bar after smoothing is determined, and a smooth image histogram is constructed to buffer the drastic changes between the current bar and adjacent bars caused by environmental interference, thereby improving the anti-interference ability and stability of the image histogram.
[0113] The image histogram smoothing method provided in this application is described below. The image histogram smoothing method described below can be referred to in correspondence with the image histogram smoothing apparatus described above.
[0114] At least one embodiment of this application also provides an image histogram smoothing method. Figure 7 This is a schematic flowchart of an image histogram smoothing method provided in at least one embodiment of this application, such as... Figure 7 As shown, the method includes:
[0115] Step 710: Determine the initial image histogram and reference brightness corresponding to the target image, wherein the reference brightness is determined based on the global brightness mean of the target image;
[0116] Step 720: Based on the reference brightness, determine the weight curve corresponding to each bar in the initial image histogram. The weight curve is used to characterize the weight corresponding to each brightness level in each bar.
[0117] Step 730: Traverse each of the bars and determine the target statistical value of the current bar based on the target weight curves extending to the current bar. The target statistical value is used to characterize the mutual influence relationship between the bars.
[0118] Step 740: Determine the smoothed image histogram based on the target statistical values of each of the bars.
[0119] The image histogram smoothing method provided in this application, under conditions of good adaptability to environmental interference such as noise and illumination, determines a reference brightness, and further determines the weight curve corresponding to each bar in the initial image histogram based on the reference brightness. By extending multiple target weight curves to the current bar, and fully considering the influence of multiple adjacent bars on the current bar, the target statistical value of the current bar after smoothing is determined, and a smooth image histogram is constructed to buffer the drastic changes between the current bar and adjacent bars caused by environmental interference, thereby improving the anti-interference ability and stability of the image histogram.
[0120] Optionally, determining the target statistical value of the current bar based on the target weight curves extending to the current bar includes:
[0121] Determine the current weight curve corresponding to the current bar and at least one target weight curve extending to the current bar;
[0122] Based on the current weight curve and each of the target weight curves, the target brightness level corresponding to the current bar is determined;
[0123] Determine the first statistical value corresponding to each of the target brightness levels, and the target weight value of each of the target brightness levels on the current weight curve;
[0124] Based on the first statistical value and the target weight value corresponding to each of the target brightness levels, the target statistical value corresponding to the current bar is determined.
[0125] Optionally, determining the target brightness level corresponding to the current bar based on the current weight curve and each of the target weight curves includes:
[0126] Determine the adjacent bars corresponding to each of the target weight curves;
[0127] Determine the first brightness level corresponding to the current bar, and the second brightness level corresponding to each of the adjacent bars;
[0128] The union of the first brightness level and each of the second brightness levels is determined as the target brightness level.
[0129] Optionally, determining the initial image histogram includes:
[0130] Determine at least two brightness ranges corresponding to the target image;
[0131] A first statistical value is determined for each of the brightness intervals, wherein the first statistical value is determined based on the number of pixels or the probability of pixel occurrence in each of the brightness intervals;
[0132] Based on each brightness interval and the first statistical value corresponding to each brightness interval, the initial image histogram is determined, wherein: each brightness interval is used as the horizontal axis of the initial image histogram, and the first statistical value corresponding to each brightness interval is used as the vertical axis of the initial image histogram.
[0133] Optionally, determining the brightness range includes:
[0134] Determine the brightness range corresponding to the target image;
[0135] Determine at least two brightness levels corresponding to the brightness range;
[0136] Based on the sorting of the brightness levels, the intervals corresponding to the N brightness levels are determined as the brightness intervals, where N is a positive integer greater than or equal to 1 and less than the number of brightness levels.
[0137] Optionally, determining the reference brightness includes:
[0138] Determine the initial brightness corresponding to each pixel in the target image;
[0139] Based on each of the initial brightness values, the global average brightness value corresponding to the target image and the local average brightness value of the first region in the target image are determined, wherein the lower limit of the brightness value of the first region is greater than the initial brightness value of each of the other pixels in the target image other than the first region.
[0140] Based on the global average brightness and the local average brightness, the reference brightness corresponding to the target image is determined.
[0141] Optionally, determining the weight curves corresponding to each bar in the initial image histogram based on the reference brightness includes:
[0142] For each of the bars, determine the sub-statistical value corresponding to each brightness level in the bar;
[0143] Determine the statistical mean corresponding to each of the substatistics;
[0144] Based on the statistical mean and the reference brightness, the weight curve corresponding to the bar is determined.
[0145] Figure 8 This is a schematic diagram of the structure of an electronic device provided in at least one embodiment of this application, such as... Figure 8 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other via the communication bus 840. The processor 810 can call logical instructions in the memory 830 to execute an image histogram smoothing method, which includes:
[0146] Determine the initial image histogram and reference brightness corresponding to the target image, wherein the reference brightness is determined based on the global brightness mean of the target image;
[0147] Based on the reference brightness, a weight curve corresponding to each bar in the initial image histogram is determined, and the weight curve is used to characterize the weight of each brightness level in each bar.
[0148] Traverse each of the bars, and determine the target statistical value of the current bar based on the target weight curves extending to the current bar. The target statistical value is used to characterize the mutual influence relationship between the bars.
[0149] Based on the target statistical values of each of the bars, a smooth image histogram is determined.
[0150] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0151] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to perform the image histogram smoothing method provided by the above methods, the method including:
[0152] Determine the initial image histogram and reference brightness corresponding to the target image, wherein the reference brightness is determined based on the global brightness mean of the target image;
[0153] Based on the reference brightness, a weight curve corresponding to each bar in the initial image histogram is determined, and the weight curve is used to characterize the weight of each brightness level in each bar.
[0154] Traverse each of the bars, and determine the target statistical value of the current bar based on the target weight curves extending to the current bar. The target statistical value is used to characterize the mutual influence relationship between the bars.
[0155] Based on the target statistical values of each of the bars, a smooth image histogram is determined.
[0156] In another aspect, this application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the image histogram smoothing methods provided by the methods described above, the method comprising:
[0157] Determine the initial image histogram and reference brightness corresponding to the target image, wherein the reference brightness is determined based on the global brightness mean of the target image;
[0158] Based on the reference brightness, a weight curve corresponding to each bar in the initial image histogram is determined, and the weight curve is used to characterize the weight of each brightness level in each bar.
[0159] Traverse each of the bars, and determine the target statistical value of the current bar based on the target weight curves extending to the current bar. The target statistical value is used to characterize the mutual influence relationship between the bars.
[0160] Based on the target statistical values of each of the bars, a smooth image histogram is determined.
[0161] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0162] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, 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 can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0163] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. An image histogram smoothing apparatus characterized by comprising: The method comprises the following steps: The initialization module is configured to determine an initial image histogram corresponding to a target image and a reference brightness, wherein the reference brightness is determined based on a global brightness average of the target image. The weight curve determination module is configured to determine a weight curve corresponding to each bar in the initial image histogram based on the reference brightness, wherein the weight curve is used to represent a weight corresponding to each brightness level in each bar. The smoothing module is configured to traverse each bar, and determine a target statistical value of a current bar based on each target weight curve extending to the current bar, wherein the target statistical value is used to represent a mutual influence relationship between each bar. The construction module is configured to determine a smoothed image histogram based on the target statistical value of each bar. The smoothing module is specifically configured to:
2. The image histogram smoothing apparatus of claim 1, wherein determine a current weight curve corresponding to the current bar and at least one target weight curve extending to the current bar; determine a target brightness level corresponding to the current bar based on the current weight curve and each target weight curve; determine a first statistical value corresponding to each target brightness level and a target weight value of each target brightness level on the current weight curve; determine a target statistical value corresponding to the current bar based on the first statistical value corresponding to each target brightness level and the target weight value. The smoothing module determines the target brightness level corresponding to the current bar, and specifically comprises:
3. The image histogram smoothing apparatus of claim 2, wherein determining adjacent bars corresponding to each target weight curve; determining a first brightness level corresponding to the current bar and a second brightness level corresponding to each adjacent bar; determining a union of the first brightness level and each second brightness level as the target brightness level. The initialization module is specifically configured to:
4. The image histogram smoothing apparatus according to any one of claims 1 to 3, characterized by, determine at least two brightness intervals corresponding to the target image; determine a first statistical value corresponding to each brightness interval, wherein the first statistical value is determined based on a number of pixel points or a pixel point occurrence probability in each brightness interval; determine the initial image histogram based on each brightness interval and the first statistical value corresponding to each brightness interval, wherein each brightness interval is used as an abscissa of the initial image histogram, and the first statistical value corresponding to each brightness interval is used as an ordinate of the initial image histogram. The initialization module determines the brightness interval corresponding to the target image, and specifically comprises:
5. The image histogram smoothing apparatus of claim 4, wherein, determining a brightness range corresponding to the target image; determining at least two brightness levels corresponding to the brightness range; determining an interval corresponding to N brightness levels based on an ordering of the brightness levels, wherein N is a positive integer greater than or equal to 1 and less than a number of the brightness levels. The initialization module determines the reference brightness corresponding to the target image, and specifically comprises:
6. The image histogram smoothing apparatus of claim 4, wherein, determining an initial brightness corresponding to each pixel point in the target image; determine a global brightness mean value corresponding to the target image and a local brightness mean value in a first region of the target image based on the initial brightness of each of the pixels, the lower limit of brightness of the first region being greater than the initial brightness of each of the pixels other than the first region in the target image; determine a reference brightness corresponding to the target image based on the global brightness mean value and the local brightness mean value.
7. The image histogram smoothing apparatus of claim 6, wherein, The weight curve determination module is specifically configured to: determine a sub-statistical value corresponding to each of the brightness levels in each of the bars; determine a statistical mean value corresponding to each of the sub-statistical values; determine a weight curve corresponding to each of the bars based on the statistical mean value and the reference brightness.
8. A method of image histogram smoothing, characterized by, It comprises: determine an initial image histogram corresponding to a target image and a reference brightness, the reference brightness being determined based on a global brightness mean value of the target image; determine a weight curve corresponding to each of the bars in the initial image histogram based on the reference brightness, the weight curve being used to represent a weight corresponding to each of the brightness levels in each of the bars; traverse each of the bars, determine a target statistical value of a current bar based on each of the target weight curves extending to the current bar, the target statistical value being used to represent a mutual influence relationship between each of the bars; determine a smoothed image histogram based on the target statistical value of each of the bars.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the image histogram smoothing method of claim 8.
10. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the image histogram smoothing method of claim 8.
Citation Information
Patent Citations
Image processor and brightness adjustment method
JP2016004313A
Image processing device, image processing method, image processing program and recording medium
US20130177257A1