An image enhancement method and apparatus
By grouping and adaptively stretching the luminance components of image frames based on the human eye's luminance sensitivity curve, the problem of long processing time or limited effectiveness of existing image luminance contrast enhancement methods is solved, resulting in better visual effects.
Patent Information
- Application Number
- CN202210447189.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-26
- Publication Date
- 2026-03-20
- Estimated Expiration
- 2042-04-26
AI Technical Summary
Existing image brightness and contrast enhancement methods are time-consuming or have limited enhancement effects, and fail to fully consider the characteristics of human visual perception, resulting in unsatisfactory enhancement results.
Based on the human eye's brightness sensitivity curve, the grayscale histograms of the brightness components of the image frame are grouped to form multiple histogram groups. The stretching step size is adaptively determined according to the characteristics of each group to perform image enhancement.
The image enhancement effect has been improved, resulting in enhanced image frames with better visual effects and adapting to visual needs in different brightness scenarios.
Smart Images

Figure CN116993596B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image enhancement processing, in particular to an image enhancement method and device. BACKGROUND
[0002] Image enhancement processing is an important technology in the field of digital image processing. By enhancing the brightness and contrast of an image, the visual distance between each pixel can be enhanced, making it easier to identify blurred objects and improving the viewing quality of the image.
[0003] Currently, the methods for enhancing the brightness and contrast of an image mainly include the following two types: an enhancement scheme based on spatial domain filtering and an enhancement scheme based on preset curve weighted fusion. The enhancement scheme based on spatial domain filtering requires enhancing all pixel points in the image one by one, which is time-consuming. The enhancement scheme based on preset curve weighted fusion is limited by the upper limit of the intensity of the preset curve, and the actual enhancement effect is relatively conservative.
[0004] It can be seen that the above-mentioned methods for enhancing the brightness and contrast of an image all have different degrees of problems, and the above-mentioned methods are only based on the characteristics of the image itself for enhancement, so the enhancement effect is not very ideal. SUMMARY
[0005] The present application provides an image enhancement method and device, which can improve the effect of image enhancement.
[0006] In a first aspect, the present application provides an image enhancement method, comprising: obtaining a gray level histogram of a brightness component of a current image frame; grouping the gray level histogram according to a human eye brightness sensitivity curve to obtain at least two histogram groups; wherein the human eye brightness sensitivity curve is used to reflect the minimum brightness difference that can be perceived by the human eye under different background brightness; the at least two histogram groups include a first histogram group and a second histogram group, and the maximum gray level value corresponding to the first histogram group is less than the minimum gray level value corresponding to the second histogram group; determining a target stretching relationship according to the stretching step of the at least two histogram groups and the gray levels corresponding to the at least two histogram groups; the target stretching relationship is used to represent the relationship between the gray levels corresponding to the current image frame and the gray levels corresponding to a target image frame; the target image frame is an image frame obtained by enhancing the current image frame; the stretching step of the at least two histogram groups is adaptively determined based on the gray level range corresponding to the at least two histogram groups and the human eye brightness sensitivity curve; and obtaining the target image frame based on the target stretching relationship.
[0007] Based on the technical solutions provided in the present application, at least the following beneficial effects can be achieved: based on the human eye luminance sensitivity curve, the minimum luminance difference that can be perceived by the human eye under different background luminance is used to group the gray scale histograms of the luminance components of the current image frame, to obtain at least two histogram groups. In this way, when the histogram is divided, the human eye luminance sensitivity curve is introduced, so that the histogram groups obtained by the division are more in line with the visual characteristics of the human eye, which helps to improve the image enhancement effect. Further, the target gray scale histogram of the luminance component of the current image frame is obtained by stretching the at least two histogram groups according to the stretching step of the at least two histogram groups, and then the enhanced target image frame is generated according to the target gray scale histogram. Since the stretching step of the at least two histogram groups is adaptively determined based on the gray scale range corresponding to the at least two histogram groups and the human eye luminance sensitivity curve, the stretching step that is suitable for the characteristics of different histogram groups is used for stretching, which can effectively improve the image enhancement effect and make the enhanced target image frame have good visual effect.
[0008] Optionally, the grouping of the gray scale histogram according to the human eye luminance sensitivity curve to obtain at least two histogram groups comprises: determining the gray scale range corresponding to each histogram group in the at least two histogram groups according to the slope of the human eye luminance sensitivity curve; grouping the gray scale histogram based on the gray scale range corresponding to each histogram group to obtain the at least two histogram groups.
[0009] Optionally, the at least two histogram groups further comprise a third histogram group, the maximum gray scale value corresponding to the second histogram group is less than the minimum gray scale value corresponding to the third histogram group; in the gray scale range corresponding to the first histogram group, the greater the gray scale value, the smaller the absolute value of the slope of the human eye luminance sensitivity curve; in the gray scale range corresponding to the second histogram group, the greater the gray scale value, the greater the absolute value of the slope of the human eye luminance sensitivity curve; in the gray scale range corresponding to the third histogram group, the greater the gray scale value, the greater the absolute value of the slope of the human eye luminance sensitivity curve.
[0010] Optionally, the method further comprises: adjusting the gray scale range corresponding to the at least two histogram groups; and determining the stretching step of the at least two histogram groups according to the adjusted gray scale range corresponding to the at least two histogram groups and the human eye luminance sensitivity curve.
[0011] Optionally, the determination of the stretching step of the at least two histogram groups according to the adjusted gray scale range corresponding to the at least two histogram groups and the human eye luminance sensitivity curve comprises: determining the maximum value of the stretching step of the at least two histogram groups according to the human eye luminance sensitivity curve; and determining the stretching step of the at least two histogram groups according to the adjusted gray scale range corresponding to the at least two histogram groups and the maximum value of the stretching step of the at least two histogram groups.
[0012] Optionally, the at least two histogram groups further include a third histogram group, and a maximum gray value corresponding to the second histogram group is less than a minimum gray value corresponding to the third histogram group; and the adjusting the gray value ranges corresponding to the at least two histogram groups comprises: when a ratio of a total pixel number corresponding to the first histogram group to a total pixel number of the current image frame is less than a first threshold, lowering an upper bound of the gray value range corresponding to the first histogram group according to the total pixel number corresponding to the first histogram group; and / or when a ratio of a total pixel number corresponding to the third histogram group to the total pixel number of the current image frame is less than a second threshold, raising a lower bound of the gray value range corresponding to the third histogram group according to the total pixel number corresponding to the third histogram group.
[0013] Optionally, the method further comprises: determining valid gray values in the gray value histogram according to the pixel numbers corresponding to each gray value in the gray value histogram or the maximum valid gray value interval; wherein the valid gray value is a gray value in the gray value histogram corresponding to a pixel number greater than or equal to a preset pixel number or a valid gray value interval greater than a maximum valid gray value interval; the valid gray value interval is a number of low-probability gray values between two adjacent valid gray values, and the low-probability gray value is a gray value in the gray value histogram corresponding to a pixel number less than a preset pixel number; adjusting the at least two histogram groups according to the valid gray values in the gray value histogram to obtain updated at least two histogram groups; and determining the target stretching relationship according to the stretching step lengths of the at least two histogram groups and the gray values corresponding to the at least two histogram groups comprises: determining the target stretching relationship according to the stretching step lengths of the at least two histogram groups and the valid gray values corresponding to the updated at least two histogram groups.
[0014] Optionally, the obtaining the target image frame based on the target stretching relationship comprises: obtaining a stretched luminance component according to the target stretching relationship; performing enhancement processing on an R channel, a G channel and a B channel of the RGB space of the current image frame according to the stretched luminance component to obtain an enhanced R channel, an enhanced G channel and an enhanced B channel; and merging the enhanced R channel, the enhanced G channel and the enhanced B channel to obtain the target image frame.
[0015] In a second aspect, the present application provides an image enhancement device, comprising: an acquisition module configured to acquire a gray histogram of a luminance component of a current image frame; a grouping module configured to group the gray histogram according to a luminance sensitivity curve of a human eye to obtain at least two histogram groups; wherein the luminance sensitivity curve of the human eye is used to reflect a minimum luminance difference that can be perceived by the human eye under different background luminances; the at least two histogram groups comprise a first histogram group and a second histogram group, and a maximum gray value corresponding to the first histogram group is less than a minimum gray value corresponding to the second histogram group; a stretching relationship generation module configured to determine a target stretching relationship according to stretching steps of the at least two histogram groups and grays corresponding to the at least two histogram groups; the target stretching relationship is used to represent a relationship between grays corresponding to the current image frame and grays corresponding to a target image frame; the target image frame is an image frame obtained after the current image frame is enhanced; the stretching steps of the at least two histogram groups are adaptively determined based on gray ranges corresponding to the at least two histogram groups and the luminance sensitivity curve of the human eye; and an enhancement module configured to obtain the target image frame based on the target stretching relationship.
[0016] Optionally, the grouping module is specifically configured to determine a gray range corresponding to each histogram group in the at least two histogram groups according to a slope of the luminance sensitivity curve of the human eye; and group the gray histogram based on the gray range corresponding to each histogram group to obtain the at least two histogram groups.
[0017] Optionally, the at least two histogram groups further comprise a third histogram group, and the maximum gray value corresponding to the second histogram group is less than the minimum gray value corresponding to the third histogram group; within the gray range corresponding to the first histogram group, the greater the gray value, the smaller the absolute value of the slope of the luminance sensitivity curve of the human eye; within the gray range corresponding to the second histogram group, the greater the gray value, the greater the absolute value of the slope of the luminance sensitivity curve of the human eye; and within the gray range corresponding to the third histogram group, the greater the gray value, the greater the absolute value of the slope of the luminance sensitivity curve of the human eye.
[0018] Optionally, the stretching steps of the at least two histogram groups are determined based on the gray ranges corresponding to the at least two histogram groups and the luminance sensitivity curve of the human eye.
[0019] Optionally, the grouping module is further configured to adjust the gray ranges corresponding to the at least two histogram groups; and the stretching relationship generation module is further configured to determine the stretching steps of the at least two histogram groups according to the adjusted gray ranges corresponding to the at least two histogram groups and the luminance sensitivity curve of the human eye.
[0020] Optionally, the stretching relationship generation module is specifically configured to determine a maximum value of the stretching step of the at least two histogram groups according to the luminance sensitivity curve of the human eye; and determine the stretching step of the at least two histogram groups according to the adjusted gray scale range corresponding to the at least two histogram groups and the maximum value of the stretching step of the at least two histogram groups.
[0021] Optionally, the at least two histogram groups further include a third histogram group, and the maximum gray scale value corresponding to the second histogram group is less than the minimum gray scale value corresponding to the third histogram group; and the grouping module is specifically configured to, when the ratio of the total number of pixels corresponding to the first histogram group to the total number of pixels of the current image frame is less than a first threshold value, reduce the upper bound of the gray scale range corresponding to the first histogram group according to the total number of pixels corresponding to the first histogram group; and / or, when the ratio of the total number of pixels corresponding to the third histogram group to the total number of pixels of the current image frame is less than a second threshold value, increase the lower bound of the gray scale range corresponding to the third histogram group according to the total number of pixels corresponding to the third histogram group.
[0022] Optionally, the image enhancement device further includes an adjustment module; the adjustment module is configured to determine the effective gray scales in the gray scale histogram according to the number of pixels corresponding to each gray scale in the gray scale histogram or the maximum effective gray scale interval; wherein the effective gray scale is a gray scale in the gray scale histogram corresponding to the number of pixels greater than or equal to a preset number of pixels or the effective gray scale interval greater than the maximum effective gray scale interval; the effective gray scale interval is the number of low-probability gray scales between adjacent two effective gray scales, and the low-probability gray scale is a gray scale in the gray scale histogram corresponding to the number of pixels less than a preset number of pixels; the at least two histogram groups are adjusted according to the effective gray scales in the gray scale histogram to obtain updated at least two histogram groups; and the stretching relationship generation module is further configured to determine the target stretching relationship according to the stretching step of the at least two histogram groups and the effective gray scales corresponding to the updated at least two histogram groups.
[0023] Optionally, the enhancement module is specifically configured to obtain a stretched luminance component according to the target stretching relationship; perform enhancement processing on the R channel, the G channel and the B channel of the RGB space of the current image frame according to the stretched luminance component to obtain an enhanced R channel, an enhanced G channel and an enhanced B channel; and combine the enhanced R channel, the enhanced G channel and the enhanced B channel to obtain a target image frame. BRIEF DESCRIPTION OF DRAWINGS
[0024] Figure 1 a flowchart of an image enhancement method provided by an embodiment of the present application;
[0025] Figure 2 a schematic diagram of a gray scale histogram provided by an embodiment of the present application;
[0026] Figure 3A schematic diagram of a human eye luminance sensitivity curve provided for an embodiment of the present application;
[0027] Figure 4 A flowchart of another image enhancement method provided for an embodiment of the present application;
[0028] Figure 5 A schematic diagram of another gray scale histogram provided for an embodiment of the present application;
[0029] Figure 6 A flowchart of another image enhancement method provided for an embodiment of the present application;
[0030] Figure 7 A schematic diagram of an image enhancement device provided for an embodiment of the present application;
[0031] Figure 8 A schematic diagram of another image enhancement device provided for an embodiment of the present application. DETAILED DESCRIPTION
[0032] The term "and / or", used in the present application, only describes an association relationship of associated objects, and means that there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone.
[0033] The terms "first" and "second" and the like in the description of the present application and the drawings are used to distinguish different objects, or to distinguish different treatments of the same object, and are not used to describe a specific order of the objects.
[0034] In addition, the terms "include" and "have" and any variations thereof mentioned in the description of the present application are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but can optionally include other steps or units not listed, or can optionally include other steps or units inherent to the process, method, product or device.
[0035] It should be noted that in the embodiments of the present application, the words "exemplary" or "for example" are used to mean serving as an example, instance, or illustration. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or having more advantages than other embodiments or design schemes. Rather, the use of "exemplary" or "for example" is intended to present the relevant concept in a specific manner.
[0036] In the description of the present application, unless otherwise specified, the meaning of "a plurality of" is two or more.
[0037] In order to facilitate understanding of the technical solutions of the present application, the following will first introduce the terms involved in the present application.
[0038] 1. Histogram stretching: Histogram stretching is a method for enhancing the contrast of an image, which expands or shrinks each gray level of the histogram so that each value of the gray level is uniformly distributed in the entire histogram range.
[0039] 2. Luminance sensitivity of human visual system: Because the minimum luminance difference that can be perceived by the human visual system under different background luminance is different, the minimum luminance difference that can be perceived by the human visual system under the background luminance of a certain feature is called the luminance sensitivity under the background luminance.
[0040] 3. YUV: A color encoding method, in the YUV image color space: Y represents the luminance component, U represents the hue component, and V represents the saturation component. YUV belongs to the color and brightness separation color space, and the luminance component Y in the YUV image color space is separated from the hue component U and the saturation component V. If there is only a luminance component Y in the image, the image is a black and white grayscale image.
[0041] 4. RGB: A color standard, in the RGB image color space: R represents red (Red), G represents green (Green), and B represents blue (Blue). The specific color of an RGB image is formed by superimposing the three primary colors R, G, and B. RGB belongs to the basic color space.
[0042] 5. Gray scale: White and black are divided into several levels according to the logarithmic relationship, and each level is called a gray scale. In an example, the gray scale is divided into 256 levels.
[0043] The above is an introduction to some concepts involved in the embodiments of the present application, which will not be described again below.
[0044] As described in the background, the current methods for enhancing the luminance contrast of an image mainly include: an enhancement scheme based on spatial domain filtering and an enhancement scheme based on preset curve weighted fusion. Among them, the enhancement scheme based on spatial domain filtering needs to enhance all pixel points in the image one by one, which is time-consuming. The enhancement effect of the enhancement scheme based on preset curve weighted fusion is restricted by the upper limit of the preset curve intensity, and the actual enhancement effect is relatively conservative.
[0045] It can be seen that the above-mentioned methods for enhancing the luminance contrast of an image all have different degrees of problems, and the above-mentioned methods are only based on the characteristics of the image itself for enhancement, so the enhancement effect is not very ideal.
[0046] To solve the above technical problems, the embodiment of the present application provides an image enhancement method, and the idea is as follows: based on the human eye luminance sensitivity curve, according to the minimum luminance difference that can be perceived by the human eye under different background luminance, the gray scale histogram of the luminance component of the current image frame is grouped to obtain at least two histogram groups. In this way, when the histogram is divided, the human eye luminance sensitivity curve is introduced, so that the histogram groups obtained by the division are more in line with the visual characteristics of the human eye, which helps to improve the effect of image enhancement. Further, according to the stretching step of the at least two histogram groups, the at least two histogram groups are stretched to obtain the target gray scale histogram of the luminance component of the current image frame, and then the enhanced target image frame is generated according to the target gray scale histogram. Since the stretching step of the at least two histogram groups is adaptively determined based on the gray scale range corresponding to the at least two histogram groups and the human eye luminance sensitivity curve, the stretching step suitable for the characteristics of different histogram groups is used for stretching, which can effectively improve the effect of image enhancement, so that the enhanced target image frame has good visual effect.
[0047] The embodiments provided by the present application will be described in detail below with reference to the accompanying drawings.
[0048] The image enhancement method provided by the embodiments of the present application can be executed by an image enhancement device. For example, the image enhancement device can be a server. For another example, the image enhancement device can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, and a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) \ virtual reality (VR) device, etc. The specific form of the image enhancement device is not specially limited in the present application. In the following, the image enhancement device is taken as a server for example.
[0049] The image enhancement method provided by the embodiments of the present application can be applied to different luminance scenes, such as low-illumination scenes, normal-illumination scenes, and foggy scenes, etc. For example, in a low-illumination scene, the image enhancement method provided by the embodiments of the present application can improve the detail performance of the dark area of the image; in a normal-illumination scene and a foggy scene, the image enhancement method provided by the embodiments of the present application can improve the overall contrast of the image and improve the transparency of the image.
[0050] As shown in Figure 1 The image enhancement method provided by the embodiments of the present application includes the following steps:
[0051] S101, acquire a gray scale histogram of a luminance component of the current image frame.
[0052] The gray scale histogram is a statistic of the gray scale distribution in the image. The gray scale histogram is to count the frequency of occurrence of each gray scale value in the digital image.
[0053] For example, the gray scale value of each pixel in the current image frame can be in the form shown in (a) of FIG. 1B. The frequency of occurrence of each gray scale value in the current image frame is counted according to the size of the gray scale value, and a gray scale histogram as shown in (b) of FIG. 1B can be obtained. Figure 2 Figure 2 Optionally, the ordinate of the gray scale histogram can be the frequency of occurrence of each gray scale value in the current image frame.
[0054] It can be understood that the gray scale histogram can include a plurality of histograms corresponding to a plurality of gray scale values (such as each gray scale value in the range of gray scale values). In an example, the gray scale histogram is as shown in (b) of FIG. 1B. Figure 2
[0055] In some embodiments, before step S101 is performed, the method further includes converting the current image frame from an RGB space to a YUV space. In this case, S101 includes acquiring a gray scale histogram of a luminance component Y of the current image frame.
[0056] Specifically, the current image frame is converted from the RGB space to the YUV space according to a preset conversion rule. For example, the preset conversion rule can satisfy the following formula (1):
[0057]
[0058] wherein the value range of R is [0, 255], the value range of G is [0, 255], and the value range of B is [0, 255].
[0059] S102, grouping the gray scale histogram according to the luminance sensitivity curve of the human eye to obtain at least two histogram groups.
[0060] Specifically, the gray scale histogram is grouped according to the luminance sensitivity curve of the human eye to obtain at least two histogram groups.
[0061] The human eye luminance sensitivity curve reflects the minimum luminance difference that the human eye can perceive under different background brightness levels. For example, the human eye luminance sensitivity curve can be as follows: Figure 3 The form shown. From Figure 3 As can be seen, the human eye's brightness sensitivity curve shows a trend where, as background brightness increases, the minimum brightness difference perceived by the human eye first decreases, then flattens out, and finally gradually increases slowly. This indicates that when the background brightness is low, the minimum brightness difference perceived by the human eye is large, requiring a significant grayscale difference between the background and the target; when the background brightness is moderate, the minimum brightness difference perceived by the human eye is small; and when the background brightness is high, the minimum brightness difference perceived by the human eye is higher than that perceived when the background brightness is moderate, but lower than that perceived when the background brightness is low.
[0062] In some embodiments, at least two histogram groups include: a first histogram group and a second histogram group. The maximum grayscale value corresponding to the first histogram group is less than the minimum grayscale value corresponding to the second histogram group. For example, refer to... Figure 3 The histograms corresponding to the grayscale values between 0 and 50 are divided into the first histogram group, and the histograms corresponding to the grayscale values between 50 and 255 are divided into the second histogram group.
[0063] In some embodiments, at least two histogram groups include: a first histogram group, a second histogram group, and a third histogram group. The maximum gray value corresponding to the first histogram group is less than the minimum gray value corresponding to the second histogram group, and the maximum gray value corresponding to the second histogram group is less than the minimum gray value corresponding to the third histogram group.
[0064] For example, since a smaller grayscale value means lower brightness and a larger grayscale value means higher brightness, the first histogram group can be used as the dark area histogram group; the second histogram group can be used as the medium-bright area histogram group; and the third histogram group can be used as the bright area histogram group.
[0065] It should be understood that the embodiments of this application group the grayscale histograms of the brightness components of the current image frame based on the human eye brightness sensitivity curve. The purpose is to ensure that at least two histogram groups obtained by grouping can reflect the visual characteristics of the human eye. Therefore, the embodiments of this application do not limit the number of histogram groups included in the at least two histogram groups, as long as the grouping method helps to improve the image enhancement effect.
[0066] The following explanations will use at least two histogram groups, including a first histogram group, a second histogram group, and a third histogram group, as examples.
[0067] As one possible implementation, such asFigure 4 As shown, step S102 can be specifically implemented as follows:
[0068] Step S1021: Based on the slope of the human eye luminance sensitivity curve, determine the grayscale range corresponding to each histogram group in at least two histogram groups.
[0069] As one possible implementation, 0 is used as the lower bound of the first histogram group. From low grayscale to high grayscale, the first grayscale value corresponding to the slope of the human eye brightness sensitivity curve being less than a first preset slope is used as the upper bound of the first histogram group. 255 is used as the upper bound of the third histogram group. From high grayscale to low grayscale, the first grayscale value corresponding to the slope of the human eye brightness sensitivity curve being greater than a second preset slope is used as the lower bound of the third histogram group. The grayscale range between the upper bound of the first histogram group and the lower bound of the third histogram group is used as the grayscale range corresponding to the second histogram group. For example, the grayscale value corresponding to the upper bound of the first histogram group is incremented by one to serve as the lower bound of the second histogram group, and the grayscale value corresponding to the lower bound of the third histogram group is decremented by one to serve as the upper bound of the second histogram group.
[0070] Specifically, within the grayscale range corresponding to the first histogram group, the larger the grayscale value, the smaller the absolute value of the slope of the human eye brightness sensitivity curve; within the grayscale range corresponding to the second histogram group, the larger the grayscale value, the larger the absolute value of the slope of the human eye brightness sensitivity curve; and within the grayscale range corresponding to the third histogram group, the larger the grayscale value, the larger the absolute value of the slope of the human eye brightness sensitivity curve.
[0071] Step S1022: Group the gray-level histograms based on the gray-level range corresponding to each histogram group to obtain at least two histogram groups.
[0072] In some embodiments, the histograms within the grayscale range corresponding to the first histogram group in the grayscale histogram are designated as the first histogram group; the histograms within the grayscale range corresponding to the second histogram group in the grayscale histogram are designated as the second histogram group; and the histograms within the grayscale range corresponding to the third histogram group in the grayscale histogram are designated as the third histogram group.
[0073] For example, such as Figure 5 As shown, based on the human eye brightness sensitivity curve, the histograms corresponding to the region with gray values between 0 and 50 can be divided into the first histogram group, the histograms corresponding to the region with gray values between 50 and 220 can be divided into the second histogram group, and the histograms corresponding to the region with gray values between 220 and 255 can be divided into the third histogram group.
[0074] In some embodiments, after obtaining the at least two histogram groups, the method further comprises adjusting the gray scale range corresponding to the at least two histogram groups.
[0075] Specifically, when the ratio of the total pixel number corresponding to the first histogram group to the total pixel number of the current image frame is greater than or equal to a first threshold, the gray scale range corresponding to the first histogram group is not adjusted. When the ratio of the total pixel number corresponding to the first histogram group to the total pixel number of the current image frame is less than the first threshold, the upper bound of the gray scale range corresponding to the first histogram group is lowered according to the total pixel number corresponding to the first histogram group.
[0076] The total pixel number corresponding to the first histogram group is the sum of the pixel numbers corresponding to each histogram in the first histogram group.
[0077] Optionally, when the ratio of the total pixel number corresponding to the first histogram group to the total pixel number of the current image frame is less than the first threshold, the upper bound of the gray scale range corresponding to the first histogram group is linearly attenuated according to the total pixel number corresponding to the first histogram group.
[0078] For example, when the gray scale range corresponding to the first histogram group is 0 to 50, adjusting the gray scale range corresponding to the first histogram group can satisfy the following formula (2):
[0079]
[0080] The min_level is the upper bound of the gray scale range corresponding to the first histogram group, the pixel_num is the total pixel number corresponding to the first histogram group, the floor(·) is a floor function, the An is a first threshold, and for example, when the gray scale range corresponding to the first histogram group is 0 to 50, the value of the An is 50 / 255≈0.196. i
[0081] Specifically, when the ratio of the total pixel number corresponding to the third histogram group to the total pixel number of the current image frame is greater than or equal to a second threshold, the gray scale range corresponding to the third histogram group is not adjusted. When the ratio of the total pixel number corresponding to the third histogram group to the total pixel number of the current image frame is less than the second threshold, the lower bound of the gray scale range corresponding to the third histogram group is raised according to the total pixel number corresponding to the third histogram group.
[0082] The total pixel number corresponding to the third histogram group is the sum of the pixel numbers corresponding to each histogram in the third histogram group.
[0083] Optionally, when the ratio of the total number of pixels corresponding to the third histogram group to the total number of pixels of the current image frame is less than the second threshold, the lower bound of the gray scale range corresponding to the third histogram group is linearly increased according to the total number of pixels corresponding to the third histogram group.
[0084] For example, when the gray scale range corresponding to the third histogram group is 220 to 255, the adjustment of the gray scale range corresponding to the third histogram group can satisfy the following formula (3):
[0085]
[0086] wherein max_level is the lower bound of the gray scale range corresponding to the third histogram group, Li is the second threshold, and for example, when the gray scale range corresponding to the third histogram group is 220 to 255, the value of Li is 35 / 255≈0.137.
[0087] In some embodiments, the gray scale range between the upper bound of the gray scale range corresponding to the first histogram group and the lower bound of the gray scale range corresponding to the third histogram group is taken as the gray scale range corresponding to the second histogram group.
[0088] In some embodiments, the above method further comprises determining the stretching step of the at least two histogram groups.
[0089] wherein the stretching step of the at least two histogram groups is adaptively determined based on the gray scale range corresponding to the at least two histogram groups and the luminance sensitivity curve of the human eye. Optionally, the stretching step of the at least two histogram groups can be predefined based on the gray scale range corresponding to the at least two histogram groups and the luminance sensitivity curve of the human eye, or can be adaptively determined based on the gray scale range corresponding to the at least two histogram groups and the luminance sensitivity curve of the human eye. The adaptivity of the method is reflected in that the gray scale range corresponding to the at least two histogram groups can be adjusted according to the number of pixels contained in the gray scale range corresponding to the at least two histogram groups, and the stretching step of the at least two histogram groups is further adjusted in real time.
[0090] As a possible implementation, the stretching step of the at least two histogram groups is adaptively determined based on the adjusted gray scale range corresponding to the at least two histogram groups and the luminance sensitivity curve of the human eye.
[0091] Specifically, it can be implemented as follows:
[0092] Step a1, determining the maximum value of the stretching step of the at least two histogram groups according to the luminance sensitivity curve of the human eye.
[0093] In some embodiments, due to the gray scale range corresponding to the first histogram group, the minimum luminance difference that can be perceived by the human eye on the human eye luminance sensitivity curve is the largest, so the maximum value of the stretching step of the first histogram group is the largest; due to the gray scale range corresponding to the second histogram group, the minimum luminance difference that can be perceived by the human eye on the human eye luminance sensitivity curve is the smallest, so the maximum value of the stretching step of the second histogram group is the smallest; due to the gray scale range corresponding to the third histogram group, the minimum luminance difference that can be perceived by the human eye on the human eye luminance sensitivity curve is greater than the minimum luminance difference corresponding to the gray scale range of the second histogram group on the human eye luminance sensitivity curve, but smaller than the minimum luminance difference corresponding to the gray scale range of the first histogram group on the human eye luminance sensitivity curve, so the maximum value of the stretching step of the third histogram group is greater than the maximum value of the stretching step of the second histogram group, and smaller than the maximum value of the stretching step of the first histogram group.
[0094] For example, the maximum value of the stretching step of the first histogram group can be 4, the maximum value of the stretching step of the second histogram group can be 1, and the maximum value of the stretching step of the third histogram group can be 2.
[0095] Step a2, adaptively determining the stretching step of the at least two histogram groups according to the gray scale range corresponding to the adjusted at least two histogram groups and the maximum value of the stretching step of the at least two histogram groups.
[0096] In some embodiments, the stretching step of the second histogram group is constant, and is the maximum value of the stretching step of the second histogram group.
[0097] For example, the stretching step of the second histogram group can satisfy the following formula (4):
[0098] middle_level_step = b Formula (4)
[0099] Wherein, middle_level_step is the stretching step of the second histogram group, b is the maximum value of the stretching step of the second histogram group, and b is an integer greater than 0.
[0100] In some embodiments, when the gray scale range corresponding to the first histogram group increases, the stretching step of the first histogram group is increased; when the gray scale range corresponding to the first histogram group decreases, the stretching step of the first histogram group is decreased.
[0101] Since the gray scale range corresponding to the first histogram group increases, it indicates that the dark area of the current image frame is more, therefore, in order to see the target, the stretching step of the first histogram group should be increased; when the gray scale range corresponding to the first histogram group decreases, it indicates that the dark area of the current image frame is less, therefore, the stretching step of the first histogram group does not need to be increased.
[0102] For example, the stretching step of the first histogram group can satisfy the following formula (5):
[0103]
[0104] Wherein, min_level_step is the stretching step of the first histogram group, A is the gray scale range corresponding to the first histogram group, for example, the value of A can be 50, a is the maximum value of the stretching step of the first histogram group, a > b, MAX(, ) is the maximum function.
[0105] In some embodiments, when the gray scale range corresponding to the third histogram group increases, the stretching step of the third histogram group is increased; when the gray scale range corresponding to the third histogram group decreases, the stretching step of the third histogram group is reduced.
[0106] Since the gray scale range corresponding to the third histogram group increases, it indicates that the bright area of the current image frame is more, therefore, in order to see the target, the stretching step of the third histogram group should be increased; when the gray scale range corresponding to the third histogram group decreases, it indicates that the bright area of the current image frame is less, therefore, the stretching step of the third histogram group does not need to be increased.
[0107] For example, the stretching step of the third histogram group can satisfy the following formula (6):
[0108]
[0109] Wherein, max_level_step is the stretching step of the third histogram group, L is the gray scale range corresponding to the third histogram group, for example, the value of L can be 30, c is the maximum value of the stretching step of the third histogram group, a > c > b.
[0110] In this way, according to the gray scale range corresponding to the adjusted at least two histogram groups and the human eye brightness sensitivity curve, the stretching step of the at least two histogram groups is determined, which can be adjusted according to the actual pixel distribution of the current image frame, so that the stretching step of the at least two histogram groups determined finally is more accurate, and the image enhancement effect is improved.
[0111] As another possible implementation, the stretching step of the at least two histogram groups is determined according to the corresponding gray scale ranges of the at least two histogram groups and the human eye luminance sensitivity curve.
[0112] It should be understood that the corresponding gray scale ranges of the at least two histogram groups are determined in step S102, and the corresponding gray scale ranges of the at least two histogram groups are fixed without adjustment of the corresponding gray scale ranges of the at least two histogram groups. Since the human eye luminance sensitivity curve is also fixed, the stretching step of the at least two histogram groups can be predefined.
[0113] S103, determining a target stretching relationship according to the stretching step of the at least two histogram groups and the corresponding gray scales of the at least two histogram groups.
[0114] The target stretching relationship is used to represent the relationship between the corresponding gray scale of the current image frame and the corresponding gray scale of the target image frame. The target image frame is an image frame obtained by enhancing the current image frame.
[0115] The stretching step is used to reflect the distance between two adjacent effective gray scales in the gray scale histogram obtained according to the stretched gray scale.
[0116] In some embodiments, before step S103 is performed, the method further comprises updating the gray scale histogram. Specifically, it can be implemented as the following steps:
[0117] Step b1, determining the effective gray scale in the gray scale histogram according to the number of pixels corresponding to each gray scale in the gray scale histogram or the maximum effective gray scale interval.
[0118] The effective gray scale is a gray scale corresponding to a number of pixels greater than or equal to a preset number of pixels or an effective gray scale interval greater than a maximum effective gray scale interval in the gray scale histogram.
[0119] The effective gray scale interval is the number of low probability gray scales between two adjacent effective gray scales. The maximum effective gray scale interval is the maximum value of the number of low probability gray scales between two adjacent effective gray scales. For example, the maximum effective gray scale interval can be 5, and the number of low probability gray scales between two adjacent effective gray scales cannot exceed 5.
[0120] The low probability gray scale is a gray scale corresponding to a number of pixels less than a preset number of pixels in the gray scale histogram.
[0121] In some embodiments, the gray scale corresponding to a number of pixels greater than a preset minimum number of pixels or an effective gray scale interval greater than a maximum effective gray scale interval in the gray scale histogram is regarded as an effective gray scale in the gray scale histogram.
[0122] The preset minimum pixel number is a minimum pixel number corresponding to one gray scale. For example, the preset minimum pixel number can be determined according to "(0.05 / 255) * image resolution".
[0123] For example, the effective gray scale interval can satisfy the following formula (7):
[0124]
[0125] The merge_num is an effective gray scale interval count parameter, and the condition is a satisfaction condition. Optionally, the condition can be hist[i] > PIXEL_NUM_LIMIT or merge_num > HIST_MERGE_LIMIT, where hist[i] is a pixel number corresponding to the i-th gray scale in the gray scale histogram, i ranges from 0 to 255, PIXEL_NUM_LIMIT represents a preset minimum pixel number, and HIST_MERGE_LIMIT represents a maximum effective gray scale interval.
[0126] In step b2, the gray scale histogram is adjusted according to the effective gray scale in the gray scale histogram, to obtain an updated gray scale histogram.
[0127] In some embodiments, the pixel number corresponding to the effective gray scale in the gray scale histogram is retained, and the pixel number corresponding to the low-probability gray scale other than the effective gray scale is set to 0, to obtain an updated gray scale histogram.
[0128] For example, the pixel number corresponding to the effective gray scale in the gray scale histogram is retained, and the pixel number corresponding to the low-probability gray scale other than the effective gray scale is set to 0, to satisfy the following formula (8):
[0129]
[0130] When the condition satisfies hist[i] > PIXEL_NUM_LIMIT or merge_num > HIST_MERGE_LIMIT, it indicates that the gray scale is an effective gray scale, and the pixel number corresponding to the gray scale is retained. Otherwise, the pixel number corresponding to the gray scale is set to 0.
[0131] In this way, based on the above technical solution, by determining the effective gray scale in the gray scale histogram and adjusting the gray scale histogram, the low-probability gray scale can be removed under the premise of preventing a large number of low-probability gray scales from being lost locally and continuously, and the image enhancement effect is improved.
[0132] In some embodiments, the target stretching relationship can be represented by a stretching lookup table. Specifically, step S103 can be implemented as the following steps:
[0133] Step c1, index each gray level in the gray level range corresponding to the at least two histogram groups according to the stretch step length of the at least two histogram groups.
[0134] For example, the index of each gray level in the gray level range corresponding to the at least two histogram groups can satisfy the following formula (9):
[0135]
[0136] Wherein, the value range of i is 0 to 254, index i = 0, when i belongs to the gray level range corresponding to the first histogram group, a k The value of a is the index step length of the first histogram group, when i belongs to the gray level range corresponding to the second histogram group, a k The value of a is the index step length of the second histogram group, when i belongs to the gray level range corresponding to the third histogram group, a k The value of a is the index step length of the third histogram group.
[0137] Step c2, generate a stretch lookup table according to the index of each gray level in the gray level range corresponding to the at least two histogram groups.
[0138] For example, the stretch lookup table can satisfy the following formula (10):
[0139]
[0140] Wherein, lookup_tab is the stretch lookup table, index i Is the index of the i-th gray level.
[0141] S104, obtain a target image frame based on the target stretch relationship.
[0142] Wherein, the target image frame is an image frame obtained by enhancing the current image frame.
[0143] In some embodiments, as Figure 6 shown, step S104 can be implemented as the following steps:
[0144] S1041, obtain a stretched luminance component according to the target stretch relationship.
[0145] In some embodiments, according to the target stretch relationship, the gray level corresponding to the target image frame is obtained; according to the gray level corresponding to the target image frame (i.e. the gray level obtained by stretching the gray level corresponding to the current image frame), the stretched luminance component is obtained.
[0146] Exemplarily, when the target stretching relationship is represented as a stretching lookup table, according to the stretching lookup table, the gray scale corresponding to the target image frame can satisfy the following formula (11):
[0147] Y_en[i]=lookup_tab[Y[i]] Formula (11)
[0148] wherein Y is the gray scale before stretching, Y_en is the gray scale after stretching, and i ranges from 0 to 255.
[0149] S1042, according to the luminance component after stretching, performing enhancement processing on the R channel, G channel and B channel of the RGB space of the current image frame to obtain the enhanced R channel, G channel and B channel.
[0150] Exemplarily, according to the luminance component after stretching, performing enhancement processing on the R channel, G channel and B channel of the RGB space of the current image frame can satisfy the following formula (12):
[0151]
[0152] wherein R_en is the enhanced R channel, G_en is the enhanced G channel, and B_en is the enhanced B channel.
[0153] In this way, according to the luminance component after stretching, the three channels of the RGB space are respectively enhanced, which can enhance the color saturation of the target image frame and improve the visual effect of the target image frame.
[0154] S1043, merging the enhanced R channel, G channel and B channel to obtain the target image frame.
[0155] Based on the technical solutions provided in the embodiments of the present application, the following beneficial effects can be achieved: based on the human eye luminance sensitivity curve, according to the minimum luminance difference that can be perceived by the human eye under different background luminance, the gray scale histogram of the luminance component of the current image frame is grouped to obtain at least two histogram groups. In this way, when the histogram is divided, the human eye luminance sensitivity curve is introduced, so that the histogram groups obtained by the division are more consistent with the visual characteristics of the human eye, which helps to improve the effect of image enhancement. Further, according to the stretching step of the at least two histogram groups, the at least two histogram groups are stretched to obtain the target gray scale histogram of the luminance component of the current image frame, and then the target image frame after enhancement is generated according to the target gray scale histogram. Since the stretching step of the at least two histogram groups is adaptively determined based on the gray scale range corresponding to the at least two histogram groups and the human eye luminance sensitivity curve, the stretching step suitable for the characteristics of different histogram groups is used for stretching, which can effectively improve the effect of image enhancement, so that the target image frame after enhancement has good visual effect.
[0156] It can be seen that the above mainly introduces the scheme provided by the embodiments of the present application from the method aspect. In order to realize the above functions, the embodiments of the present application provide corresponding hardware structures and / or software modules for executing various functions. Those skilled in the art should easily realize that the modules and algorithm steps of the examples described in combination with the embodiments disclosed in the present application can be realized in the form of hardware or the combination of hardware and computer software. Whether a certain function is realized in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0157] As shown in Figure 7 , the embodiments of the present application provide an image enhancement device for executing the image enhancement method as shown in Figure 1 . The image enhancement device 300 comprises an acquisition module 301, a grouping module 302, a stretching relationship generation module 303 and an enhancement module 304.
[0158] The acquisition module 301 is configured to acquire a gray level histogram of a luminance component of a current image frame.
[0159] The grouping module 302 is configured to group the gray level histogram according to a human eye luminance sensitivity curve to obtain at least two histogram groups; wherein the human eye luminance sensitivity curve is used to reflect the minimum luminance difference that can be perceived by the human eye under different background luminance; the at least two histogram groups comprise a first histogram group and a second histogram group, and the maximum gray level value corresponding to the first histogram group is less than the minimum gray level value corresponding to the second histogram group.
[0160] The stretching relationship generation module 303 is configured to determine a target stretching relationship according to stretching steps of the at least two histogram groups and gray levels corresponding to the at least two histogram groups; the target stretching relationship is used to represent the relationship between the gray levels corresponding to the current image frame and the gray levels corresponding to a target image frame; the target image frame is an image frame obtained after the current image frame is enhanced; the stretching steps of the at least two histogram groups are adaptively determined based on the gray level ranges corresponding to the at least two histogram groups and the human eye luminance sensitivity curve.
[0161] The enhancement module 304 obtains the target image frame based on the target stretching relationship.
[0162] In some embodiments, the grouping module 302 is specifically configured to determine the gray level range corresponding to each histogram group in the at least two histogram groups according to the slope of the human eye luminance sensitivity curve; and group the gray level histogram based on the gray level range corresponding to each histogram group to obtain the at least two histogram groups.
[0163] In some embodiments, the at least two histogram groups further include a third histogram group, a maximum gray value corresponding to the second histogram group is less than a minimum gray value corresponding to the third histogram group; in a gray range corresponding to the first histogram group, the greater the gray value, the smaller the absolute value of the slope of the human eye luminance sensitivity curve; in a gray range corresponding to the second histogram group, the greater the gray value, the greater the absolute value of the slope of the human eye luminance sensitivity curve; in a gray range corresponding to the third histogram group, the greater the gray value, the greater the absolute value of the slope of the human eye luminance sensitivity curve.
[0164] In some embodiments, the stretching step of the at least two histogram groups is determined based on the gray range corresponding to the at least two histogram groups and the human eye luminance sensitivity curve.
[0165] In some embodiments, the grouping module 302 is further configured to adjust the gray range corresponding to the at least two histogram groups; and the stretching relationship generation module 303 is further configured to determine the stretching step of the at least two histogram groups according to the adjusted gray range corresponding to the at least two histogram groups and the human eye luminance sensitivity curve.
[0166] In some embodiments, the stretching relationship generation module 303 is specifically configured to determine a maximum value of the stretching step of the at least two histogram groups according to the human eye luminance sensitivity curve; and determine the stretching step of the at least two histogram groups according to the adjusted gray range corresponding to the at least two histogram groups and the maximum value of the stretching step of the at least two histogram groups.
[0167] In some embodiments, the at least two histogram groups further include a third histogram group, a maximum gray value corresponding to the second histogram group is less than a minimum gray value corresponding to the third histogram group; and the grouping module 302 is specifically configured to, when a ratio of a total number of pixels corresponding to the first histogram group to a total number of pixels of a current image frame is less than a first threshold value, lower an upper bound of the gray range corresponding to the first histogram group according to the total number of pixels corresponding to the first histogram group; and / or, when a ratio of a total number of pixels corresponding to the third histogram group to the total number of pixels of the current image frame is less than a second threshold value, raise a lower bound of the gray range corresponding to the third histogram group according to the total number of pixels corresponding to the third histogram group.
[0168] In some embodiments, the image enhancement device 300 further comprises an adjusting module 305, configured to determine valid gray scales in the gray scale histogram according to the number of pixels corresponding to each gray scale in the gray scale histogram or the maximum valid gray scale interval; wherein the valid gray scale is a gray scale in the gray scale histogram corresponding to a number of pixels greater than or equal to a preset number of pixels or a valid gray scale interval greater than the maximum valid gray scale interval; the valid gray scale interval is the number of low probability gray scales between two adjacent valid gray scales, and the low probability gray scale is a gray scale in the gray scale histogram corresponding to a number of pixels less than a preset number of pixels; the at least two histogram groups are adjusted according to the valid gray scales in the gray scale histogram to obtain updated at least two histogram groups; and the stretching relationship generation module 303 is further configured to determine the target stretching relationship according to the stretching step of the at least two histogram groups and the valid gray scales corresponding to the updated at least two histogram groups.
[0169] In some embodiments, the enhancement module 304 is specifically configured to obtain a stretched luminance component according to the target stretching relationship; perform enhancement processing on the R channel, the G channel and the B channel of the RGB space of the current image frame according to the stretched luminance component to obtain an enhanced R channel, an enhanced G channel and an enhanced B channel; and combine the enhanced R channel, the enhanced G channel and the enhanced B channel to obtain a target image frame.
[0170] In the case of implementing the functions of the above integrated modules in the form of hardware, the embodiment of the present application provides another possible structural diagram of the image enhancement device involved in the above embodiments. As shown in the figure, the image enhancement device 400 comprises a processor 402, a communication interface 403 and a bus 404. Optionally, the image enhancement device can further comprise a memory 401. Figure 8
[0171] The processor 402 can be various exemplary logical blocks, modules and circuits described in combination with the disclosure of the present application. The processor 402 can be a central processor, a general processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It can implement or execute various exemplary logical blocks, modules and circuits described in combination with the disclosure of the present application. The processor 402 can also be a combination of computing functions, such as one or more microprocessor combinations, DSP and microprocessor combinations, etc.
[0172] The communication interface 403 is configured to connect with other devices through a communication network. The communication network can be an Ethernet, a wireless access network, a wireless local area network (WLAN) and the like.
[0173] The memory 401 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to this.
[0174] As a possible implementation, the memory 401 can exist independently of the processor 402, and the memory 401 can be connected to the processor 402 through the bus 404 for storing instructions or program codes. When the processor 402 invokes and executes the instructions or program codes stored in the memory 401, the image enhancement method provided by the embodiments of the present application can be implemented.
[0175] In another possible implementation, the memory 401 can also be integrated with the processor 402.
[0176] The bus 404 can be an extended industry standard architecture (EISA) bus or the like. The bus 404 can be divided into an address bus, a data bus, a control bus, and the like. For the sake of brevity and simplicity, Figure 8 Only one thick line is used to represent the bus in the figure, but it does not mean that there is only one bus or only one type of bus.
[0177] Through the description of the above embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the above division of functional modules is taken as an example for illustration, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the image enhancement device is divided into different functional modules to complete all or part of the above described functions.
[0178] The embodiments of the present application further provide a computer readable storage medium. All or part of the processes in the above method embodiments can be directed by computer instructions to complete by relevant hardware, and the program can be stored in the computer readable storage medium. When the program is executed, the program can include the processes of the above method embodiments. The computer readable storage medium can be the memory of any of the above embodiments. The computer readable storage medium can also be an external storage device of the image enhancement device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the computer readable storage medium can include both the internal storage unit of the image enhancement device and the external storage device. The computer readable storage medium is used to store the computer program and other programs and data required by the image enhancement device. The computer readable storage medium can also be used to temporarily store data that has been output or will be output.
[0179] The embodiments of the present application further provide a computer program product, which contains a computer program, and when the computer program product runs on a computer, the computer executes any of the image enhancement methods provided in the above embodiments.
[0180] Although the present application is described herein in conjunction with various embodiments, those skilled in the art will appreciate that other variations of the disclosed embodiments are possible, as per the appended claims, without departing from the spirit and scope of the present application. In the claims, the word "comprising" does not exclude other components or steps, and the indefinite articles "a" or "an" do not exclude a plurality. A single processor or other unit can fulfill the functions of several means recited in the claims. Means recited in different claims can be combined into a single means. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0181] Although the present application is described herein in conjunction with specific features and embodiments thereof, it is obvious that various modifications and combinations are possible without departing from the spirit and scope of the present application. Accordingly, the description and drawings are merely illustrative of the present application, and are not intended to limit the scope of the present application as defined in the appended claims. Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include them.
[0182] The above merely provides the specific implementation of the present application, but the protection scope of the present application is not limited to this. Any change or replacement within the technical scope disclosed by the present application should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. An image enhancement method, characterized in that, include: Obtain the grayscale histogram of the luminance components of the current image frame; Based on the human eye brightness sensitivity curve, the grayscale histogram is grouped to obtain at least two histogram groups; wherein, the human eye brightness sensitivity curve is used to reflect the minimum brightness difference that the human eye can perceive under different background brightness; the at least two histogram groups include a first histogram group and a second histogram group, wherein the maximum grayscale value corresponding to the first histogram group is less than the minimum grayscale value corresponding to the second histogram group. The target stretching relationship is determined based on the stretching step size of the at least two histogram groups and the gray levels corresponding to the at least two histogram groups; the target stretching relationship is used to represent the relationship between the gray levels corresponding to the current image frame and the gray levels corresponding to the target image frame; the target image frame is an image frame obtained by enhancing the current image frame; the stretching step size of the at least two histogram groups is adaptively determined based on the gray level range corresponding to the at least two histogram groups and the human eye brightness sensitivity curve; The current image frame is enhanced according to the target stretching relationship to obtain the target image frame.
2. The method according to claim 1, characterized in that, The grayscale histogram is grouped according to the human eye luminance sensitivity curve to obtain at least two histogram groups, including: Based on the slope of the human eye luminance sensitivity curve, determine the grayscale range corresponding to each of the at least two histogram groups; The gray-level histograms are grouped based on the gray-level range corresponding to each histogram group to obtain at least two histogram groups.
3. The method according to claim 1 or 2, characterized in that, The at least two histogram groups also include a third histogram group, wherein the maximum gray value corresponding to the second histogram group is less than the minimum gray value corresponding to the third histogram group; Within the grayscale range corresponding to the first histogram group, the larger the grayscale value, the smaller the absolute value of the slope of the human eye brightness sensitivity curve; Within the grayscale range corresponding to the second histogram group, the larger the grayscale value, the greater the absolute value of the slope of the human eye brightness sensitivity curve; Within the grayscale range corresponding to the third histogram group, the larger the grayscale value, the greater the absolute value of the slope of the human eye brightness sensitivity curve.
4. The method according to claim 1, characterized in that, The method further includes: Adjust the grayscale range corresponding to the at least two histogram groups; The stretching step size of the at least two histogram groups is determined based on the grayscale range corresponding to the adjusted at least two histogram groups and the human eye brightness sensitivity curve.
5. The method according to claim 4, characterized in that, The step of determining the stretching step size of the at least two histogram groups based on the adjusted grayscale ranges corresponding to the at least two histogram groups and the human eye luminance sensitivity curve includes: Based on the human eye luminance sensitivity curve, determine the maximum value of the stretching step size of the at least two histogram groups; The stretching step size of the at least two histogram groups is determined based on the grayscale range corresponding to the adjusted at least two histogram groups and the maximum value of the stretching step size of the at least two histogram groups.
6. The method according to claim 4, characterized in that, The at least two histogram groups further include a third histogram group, wherein the maximum gray value corresponding to the second histogram group is less than the minimum gray value corresponding to the third histogram group; adjusting the gray range corresponding to the at least two histogram groups includes: When the ratio of the total number of pixels corresponding to the first histogram group to the total number of pixels in the current image frame is less than a first threshold, the upper bound of the grayscale range corresponding to the first histogram group is reduced based on the total number of pixels corresponding to the first histogram group; and / or, When the ratio of the total number of pixels corresponding to the third histogram group to the total number of pixels in the current image frame is less than the second threshold, the lower bound of the grayscale range corresponding to the third histogram group is raised according to the total number of pixels corresponding to the third histogram group.
7. The method according to claim 6, characterized in that, The method further includes: The effective gray levels in the gray level histogram are determined based on the number of pixels corresponding to each gray level or the maximum effective gray level interval. Specifically, an effective gray level is a gray level in the gray level histogram whose corresponding pixel count is greater than or equal to a preset pixel count or whose effective gray level interval is greater than the maximum effective gray level interval. The effective gray level interval is the number of low-probability gray levels that exist between two adjacent effective gray levels, and a low-probability gray level is a gray level in the gray level histogram whose corresponding pixel count is less than a preset pixel count. Based on the effective gray levels in the gray-level histograms, the at least two histogram groups are adjusted to obtain the updated at least two histogram groups; The target stretching relationship is determined based on the stretching step size of the at least two histogram groups and the grayscale values corresponding to the at least two histogram groups, including: The target stretching relationship is determined based on the stretching step size of the at least two histogram groups and the effective grayscale corresponding to the updated at least two histogram groups.
8. The method according to claim 7, characterized in that, The step of performing image enhancement on the current image frame according to the target stretching relationship to obtain the target image frame includes: Based on the target stretching relationship and the current image frame, the stretched luminance components are obtained; Based on the stretched luminance components, the R, G, and B channels of the RGB space of the current image frame are enhanced to obtain the enhanced R, G, and B channels. The enhanced R channel, G channel, and B channel are merged to obtain the target image frame.
9. An image enhancement device, characterized in that, include: The acquisition module is used to acquire the grayscale histogram of the luminance component of the current image frame; The grouping module is used to group the grayscale histogram according to the human eye brightness sensitivity curve to obtain at least two histogram groups; wherein, the human eye brightness sensitivity curve is used to reflect the minimum brightness difference that the human eye can perceive under different background brightness; the at least two histogram groups include a first histogram group and a second histogram group, wherein the maximum grayscale value corresponding to the first histogram group is less than the minimum grayscale value corresponding to the second histogram group. The stretching relationship generation module is used to determine a target stretching relationship based on the stretching step size of the at least two histogram groups and the grayscale values corresponding to the at least two histogram groups; the target stretching relationship represents the relationship between the grayscale values corresponding to the current image frame and the grayscale values corresponding to the target image frame; the target image frame is an image frame obtained by enhancing the current image frame; the stretching step size of the at least two histogram groups is adaptively determined based on the grayscale range corresponding to the at least two histogram groups and the human eye brightness sensitivity curve; An enhancement module is used to enhance the current image frame according to the target stretching relationship to obtain the target image frame.
Citation Information
Patent Citations
Backlight automatic adjusting method and device for electronic device
CN104715736A
Image denoising method and device, electronic equipment and readable storage medium
CN113240608A