Image enhancement method and device, electronic equipment and storage medium

By converting the RGB values ​​of image pixels to the brightness of the HSV color space, determining the gain mapping curve, and calculating the SRE gain, the RGB values ​​of the pixels are compensated, thus solving the problem of unclear images of electronic devices under strong light and improving the contrast and visual effect of the images.

CN116912134BActive Publication Date: 2026-01-23BEIJING ESWIN COMPUTING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310620458.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-29
Publication Date
2026-01-23
Estimated Expiration
2043-05-29

AI Technical Summary

Technical Problem

Electronic devices are unable to adjust the contrast of the displayed image according to the intensity of light, resulting in unclear images and a degraded display effect under strong light.

Method used

The target gain mapping curve for contrast enhancement SRE is determined by converting the RGB values ​​of image pixels to the lightness of the HSV color space, and the target SRE gain is calculated based on the lightness and gain mapping curve to compensate for the RGB values ​​of the pixels.

Benefits of technology

It improves image quality and visual effects under strong light, making blurry images clear.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116912134B_ABST
    Figure CN116912134B_ABST
Patent Text Reader

Abstract

The application relates to an image enhancement method and device, electronic equipment and a storage medium, and belongs to the technical field of image processing. The method comprises the following steps: determining the brightness of a pixel in an HSV color space based on the RGB value of the pixel in an image; determining a target gain mapping curve of a contrast enhancement SRE corresponding to the image based on a curve selection instruction or the brightness of the pixel; determining the target SRE gain of the pixel according to the brightness of the pixel and the target gain mapping curve; and compensating the RGB value of the pixel based on the target SRE gain of the pixel to obtain the target RGB value of the pixel. Thus, the brightness value of the pixel is determined based on the RGB value of the pixel in the image, the gain mapping curve corresponding to the image is determined according to the brightness value or the curve selection instruction, the target SRE gain of the pixel is determined, the RGB value is compensated, the contrast of the image is enhanced, and the picture quality and visual effect of the image under strong light are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, and in particular to an image enhancement method and device, an electronic device, and a storage medium. BACKGROUND

[0002] Due to the fact that electronic devices cannot adjust the contrast of displayed images according to the intensity of light, the displayed images will not be clear and the display effect will be reduced due to the irradiation of strong light. SUMMARY

[0003] The present application provides an image enhancement method and device, an electronic device, a computer-readable storage medium, and a computer program product to solve the problem of reduced visual effect of images due to the inability to adjust the contrast of images. The technical solutions of the present application are as follows:

[0004] According to a first aspect of an embodiment of the present application, an image enhancement method is provided, including: determining the lightness of a pixel in an HSV color space based on the RGB value of the pixel in an image; determining a target gain mapping curve of a contrast enhancement SRE corresponding to the image based on a curve selection instruction or the lightness of the pixel; determining a target SRE gain of the pixel according to the lightness of the pixel and the target gain mapping curve; and compensating the RGB value of the pixel based on the target SRE gain of the pixel to obtain a target RGB value of the pixel.

[0005] In an embodiment of the present application, determining the target gain mapping curve of the contrast enhancement SRE corresponding to the image based on the curve selection instruction includes: selecting the candidate gain mapping curve indicated by the curve selection instruction from one or more candidate gain mapping curves as the target gain mapping curve.

[0006] In an embodiment of the present application, determining the target gain mapping curve of the contrast enhancement SRE corresponding to the image based on the lightness of the pixel includes: performing global histogram statistics on the image based on the lightness of the pixel; obtaining target gray scale distribution data of the global histogram; and determining the target gain mapping curve from one or more candidate gain mapping curves according to the target gray scale distribution data.

[0007] In an embodiment of the present application, the determination of the target gain mapping curve from one or more candidate gain mapping curves according to the target gray scale distribution data includes: obtaining a selected condition of each of the candidate gain mapping curves; determining a target selected condition satisfied by the target gray scale distribution data, and determining the candidate gain mapping curve associated with the target selected condition as the target gain mapping curve.

[0008] In an embodiment of the present application, the target gray scale distribution data of the global histogram comprises: acquiring pixel amounts in different gray scale ranges according to the global histogram; and determining the target gray scale distribution data based on the pixel amounts in the different gray scale ranges.

[0009] In an embodiment of the present application, the target SRE gain of the pixel is determined according to the brightness of the pixel and the target gain mapping curve, comprising: inputting the brightness of the pixel into the target gain mapping curve, and performing mapping operation on the brightness by the target gain mapping curve to output the target SRE gain of the pixel.

[0010] In an embodiment of the present application, the target gain mapping curve of the contrast enhancement SRE corresponding to the image is determined based on the curve selection instruction or the brightness of the pixel, comprising: acquiring a mode selection instruction; if the mode selection instruction indicates to select a first mode, determining the target gain mapping curve based on the curve selection instruction; and if the mode selection instruction indicates to select a second mode, determining the target gain mapping curve based on the brightness of the pixel.

[0011] According to a second aspect of the embodiments of the present application, an image enhancement device is provided, comprising: a first determining module configured to determine the brightness of a pixel in an HSV color space based on the RGB value of the pixel in an image; a second determining module configured to determine the target gain mapping curve of a contrast enhancement SRE corresponding to the image based on a curve selection instruction or the brightness of the pixel; a third determining module configured to determine the target SRE gain of the pixel according to the brightness of the pixel and the target gain mapping curve; and a compensation module configured to compensate the RGB value of the pixel based on the target SRE gain of the pixel to obtain the target RGB value of the pixel.

[0012] In an embodiment of the present application, the second determining module is further configured to: select the candidate gain mapping curve indicated by the curve selection instruction from one or more candidate gain mapping curves as the target gain mapping curve.

[0013] In an embodiment of the present application, the second determining module is further configured to: perform global histogram statistics on the image based on the brightness of the pixel; acquire target gray scale distribution data of the global histogram; and determine the target gain mapping curve from one or more candidate gain mapping curves based on the target gray scale distribution data.

[0014] In an embodiment of the present application, the second determining module is further configured to: obtain respective selected conditions of the candidate gain mapping curves; determine a target selected condition satisfied by the target gray scale distribution data, and determine the candidate gain mapping curve associated with the target selected condition as the target gain mapping curve.

[0015] In an embodiment of the present application, the second determining module is further configured to: obtain pixel amounts in different gray scale ranges respectively according to the global histogram; and determine the target gray scale distribution data based on the pixel amounts in the different gray scale ranges.

[0016] In an embodiment of the present application, the third determining module is further configured to: input the luminosity of the pixel into the target gain mapping curve, perform mapping operation on the luminosity by the target gain mapping curve, and output a target SRE gain of the pixel.

[0017] In an embodiment of the present application, the second determining module is further configured to: obtain a mode selection instruction; if the mode selection instruction indicates to select a first mode, determine the target gain mapping curve based on the curve selection instruction; and if the mode selection instruction indicates to select a second mode, determine the target gain mapping curve based on the luminosity of the pixel.

[0018] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a processor, a memory for storing processor-executable instructions, wherein the processor is configured to implement the steps of the method according to the first aspect of the embodiment of the present application.

[0019] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer program instructions, and the computer program instructions are executed by a processor to implement the steps of the method according to the first aspect of the embodiment of the present application.

[0020] According to a fifth aspect of an embodiment of the present application, a computer program product is provided, comprising a computer program, and the computer program is executed by a processor of an electronic device to implement the steps of the method according to the first aspect of the embodiment of the present application.

[0021] The technical solution provided by the embodiments of the present application at least brings the following beneficial effects: the luminosity value of a pixel on HSV is determined according to the RGB value of the pixel, the target gain mapping curve of SRE corresponding to the image can be determined according to the luminosity value or the curve selection instruction. Further, the target SRE gain of the pixel can be determined according to the gain mapping curve. The RGB value of the pixel is compensated based on the target SRE gain, so as to enhance the contrast of the image, make the unclear image clear, and improve the picture quality and visual effect of the image in strong light.

[0022] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory and are not restrictive of the application. BRIEF DESCRIPTION OF DRAWINGS

[0023] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and serve to explain the principles of the application, in which, like reference numerals designate corresponding parts throughout the several views.

[0024] Figure 1 is a flow chart of an image enhancement method according to an exemplary embodiment.

[0025] Figure 2 is a flow chart of an image enhancement method according to another exemplary embodiment.

[0026] Figure 3 is a schematic diagram of two modes of determining SRE gain according to an exemplary embodiment.

[0027] Figure 4 is a flow chart of an image enhancement method according to another exemplary embodiment.

[0028] Figure 5 is a schematic diagram of the correspondence between the luminance compensation curve-gain mapping curve-selected condition according to an exemplary embodiment.

[0029] Figure 6 is a flow chart of an image enhancement method according to another exemplary embodiment.

[0030] Figure 7 is a flow chart of an image enhancement method according to another exemplary embodiment.

[0031] Figure 8 is a schematic diagram of an image enhancement method according to an exemplary embodiment.

[0032] Figure 9 is a structural block diagram of an image enhancement device according to an exemplary embodiment.

[0033] Figure 10 is a block diagram of an electronic device according to an exemplary embodiment.

[0034] Figure 11 is a structural block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0035] In order for those skilled in the art to better understand the technical solutions of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings.

[0036] It should be noted that the terms "first", "second", and the like in the description and in the claims of the present application and above-described accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of apparatuses and methods consistent with some aspects of the present application, as detailed in the appended claims.

[0037] The acquisition, storage, use, processing, etc. of data in the technical solutions of the present application comply with the relevant provisions of national laws and regulations.

[0038] Figure 1 is a flow chart of an image enhancement method according to an exemplary embodiment, as shown in Figure 1 The image enhancement method includes but is not limited to the following steps.

[0039] S101, based on the RGB value of the pixel in the image, determine the brightness of the pixel in the HSV color space.

[0040] The execution subject of the image enhancement method of the embodiments of the present application is an electronic device with screen display function, which can be used to display image information. The electronic device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a wearable device, an ultra mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc., and the non-mobile electronic device can be a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., and the embodiments of the present application are not limited specifically.

[0041] An image is composed of a plurality of pixels, and a pixel is a unit of an image. An electronic device can analyze an image to obtain image data, wherein the image data can include the RGB value of the pixel in the image. The RGB value represents the intensity of red (R), green (G) and blue (B) respectively, and is usually stored as three 8-bit integers, with the value of each color channel ranging between 0 and 255.

[0042] Furthermore, the RGB values ​​of a pixel can be converted into the pixel's lightness in the HSV color space based on the pixel's RGB values, where HSV represents hue (H), saturation (S), and lightness (V).

[0043] In some implementations, the maximum value among the R, G, and B values ​​can be determined, and further, the lightness V of the pixel in the HSV color space can be determined based on this maximum value. Optionally, the formula for calculating the lightness V of a pixel in the HSV color space is as follows:

[0044] V = MAX(R, G, B) (1)

[0045] S102, based on the curve selection instruction or the brightness of the pixel, determine the target gain mapping curve of the contrast enhancement SRE corresponding to the image.

[0046] As is understandable, Sunlight Readable Enhancement (SRE) gain is used to enhance the contrast of an image, making an unclear image clearer. It improves image visibility and sharpness by increasing or decreasing the image's brightness values, thereby altering the brightness differences between pixels.

[0047] In some implementations, a gain mapping curve can be established based on the mapping relationship between brightness V and gain, in the form of gain = f(V), where the input brightness V outputs gain. For example... Figure 5 As shown in b, multiple candidate gain mapping curves can be pre-constructed, where the horizontal axis represents the input brightness and the vertical axis represents the output gain. Optionally, the brightness and calibration gain of a large number of pixels can be collected, and multiple candidate gain mapping curves can be obtained by linearly fitting the brightness and calibration gain of a large number of pixels. The candidate SRE gain mapping curves contain multiple gain mapping curves to compensate for different levels of strong light illumination on the image.

[0048] In this embodiment of the application, one of the multiple candidate gain mapping curves can be selected as the target gain mapping curve.

[0049] In some implementations, a curve selection command can be sent from the control terminal of the electronic device, and the target gain mapping curve of the SRE corresponding to the image can be determined from the gain mapping curves of the candidate SREs based on the curve selection command.

[0050] In some implementations, selection criteria can be defined for each candidate gain curve, and the target gain mapping curve can be determined from multiple candidate gain mapping curves based on these selection criteria. Optionally, the selection criteria for a candidate gain mapping curve can be its corresponding grayscale distribution.

[0051] Optionally, the correspondence between each candidate gain mapping curve and the gray scale distribution is determined in advance. For example, L represents a low gray scale, H represents a high gray scale, and M represents a medium gray scale. For example, the value range of brightness is 0-255, wherein the value range of the low gray scale (L) is 0-63, the value range of the medium gray scale (M) is 64-191, and the value range of the high gray scale (H) is 192-255. The gray scale distribution can reflect the distribution number or percentage of the pixel points in each gray scale. For example, the gray scale distribution can be L >= 50%, M < 20%, and H > 0%, which indicates that the proportion of the pixels in the low gray scale is greater than or equal to 50%, the proportion of the pixels in the medium gray scale is less than 20%, and the proportion of the pixels in the high gray scale is greater than 0%.

[0052] In the embodiment of the present application, the distribution of the medium gray scale of the brightness V of each pixel in the image is counted to obtain a histogram, which can be used to reflect the gray scale distribution of the pixels in the image. In the histogram, the horizontal axis represents the brightness level of the pixel, usually from 0 to 255, and the vertical axis represents the number or percentage of the pixels at the corresponding brightness, which can reflect the number or percentage of the pixels at different gray scales.

[0053] Further, according to the target gray scale data of the image determined according to the histogram, the target gray scale distribution data can be matched with the gray scale distribution condition (selected condition) corresponding to each candidate gain mapping curve to determine the target gain mapping curve of the SRE corresponding to the image.

[0054] In S103, the target SRE gain of the pixel is determined according to the brightness of the pixel and the target gain mapping curve.

[0055] It can be understood that the gain mapping curve of the SRE is a function image about the brightness V and the gain value, each brightness corresponds to a gain value, and the target SRE gain of the pixel can be determined according to the correspondence between the brightness and the gain value based on the brightness V of the pixel in the image.

[0056] Optionally, the function of the gain mapping curve of the SRE is f(V), the brightness V of the pixel is input into the function, and the target SRE gain of the pixel can be output. Further, based on the target gain gain, the respective gainR, gainG, and gainB of the R, G, and B color channels are determined. For example, the values of gainR, gainG, and gainB are all the gain gain output based on the gain mapping curve. For another example, the respective gain of the R, G, and B color channels can be adjusted by a coefficient based on the target gain gain to obtain the respective gainR, gainG, and gainB.

[0057] S104, compensating the RGB value of the pixel based on the target SRE gain of the pixel to obtain a target RGB value of the pixel.

[0058] In some implementations, to improve the visual effect of the electronic device in displaying the image in strong light, the RGB value of the image pixel can be compensated by using the target SRE gain of the pixel to enhance the contrast of the image and improve the visual effect of the image in strong light.

[0059] Optionally, the compensation on the RGB value can multiply the RGB value of the pixel by the SRE gain in three dimensions to obtain the RGB value of the pixel after compensation, that is, the target RGB value. The calculation formula is as follows:

[0060] R_out = R_in * gain_R (2)

[0061] G_out = G_in * gain_G (3)

[0062] B_out = B_in * gain_B (4)

[0063] Wherein, R_out, G_out, B_out represent the target RGB value, gain_R, gain_G, gain_B represent gainR, gainG and gainB in R, G and B color channels, that is, the target SRE gain, R_in, G_in, B_in represent the actual RGB value of the pixel.

[0064] In the image enhancement method provided by the embodiments of the present application, the brightness value of the pixel in HSV is determined according to the RGB value of the image pixel, and the target gain mapping curve of the SRE corresponding to the image can be determined according to the brightness value or the curve selection instruction. Further, the target SRE gain of the pixel can be determined according to the gain mapping curve. The RGB value of the pixel is compensated based on the target SRE gain to enhance the contrast of the image, so that the unclear image becomes clear, and the picture quality and visual effect of the image in strong light are improved.

[0065] Figure 2 is a flow chart of an image enhancement method according to an exemplary embodiment, as shown in Figure 2 The image enhancement method includes but is not limited to the following steps.

[0066] S201, determining the brightness of the pixel in the HSV color space based on the RGB value of the pixel in the image.

[0067] In the embodiments of the present application, the implementation of step S201 can be realized by any one of the embodiments of the present application, and here it is not limited and will not be repeated.

[0068] S202, acquire a mode selection instruction.

[0069] In some implementations, different modes can be selected by the electronic device itself to determine the target gain mapping curve, or a mode selection instruction can be sent by the control end to the electronic device to indicate which mode to select, and then determine the target gain mapping curve.

[0070] Optionally, the modes for determining the target gain mapping curve include a first mode (mode 0) and a second mode (mode 1). The first mode is to determine the target gain mapping curve according to the curve selection instruction, and the second mode is to determine the target gain mapping curve according to the brightness of the pixel.

[0071] Optionally, the mode selection instruction can be "0" to determine that the first mode (mode 0) is selected. Optionally, the mode selection instruction can be "1" to determine that the second mode (mode 1) is selected.

[0072] S203, if the mode selection instruction indicates that the first mode is selected, determine the target gain mapping curve based on the curve selection instruction.

[0073] Optionally, when the selection instruction indicates that the first mode is selected, the curve selection instruction can be received, and a gain mapping curve is selected from a plurality of candidate gain mapping curves as the target gain mapping curve according to the curve selection instruction.

[0074] Optionally, a plurality of candidate gain mapping curves are generated in advance based on input curve parameters. Optionally, the plurality of generated candidate gain mapping curves are stored in a register.

[0075] For example, 6 candidate gain mapping curves A, B, C, D, E, and F are constructed in advance. If the curve selection instruction is "000", the first gain mapping curve A can be selected. If the curve selection instruction is "001", the second gain mapping curve B can be selected. If the curve selection instruction is "010", the third gain mapping curve C can be selected. If the curve selection instruction is "011", the fourth gain mapping curve D can be selected. If the curve selection instruction is "100", the fifth gain mapping curve E can be selected. If the curve selection instruction is "101", the sixth gain mapping curve F can be selected.

[0076] S204, if the mode selection instruction indicates that the second mode is selected, determine the target gain mapping curve based on the brightness of the pixel.

[0077] It can be understood that when the selection instruction indicates to select the second mode, the brightness of the pixel is counted, and a global histogram of the image is drawn based on the brightness of the pixel, wherein the global histogram can reflect whether the brightness distribution of the pixels of an image is uniform, and when the distribution of an image is uniform, it indicates that the contrast of the image is high.

[0078] Optionally, according to the distribution data of the global histogram brightness, it is determined that the distribution data of the global histogram brightness satisfies the selected condition of the gain mapping curve, and the candidate gain mapping curve associated with the selected condition is determined as the target gain mapping curve.

[0079] S205, according to the brightness of the pixel and the target gain mapping curve, the target SRE gain of the pixel is determined.

[0080] It can be understood that the brightness of the pixel is input into the target gain mapping curve, and the brightness is mapped and operated by the target gain mapping curve to output the target SRE gain of the pixel.

[0081] For example, the function of the target gain mapping curve can be f(V), the V of the pixel is input into the mapping function, and according to the mapping relationship between the brightness and the gain, the target SRE gain can be determined. Further, based on the target gain gain, the respective gainR, gainG and gainB of the R, G and B color channels are determined. For example, the values of gainR, gainG and gainB are all the target gain gain. For another example, on the basis of the target gain gain, the respective gain of the R, G and B color channels is adjusted by a coefficient to obtain the respective gainR, gainG and gainB.

[0082] As shown in Figure 3 , the parameters are input into the gain mapping curve generation unit in advance, and a plurality of candidate gain mapping curves are generated by the input parameters and stored in the register.

[0083] As shown in Figure 3 (a), when the mode selection instruction indicates to select the first mode (mode 0), the candidate gain mapping curve is read from the register and input into the gain mapping curve selection unit, and the target gain mapping curve is determined according to the curve selection instruction. In order to determine the target SRE gain, further as shown in Figure 3 (a), the brightness of the pixel is input into the SRE gain value calculation unit, and the target SRE gain is calculated based on the brightness and the target gain mapping curve.

[0084] As shown in Figure 3(b) as shown, when the mode selection instruction indicates selection of the second mode (mode 1), a candidate gain mapping curve is read from a register in which the candidate mapping curve is stored, and meanwhile, the luminance of the pixel is input into a global histogram statistics unit to draw a global histogram. Further, the global histogram and the plurality of candidate SRE gain mapping curves are input into a gain mapping curve selection unit, and according to the target gray scale distribution data of the histogram, a target gain mapping curve is determined from the candidate gain mapping curves, and then the target SRE gain is calculated based on the luminance and the gain mapping curve.

[0085] In some implementations, as shown in Figure 5 (a), a plurality of candidate luminance compensation curves can be constructed in advance, and the abscissa of each candidate luminance compensation curve is the input luminance, and the ordinate is the output luminance. Optionally, the luminance of different sample images can be statistically obtained to obtain a histogram of the sample image, and then according to the gray scale distribution of the histogram, the output luminance of each pixel of the sample image is calibrated based on the requirements of the image local effect and the global display effect. Further, a plurality of groups of input luminance and calibrated output luminance are linearly fitted to obtain the candidate luminance compensation curve corresponding to the sample image.

[0086] It can be understood that the gray scale distribution of the histogram corresponding to different sample images is different, and the requirement for the output luminance is also different, so the output luminance of each sample image can be calibrated based on the gray scale distribution of the histogram, and then the input luminance and the calibrated input luminance of a plurality of sample images can be obtained, and then a plurality of candidate luminance compensation curves can be obtained.

[0087] In the embodiment of the present application, each candidate luminance compensation curve corresponds to a candidate gain mapping curve, as shown in Figure 5 (b). Wherein the candidate gain mapping curve can be the slope of the candidate luminance compensation curve, that is, the slope of the candidate luminance compensation curve is the gain gain. Wherein the greater the slope of the curve, the greater the gain gain.

[0088] As shown in Figure 3 , the input luminance and output luminance and other parameters used for fitting can be input into a gain mapping curve generation unit to generate a candidate luminance compensation curve, and further, a candidate gain mapping curve is obtained based on the candidate luminance compensation curve. Optionally, the slope of the luminance compensation curve is derived to obtain a slope determination formula, that is, a gain mapping curve, and then the gain corresponding to the input luminance can be determined based on the gain mapping curve.

[0089] Optionally, as shown in Figure 5(c) each candidate luminance compensation curve and corresponding gain mapping curve shown, there is a selected condition (that is, the gray scale distribution of the pixel), determine the target gray scale distribution data of the histogram to meet the selected condition, further, for the candidate luminance compensation curve that meets the selected condition, the derivative is obtained to obtain the target gain mapping curve. As shown in Figure 5 Gain_set0, including candidate luminance compensation curve 0 and candidate gain mapping curve 0' in the case of no compensation between input luminance and output luminance. Gain_set1, including candidate luminance compensation curve 1 and candidate gain mapping curve 1', which correspond to the gray scale distribution condition L>=50%, M<20%, H>0%; Gain_set2, including candidate luminance compensation curve 2 and candidate gain mapping curve 2', which correspond to the gray scale distribution condition L>=0%, M<=20%, H>80%; Gain_set3, including candidate luminance compensation curve 3 and candidate gain mapping curve 3', which correspond to the gray scale distribution condition L<=50%, M>=50%, H>0%; Gain_set4, including candidate luminance compensation curve 4 and candidate gain mapping curve 4', which correspond to the gray scale distribution condition L>=40%, M<=20%, H>=40%; Gain_set5, including candidate luminance compensation curve 5 and candidate gain mapping curve 5', which correspond to the gray scale distribution condition L>=60%, M>=0%, H<=0%.

[0090] If the target gray scale data meets the selected condition L<=50%, M>=50%, H>0%, the gain mapping curve 3' corresponding to the luminance compensation curve 3 is determined as the target gain mapping curve.

[0091] S206, based on the target SRE gain of the pixel, compensating the RGB value of the pixel to obtain the target RGB value of the pixel.

[0092] In the embodiments of the present application, the implementation mode of step S206 can be realized by any one of the embodiments of the present application, and this is not limited herein, and will not be repeated.

[0093] In the image enhancement method provided in the embodiments of the present application, the brightness value of the pixel in the HSV color space is determined based on the RGB value of the pixel in the image, and the first mode or the second mode is determined according to the mode selection instruction to determine the SRE target gain mapping curve corresponding to the image. Further, the target SRE gain of the pixel is determined according to the gain mapping curve. The RGB value of the pixel is compensated based on the target SRE gain, so as to enhance the contrast of the image, make the unclear image clear, and improve the picture quality and visual effect of the image in strong light.

[0094] Figure 4 FIG. 1 is a flowchart of an image enhancement method according to an exemplary embodiment, as shown in FIG. 1, the image enhancement method comprises but is not limited to the following steps. Figure 4

[0095] S401, determining the brightness of the pixel in the HSV color space based on the RGB value of the pixel in the image.

[0096] In the embodiments of the present application, the implementation of step S401 can be realized by any one of the embodiments of the present application, which is not limited herein and will not be repeated.

[0097] S402, determining to select the first mode according to the mode selection instruction.

[0098] S403, selecting the candidate gain mapping curve indicated by the curve selection instruction from one or more candidate gain mapping curves as the target gain mapping curve.

[0099] In some implementations, the first mode is determined to be used according to the mode selection instruction, that is, the target gain mapping curve is determined based on the curve selection instruction. It can be understood that there is one or more candidate gain mapping curves in the register, and one gain mapping curve is selected as the target gain mapping curve from the candidate gain mapping curves according to the curve selection instruction.

[0100] Optionally, if there are six candidate gain mapping curves 0' to 5', one gain mapping curve can be selected as the target gain mapping curve from the six gain mapping curves according to the indication of the curve selection instruction in the embodiments of the present application. Wherein, selecting curve 0' means no compensation, selecting curve 1' can improve the contrast of low gray scale, selecting curve 2' can reduce the contrast of high gray scale, selecting curve 3' can improve the data value of low gray scale, selecting curve 4' can improve the contrast of high and low gray scale respectively, and selecting curve 5' mainly compensates for low gray scale.

[0101] S404, determining the target SRE gain of the pixel according to the brightness of the pixel and the target gain mapping curve.

[0102] ​In the embodiments of the present application, the implementation of step S404 can be achieved by any of the embodiments of the present application, and the present application does not make any limitation on this, and will not be repeated here.

[0103] S405, compensating the RGB value of the pixel based on the target SRE gain of the pixel to obtain a target RGB value of the pixel.

[0104] In the embodiments of the present application, the implementation of step S405 can be achieved by any of the embodiments of the present application, and the present application does not make any limitation on this, and will not be repeated here.

[0105] In the image enhancement method provided by the embodiments of the present application, the brightness value of the pixel on the HSV is determined according to the RGB value of the image pixel, the first mode is determined to be used according to the mode selection instruction, that is, the curve selection instruction, and the SRE target gain mapping curve corresponding to the image is determined. Further, the target SRE gain of the pixel can be determined according to the gain mapping curve. The RGB value of the pixel is compensated based on the target SRE gain to enhance the contrast of the image, so that the unclear image becomes clear, and the picture quality and visual effect of the image under strong light are improved.

[0106] Figure 6 is a flow chart of an image enhancement method according to an exemplary embodiment, as shown in Figure 6 The image enhancement method includes but is not limited to the following steps.

[0107] S601, determining the brightness of the pixel in the HSV color space based on the RGB value of the pixel in the image.

[0108] In the embodiments of the present application, the implementation of step S601 can be achieved by any of the embodiments of the present application, and the present application does not make any limitation on this, and will not be repeated here.

[0109] S602, determining to select the second mode according to the mode selection instruction.

[0110] S603, performing global histogram statistics on the image based on the brightness of the pixel.

[0111] In some implementations, the second mode is determined to be used according to the mode selection instruction, that is, the target gain mapping curve is determined based on the brightness of the pixel. Optionally, the brightness V of the pixel can be statistically analyzed by global histogram to analyze the distribution of the pixel points on the brightness of the pixel, that is, the distribution data of the gray scale. If the histogram shows uniform distribution, it means that the contrast of the image is high; if the histogram shows distribution at low gray scale or high gray scale, it means that the contrast of the image is low, and the SRE gain needs to be performed on the image.

[0112] S604, acquire target gray scale distribution data of the global histogram.

[0113] It can be understood that the global histogram can reflect the distribution of brightness of pixels, and according to the global histogram, the pixel amount in different gray scale ranges is acquired respectively, and further, based on the pixel amount in different gray scale ranges, the target gray scale distribution data is determined.

[0114] In some implementations, the low gray scale range, the middle gray scale range and the high gray scale range can be included, the first pixel amount in the low gray scale range, the second pixel amount in the middle gray scale range and the third pixel amount in the high gray scale range are acquired respectively. Based on the first pixel amount, the second pixel amount and the third pixel amount, the target gray scale distribution data is determined. Optionally, the ratio of the first pixel amount to the total amount of pixels, the ratio of the second pixel amount to the total amount of pixels, and the ratio of the third pixel amount to the total amount of pixels can be calculated as the target gray scale distribution data.

[0115] It should be noted that the range of low gray scale (L) is (0-63), the range of middle gray scale (M) is (64-191), and the range of high gray scale (H) is (192-255). It is exemplarily explained that the first pixel amount in the low gray scale range is greater than or equal to 50%, the second pixel amount in the middle gray scale range is less than 20%, and the third pixel amount in the high gray scale range is greater than 0% are determined from the global histogram, and then the target gray scale distribution data of the global histogram is determined as L>=50%, M<20%, H>0%.

[0116] S605, according to the target gray scale distribution data, determine the target gain mapping curve from one or more candidate gain mapping curves.

[0117] In some implementations, the selected condition of each candidate gain mapping curve is acquired, and further, the target selected condition satisfied by the target gray scale distribution data is determined, and the candidate gain mapping curve associated with the target selected condition is determined as the target gain mapping curve. For example, the selected condition of the gain mapping curve 1' is L>=50%, M<20%, H>0%; the selected condition of the gain mapping curve 2' is L>=0%, M<=20%, H>=80%… The target gray scale distribution data is L>=50%, M<20%, H>0%, which satisfies the selected condition of the gain mapping curve 1', and then the gain mapping curve 1' is determined as the target gain mapping curve.

[0118] As Figure 5The corresponding relationship between the global histogram and the candidate gain mapping curve is shown. Since the gain mapping curve 0' represents no compensation, there is no target gray scale distribution data of the global histogram corresponding to it. If the global histogram satisfies the target gray scale distribution data of L>=50%, M<20%, H>0%, the gain mapping curve 1' is determined as the target gain mapping curve; if the global histogram satisfies the target gray scale distribution data of L>=0%, M<=20%, H>80%, the gain mapping curve 2' is determined as the target gain mapping curve; if the global histogram satisfies the target gray scale distribution data of L<=50%, M>=50%, H>0%, the gain mapping curve 3' is determined as the target gain mapping curve; if the global histogram satisfies the target gray scale distribution data of L>=40%, M<=20%, H>=40%, the gain mapping curve 4' is determined as the target gain mapping curve; if the global histogram satisfies the target gray scale distribution data of L>=60%, M>=0%, H<=0%, the gain mapping curve 5' is determined as the target gain mapping curve.

[0119] S606, determining the target SRE gain of the pixel according to the brightness of the pixel and the target gain mapping curve.

[0120] In the embodiments of the present application, the implementation manner of step S606 can be implemented by any one of the embodiments of the present application, which is not limited herein and will not be repeated.

[0121] S607, compensating the RGB value of the pixel based on the target SRE gain of the pixel to obtain the target RGB value of the pixel.

[0122] In the embodiments of the present application, the implementation manner of step S607 can be implemented by any one of the embodiments of the present application, which is not limited herein and will not be repeated.

[0123] In the image enhancement method provided by the embodiments of the present application, the brightness value of the pixel on the HSV is determined according to the RGB value of the image pixel, the second mode is determined to be used according to the mode selection instruction, that is, the brightness value determines the SRE target gain mapping curve corresponding to the image. Further, the target SRE gain of the pixel can be determined according to the gain mapping curve. The RGB value of the pixel is compensated based on the target SRE gain to enhance the contrast of the image, so that the unclear image becomes clear, and the picture quality and visual effect of the image under strong light are improved.

[0124] Figure 7 is a flow chart of an image enhancement method according to an exemplary embodiment, as shown in Figure 7 The image enhancement method includes but is not limited to the following steps.

[0125] S701 determines the brightness of a pixel in the HSV color space based on the RGB values ​​of the pixels in the image.

[0126] S702, Get mode selection command.

[0127] S703, if the mode selection instruction indicates that the first mode is selected, then based on the curve selection instruction, the candidate gain mapping curve indicated by the curve selection instruction is selected from one or more candidate gain mapping curves as the target gain mapping curve.

[0128] S704, if the mode selection instruction indicates that the second mode is selected, then a global histogram is performed on the image based on the brightness of the pixels.

[0129] It should be noted that there are no strict restrictions on the order of steps S703 and S704. The decision to use the second mode can be made either before or after step S703.

[0130] S705, obtain the target grayscale distribution data of the global histogram.

[0131] S706, Based on the target grayscale distribution data, determine the target gain mapping curve from one or more candidate gain mapping curves.

[0132] S707 inputs the brightness of a pixel into the target gain mapping curve, performs mapping operations on the brightness using the target gain mapping curve, and outputs the target SRE gain of the pixel.

[0133] S708 compensates for the RGB values ​​of pixels based on the target SRE gain of the pixel to obtain the target RGB values ​​of the pixel.

[0134] Figure 8 It is the process of obtaining the target RGB value of a pixel, such as Figure 8 As shown, the RGB values ​​of pixels in the image are input to the conversion unit and converted into brightness values. Simultaneously, the mode selection command and the brightness values ​​are input to the Global process unit to calculate the SRE gain value. It can be understood that based on the mode selection information, it can be determined whether the Global process unit determines the target gain mapping curve based on the first mode or the second mode. If the mode selection command indicates the selection of the first mode (mode0), the target gain mapping curve is further determined based on the curve selection command. If the mode selection command indicates the selection of the second mode (mode 1), the target gain mapping curve is further determined based on the pixel brightness. The specific implementation process for determining the target gain mapping curve can be found in [link to documentation]. Figure 3The target SRE gain of the pixel can be determined based on the target gain mapping curve and the brightness of the pixel. The actual RGB value of the pixel is compensated by the compensation unit based on the SRE gain, and the target RGB value of the pixel after compensation can be output.

[0135] In the image enhancement method provided by the embodiment of the present application, the brightness value of the pixel on the HSV is determined according to the RGB value of the pixel in the image, and the first mode or the second mode is determined according to the mode selection instruction to determine the SRE target gain mapping curve corresponding to the image. Further, the target SRE gain of the pixel can be determined according to the gain mapping curve. The RGB value of the pixel is compensated based on the target SRE gain, so as to enhance the contrast of the image, make the unclear image clear, and improve the picture quality and visual effect of the image in strong light.

[0136] The present application Figure 9 is a structural block diagram of an image enhancement device according to an exemplary embodiment. Referring to Figure 9 The image enhancement device 900 of the embodiment of the present application comprises a first determination module 901, a second determination module 902, a third determination module 903, and a compensation module 904.

[0137] The first determination module 901 is configured to determine the brightness of the pixel on the HSV color space based on the RGB value of the pixel in the image.

[0138] The second determination module 902 is configured to determine the target gain mapping curve of the contrast enhancement SRE corresponding to the image based on the curve selection instruction or the brightness of the pixel.

[0139] The third determination module 903 is configured to determine the target SRE gain of the pixel according to the brightness of the pixel and the target gain mapping curve.

[0140] The compensation module 904 is configured to compensate the RGB value of the pixel based on the target SRE gain of the pixel, and obtain the target RGB value of the pixel.

[0141] In an embodiment of the present application, the second determination module is further configured to select the candidate gain mapping curve indicated by the curve selection instruction from the one or more candidate gain mapping curves as the target gain mapping curve.

[0142] In an embodiment of the present application, the second determination module 902 is further configured to perform global histogram statistics on the image based on the brightness of the pixel, obtain target gray scale distribution data of the global histogram, and determine the target gain mapping curve from the one or more candidate gain mapping curves according to the target gray scale distribution data.

[0143] In an embodiment of the present application, the second determining module 902 is further configured to: obtain the selected condition of each candidate gain mapping curve; determine the target selected condition met by the target gray scale distribution data, and determine the candidate gain mapping curve associated with the target selected condition as the target gain mapping curve.

[0144] In an embodiment of the present application, the second determining module 902 is further configured to: obtain the pixel amount in different gray scale ranges respectively according to the global histogram; and determine the target gray scale distribution data based on the pixel amount in different gray scale ranges.

[0145] In an embodiment of the present application, the third determining module 903 is further configured to: input the brightness of the pixel into the target gain mapping curve, perform mapping operation on the brightness by the target gain mapping curve, and output the target SRE gain of the pixel.

[0146] In an embodiment of the present application, the second determining module 902 is further configured to: obtain the mode selection instruction; if the mode selection instruction indicates to select the first mode, determine the target gain mapping curve based on the curve selection instruction; and if the mode selection instruction indicates to select the second mode, determine the target gain mapping curve based on the brightness of the pixel.

[0147] In the image enhancement method provided by the embodiment of the present application, the brightness value of the pixel on the HSV is determined according to the RGB value of the image pixel, the target gain mapping curve of the SRE corresponding to the image can be determined according to the brightness value or the curve selection instruction. Further, the target SRE gain of the pixel can be determined according to the gain mapping curve. The RGB value of the pixel is compensated based on the target SRE gain, so as to enhance the contrast of the image, make the unclear image clear, and improve the picture quality and visual effect of the image under strong light.

[0148] Figure 10 is a block diagram of an electronic device according to an exemplary embodiment. Figure 10 The electronic device shown is merely an example, and should not bring any limitation to the function and use range of the embodiments of the present application.

[0149] As Figure 10As shown, the electronic device 1000 includes a processor 1001 which can perform various appropriate actions and processes in accordance with a program stored in a read only memory (ROM) 1002 or a program loaded into a random access memory (RAM) 1003 from the storage 1006. In the RAM 1003, various programs and data required for operation of the electronic device 1000 are also stored. The processor 1001, the ROM 1002, and the RAM 1003 are connected to each other through a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0150] Connected to the I / O interface 1005 are a storage 1006 including a hard disk or the like, and a communication section 1007 including a network interface card such as a local area network (LAN) card, a modem, or the like, which performs communication processing via a network such as the Internet; and a drive 1008 is also connected to the I / O interface 1005 as necessary.

[0151] In particular, according to the embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, the embodiments of the present application include a computer program carrying on a computer readable medium, which contains program codes for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network by the communication section 1007. When the computer program is executed by the processor 1001, the above-described functions defined in the methods of the present application are performed.

[0152] In the exemplary embodiments, a storage medium including instructions, such as a storage including instructions, is also provided, and the above-described instructions can be executed by the processor 1001 of the electronic device 1000 to complete the above-described methods. Alternatively, the storage medium can be a non-transitory computer readable storage medium, such as a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, and the like.

[0153] In this application, computer readable storage medium can be any tangible medium that can contain, or store computer readable program codes. In this application, computer readable signal medium can include data signals in baseband or in a carrier wave, transmittable through program codes in a modulated data signal carrier, or in a propagated signal, where the computer readable program codes are used by or in connection with an instruction execution system, apparatus or device. The computer readable program codes contained in the computer readable medium can be transmitted by any appropriate medium, including but not limited to wireless, wire line, optical fiber cable, RF, etc., or any suitable combination thereof.

[0154] Figure 11 is a structural block diagram of an electronic device according to an exemplary embodiment. Figure 11 The electronic device shown is only an example, and should not bring any limitation to the function and use range of the embodiments of the present application. As Figure 11 As shown, the electronic device 1100 includes a processor 1101, a memory 1102. The memory 1102 is configured to store program codes, and the processor 1101 is connected with the memory 1102 and configured to read the program codes from the memory 1102 to implement the image enhancement method in the above embodiments.

[0155] Optionally, the number of the processors 1101 can be one or more.

[0156] Optionally, the electronic device can further include an interface 1103, and the number of the interface 1103 can be multiple. The interface 1103 can be connected with an application program, and can receive data of an external device such as a sensor, etc.

[0157] Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the present application cover any and all variations of the application that come within the scope of the claims and their equivalents. It is intended that the specification and examples be considered exemplary only, with the true scope and spirit of the application being indicated by the following claims.

[0158] It should be understood that the present application is not limited to the precise construction that has been described above and illustrated in the accompanying drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the present application. The scope of the present application is limited only by the appended claims.

Claims

1. An image enhancement method characterized by, The method comprises: determining the brightness of the pixel in the HSV color space based on the RGB value of the pixel in the image; obtaining a mode selection instruction; if the mode selection instruction indicates that the first mode is selected, selecting the candidate gain mapping curve indicated by the curve selection instruction as the target gain mapping curve of the SRE of the image based on the curve selection instruction from one or more candidate gain mapping curves; if the mode selection instruction indicates that the second mode is selected, performing global histogram statistics on the image based on the brightness of the pixel; dividing the value range of the brightness into a low gray scale range, a middle gray scale range and a high gray scale range, obtaining the first pixel amount in the low gray scale range, the second pixel amount in the middle gray scale range and the third pixel amount in the high gray scale range according to the global histogram, and determining the target gray scale distribution data according to the ratio of the first pixel amount to the total pixel amount, the ratio of the second pixel amount to the total pixel amount and the ratio of the third pixel amount to the total pixel amount, and determining the target gain mapping curve from one or more candidate gain mapping curves according to the target gray scale distribution data, wherein different candidate gain mapping curves correspond to different target gray scale distribution data; inputting the brightness of the pixel into the target gain mapping curve, performing mapping operation on the brightness by the target gain mapping curve, and outputting the target SRE gain of the pixel; compensating the RGB value of the pixel based on the target SRE gain of the pixel to obtain the target RGB value of the pixel.

2. The method of claim 1, wherein, The method further comprises: obtaining the selected condition of each candidate gain mapping curve; determining the target selected condition satisfied by the target gray scale distribution data, and determining the candidate gain mapping curve associated with the target selected condition as the target gain mapping curve.

3. An image enhancement device, characterized by The method comprises: a first determining module configured to determine the brightness of the pixel in the HSV color space based on the RGB value of the pixel in the image; a second determining module configured to determine the target gain mapping curve of the SRE of the image based on the curve selection instruction or the brightness of the pixel; a third determining module configured to determine the target SRE gain of the pixel according to the brightness of the pixel and the target gain mapping curve; a compensation module configured to compensate the RGB value of the pixel based on the target SRE gain of the pixel to obtain the target RGB value of the pixel; the second determining module is further configured to: obtain a mode selection instruction; if the mode selection instruction indicates that the first mode is selected, select the candidate gain mapping curve indicated by the curve selection instruction as the target gain mapping curve based on the curve selection instruction from one or more candidate gain mapping curves. If the mode selection instruction indicates selecting the second mode, performing global histogram statistics on the image based on the brightness of the pixels; dividing the value range of the brightness into a low gray level range, a middle gray level range and a high gray level range, and obtaining a first pixel amount in the low gray level range, a second pixel amount in the middle gray level range and a third pixel amount in the high gray level range according to the global histogram; determining target gray level distribution data according to the ratio of the first pixel amount to the total pixel amount, the ratio of the second pixel amount to the total pixel amount and the ratio of the third pixel amount to the total pixel amount; and determining the target gain mapping curve from one or more candidate gain mapping curves according to the target gray level distribution data, wherein different candidate gain mapping curves correspond to different target gray level distribution data. The third determination module is further configured to: input the brightness of the pixel into the target gain mapping curve, perform mapping operation on the brightness by the target gain mapping curve, and output the target SRE gain of the pixel.

4. The apparatus of claim 3, wherein, The second determination module is further configured to: obtain the selected condition of each of the candidate gain mapping curves; determine a target selected condition satisfied by the target gray level distribution data, and determine the candidate gain mapping curve associated with the target selected condition as the target gain mapping curve.

5. An electronic device, comprising: comprise: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to implement the steps of any one of the methods of claims 1-2.

6. A computer-readable storage medium having stored thereon computer program instructions, wherein, The program instructions, when executed by the processor, implement the steps of any one of the methods of claims 1-2.

Citation Information

Patent Citations

  • Method and device for compensating for gray-scale luminance of images

    CN107610669A

  • Image processing method and device, equipment, storage medium and program product

    CN115330621A