WO2023284528A1 - 一种图像增强方法、装置、计算机设备和存储介质 - Google Patents

一种图像增强方法、装置、计算机设备和存储介质 Download PDF

Info

Publication number
WO2023284528A1
WO2023284528A1 PCT/CN2022/101173 CN2022101173W WO2023284528A1 WO 2023284528 A1 WO2023284528 A1 WO 2023284528A1 CN 2022101173 W CN2022101173 W CN 2022101173W WO 2023284528 A1 WO2023284528 A1 WO 2023284528A1
Authority
WO
WIPO (PCT)
Prior art keywords
brightness
data
adjustment
value
chromaticity
Prior art date
Application number
PCT/CN2022/101173
Other languages
English (en)
French (fr)
Inventor
黄斌
李永杰
沈凌翔
Original Assignee
深圳市洲明科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市洲明科技股份有限公司 filed Critical 深圳市洲明科技股份有限公司
Publication of WO2023284528A1 publication Critical patent/WO2023284528A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09GARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
    • G09G3/00Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes
    • G09G3/20Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters
    • G09G3/22Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources
    • G09G3/30Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources using electroluminescent panels
    • G09G3/32Control arrangements or circuits, of interest only in connection with visual indicators other than cathode-ray tubes for presentation of an assembly of a number of characters, e.g. a page, by composing the assembly by combination of individual elements arranged in a matrix no fixed position being assigned to or needed to be assigned to the individual characters or partial characters using controlled light sources using electroluminescent panels semiconductive, e.g. using light-emitting diodes [LED]
    • G06T5/90
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09GARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
    • G09G2320/00Control of display operating conditions
    • G09G2320/06Adjustment of display parameters
    • G09G2320/0626Adjustment of display parameters for control of overall brightness
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09GARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
    • G09G2320/00Control of display operating conditions
    • G09G2320/06Adjustment of display parameters
    • G09G2320/0666Adjustment of display parameters for control of colour parameters, e.g. colour temperature

Definitions

  • the present application relates to the technical field of image processing, in particular to an image enhancement method, device, computer equipment and storage medium.
  • the size of LED display screens has become smaller and smaller, and many outdoor screens can also be used indoors.
  • the LED display screen has a dual-use or even multi-purpose screen for indoor and outdoor use.
  • the brightness displayed by the indoor and outdoor LED displays is different. Yes, if the brightness of the LED display is simply adjusted by linearly adjusting the RGB lamp bead current, the color displayed by the LED display will shift, and the display effect will be greatly reduced. In this case, it is necessary to adjust the display color of the LED display.
  • RGB is usually converted to YCrCb to process the brightness component Y, but the image obtained by processing in this way has the problem of poor color display effect.
  • Various embodiments according to the present application provide an image enhancement method, device, computer equipment and storage medium.
  • the present application provides an image enhancement method executed by a computer device, the method comprising:
  • the image adjustment parameters include brightness adjustment parameters and chroma adjustment parameters
  • the first image data and the second image data belong to different color dimensions, and the second image data includes luminance data and chrominance data;
  • the third image data is a result of image enhancement processing of the first image data.
  • the brightness data is adjusted based on the brightness adjustment parameters to obtain adjusted brightness data, including:
  • the statistical results include the minimum brightness value in the brightness data before adjustment, Maximum brightness value and initial average brightness value;
  • the expansion coefficient perform brightness linear scaling processing on the brightness data in the second image data to obtain brightness data after brightness linear scaling processing, and determine the stretching average according to the brightness data after brightness linear scaling processing Brightness value;
  • the brightness data in the at least one target interval is adjusted to obtain adjusted brightness data.
  • determining at least one target interval to be adjusted in brightness in the second image data according to the stretched average brightness value includes:
  • a target interval corresponding to the brightness data to be adjusted for brightness is determined.
  • determining the target interval corresponding to the brightness data to be adjusted brightness includes:
  • a first brightness data adjustment interval is obtained; wherein the first target brightness value is located within the range of the first brightness data adjustment interval;
  • the first brightness data adjustment interval and the second brightness data adjustment interval are used as target intervals to be adjusted for brightness in the second image data.
  • the obtaining the first brightness data adjustment interval based on the first brightness frequency includes:
  • a first brightness data adjustment area is determined from the first brightness data set according to the brightness value corresponding to the middle frequency on the left side of the dark area and the brightness value corresponding to the middle frequency on the right side of the dark area.
  • the obtaining a second brightness data adjustment interval based on the second brightness frequency includes:
  • a second brightness data adjustment area is determined from the second brightness data set according to the brightness value corresponding to the middle frequency on the left side of the bright region and the brightness value corresponding to the middle frequency on the right side of the bright region.
  • the brightness adjustment parameter includes a maximum required brightness
  • the determining an adaptive brightness adjustment mode matching the second image data includes:
  • the size relationship between the stretched average brightness value, the first target brightness value, the second target brightness value, the first brightness threshold, and the second brightness threshold determine from the preset brightness adjustment methods and The adaptive brightness adjustment method that matches the second image data.
  • the adaptive brightness adjustment method includes a gamma adjustment expression corresponding to the brightness data, and the method further includes the step of constructing a gamma adjustment expression corresponding to the brightness data, which specifically includes:
  • a gamma adjustment expression corresponding to the brightness data is determined according to the approximate gamma adjustment coefficient and the maximum brightness.
  • the hue adjustment parameters include hue rotation angle, saturation adjustment coefficient, and hue compensation table; the hue data is adjusted based on the hue adjustment parameters to obtain adjusted hue data ,include:
  • the statistical results include the minimum brightness in the brightness data before adjustment value, the maximum brightness value and the initial average brightness value;
  • the present application provides an image enhancement device, the device comprising:
  • An acquisition module configured to acquire image adjustment parameters;
  • the image adjustment parameters include brightness adjustment parameters and chroma adjustment parameters;
  • a first conversion module configured to convert the first image data to be processed into second image data; the first image data and the second image data belong to different color dimensions, and the second image data includes brightness data and chromaticity data;
  • a first adjustment module configured to adjust the brightness data based on the brightness adjustment parameters to obtain adjusted brightness data, and update the brightness adjustment parameters when the adjusted brightness data does not meet a preset brightness enhancement condition , and continue to adjust the adjusted brightness data based on the updated brightness adjustment parameters, until the final adjusted brightness data meets the brightness enhancement condition;
  • the second adjustment module is configured to adjust the chroma data based on the chroma adjustment parameters to obtain the adjusted chroma data, and update the chroma data when the adjusted chroma data does not meet the preset chroma enhancement conditions
  • the chromaticity adjustment parameter, and based on the updated chromaticity adjustment parameter, continue to adjust the adjusted chromaticity data until the final adjusted chromaticity data meets the chromaticity enhancement condition;
  • the second conversion module is configured to perform image color dimension conversion on the luminance data satisfying the luminance enhancement condition and the chrominance data satisfying the chrominance enhancement condition, to obtain the same color dimension as the first image data to which the first image data belongs. Three image data, using the third image data as the result of image enhancement processing on the first image data.
  • the first adjustment module is further configured to perform statistics on brightness data before adjustment based on the brightness adjustment parameters, and determine a scaling factor according to the statistical results and the maximum required brightness in the brightness adjustment parameters;
  • the statistical result includes the minimum brightness value, the maximum brightness value and the initial average brightness value in the brightness data before adjustment; according to the scaling coefficient, perform brightness linear scaling processing on the brightness data in the second image data, Obtaining brightness data after brightness linear scaling processing, and determining a stretched average brightness value according to the brightness data after brightness linear scaling processing; according to the stretching average brightness value, determining at least A target interval; determining an adaptive brightness adjustment method that matches the second image data; and adjusting the brightness data in the at least one target interval based on the matched adaptive brightness adjustment method to obtain an adjusted Brightness data.
  • the first adjustment module is further configured to divide the brightness data after brightness linear stretching processing into a first brightness data set and a second brightness data set based on the stretched average brightness value;
  • the first target luminance value with the highest frequency of occurrence is filtered from the first luminance data set, and the second target luminance value with the highest frequency of occurrence is obtained from the second luminance data set; and according to the first target luminance value
  • the frequency values respectively corresponding to the second target brightness values determine the target interval corresponding to the brightness data to be adjusted for brightness.
  • the first adjustment module is further configured to determine a first brightness frequency at which the first target brightness value appears in the first brightness data set; determine the second target brightness value at the first brightness frequency The second brightness frequency appearing in the second brightness data set; based on the first brightness frequency, a first brightness data adjustment interval is obtained; wherein, the first target brightness value is located within the range of the first brightness data adjustment interval ; Obtain a second brightness data adjustment interval based on the second brightness frequency; wherein, the second target brightness value is located within the range of the second brightness data adjustment interval; The second brightness data adjustment interval is used as a target interval to be adjusted for brightness in the second image data.
  • the first adjustment module is further configured to determine the brightness value corresponding to the middle frequency on the left side of the dark area and the brightness value corresponding to the middle frequency on the right side of the dark area according to the first brightness frequency; wherein , the middle frequency of the dark area is half the frequency of the first brightness frequency; and according to the brightness value corresponding to the middle frequency on the left side of the dark area and the brightness value corresponding to the middle frequency on the right side of the dark area, from the first A first brightness data adjustment area is determined in the brightness data set.
  • the first adjustment module is further configured to determine the brightness value corresponding to the intermediate frequency on the left side of the bright area and the brightness value corresponding to the intermediate frequency on the right side of the bright area according to the second brightness frequency; wherein , the middle frequency of the bright area is half frequency of the second luminance frequency; A second brightness data adjustment area is determined in the brightness data set.
  • the first adjustment module is further configured to multiply the maximum required brightness by a first weight to obtain a first brightness threshold, and multiply the maximum required brightness by a second weight to obtain a second brightness threshold;
  • the first weight is smaller than the second weight; and according to the stretched average brightness value, the first target brightness value, the second target brightness value, the first brightness threshold and the second brightness threshold, from a preset Determine an adaptive brightness adjustment method that matches the second image data among the brightness adjustment methods.
  • the adaptive brightness adjustment method includes a gamma adjustment expression corresponding to the brightness data
  • the device further includes a mapping module, wherein: the mapping module is configured to grayscale level, calculate the normalized gamma value corresponding to each grayscale level, and based on the normalized gamma value corresponding to each grayscale level, obtain the gamma value mapping table corresponding to each grayscale level;
  • the data and the gamma coefficient are used as variables to perform bilinear interpolation calculations to obtain a first interpolation coefficient based on the variable representation, and the difference between the value one and the first interpolation coefficient is used as a second interpolation coefficient;
  • the brightness data variable is mapped to In the gray scale space, the third interpolation coefficient is determined based on the mapped brightness data variable, and the difference between the value one and the third interpolation coefficient is used as the fourth interpolation coefficient; based on the first interpolation coefficient, the second interpolation coefficient, the second interpolation coefficient Three interpolation coefficients, a fourth
  • the hue adjustment parameters include a hue rotation angle, a saturation adjustment coefficient, and a hue compensation table
  • the second adjustment module is further configured to perform statistics on brightness data before adjustment based on the brightness adjustment parameters , determining the expansion coefficient according to the statistical results and the maximum required brightness in the brightness adjustment parameters; the statistical results include the minimum brightness value, the maximum brightness value and the initial average brightness value in the brightness data before adjustment; according to the hue Rotate the chromaticity data two-dimensionally to obtain the first chromaticity data; according to the saturation adjustment coefficient and the expansion coefficient, convert the first chromaticity data to obtain the second chromaticity data; and performing chromaticity compensation on the second chromaticity data according to the chromaticity compensation table to obtain third chromaticity data, and using the third chromaticity data as adjusted chromaticity data.
  • the present application provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
  • the image adjustment parameters include brightness adjustment parameters and chroma adjustment parameters
  • the first image data and the second image data belong to different color dimensions, and the second image data includes luminance data and chrominance data;
  • the third image data is a result of image enhancement processing of the first image data.
  • the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
  • the image adjustment parameters include brightness adjustment parameters and chroma adjustment parameters
  • the first image data and the second image data belong to different color dimensions, and the second image data includes luminance data and chrominance data;
  • the third image data is a result of image enhancement processing of the first image data.
  • the present application provides a computer program, including program instructions. When executed on a computer device, the program instructions cause the computer device to implement the steps of the above image enhancement method.
  • FIG. 1 is an application environment diagram of an image enhancement method according to some embodiments
  • FIG. 2 is a schematic flow diagram of an image enhancement method according to some embodiments.
  • FIG. 3 is a schematic diagram of data flow in an image enhancement step according to some embodiments.
  • Fig. 4 is a schematic flowchart of an image enhancement method according to some embodiments.
  • Fig. 5 is a luminance statistical diagram of an image enhancement method according to some embodiments.
  • Fig. 6 is a function diagram of brightness adaptive adjustment of an image enhancement method according to some embodiments.
  • Fig. 7 is a schematic diagram of gamma interpolation calculation of an image enhancement method according to some embodiments.
  • FIG. 8 is a two-dimensional chromaticity data coordinate diagram of an image enhancement method according to some embodiments.
  • Figure 9 is a schematic diagram of an image enhancement device according to some embodiments.
  • Fig. 10 is a structural block diagram of an image enhancement device according to some embodiments.
  • Figure 11 is a diagram of the internal structure of a computer device according to some embodiments.
  • the image enhancement method provided in this application can be applied to the application environment shown in FIG. 1 .
  • the terminal 102 communicates with the server 104 through the network.
  • the terminal 102 and the server 104 can be used independently to execute the image enhancement method in this application, and the terminal 102 and the server 104 can be used to cooperate to execute the image enhancement method in this application.
  • the terminal 102 and the server 104 can be used to execute the image enhancement method in this application as an example.
  • the computer device first obtains the brightness adjustment parameters and chromaticity adjustment parameters used to adjust the image.
  • the second image data includes luminance data and chrominance data, and the first image data and the second image data belong to different color dimensions; then based on The brightness adjustment parameter adjusts the brightness data until the adjusted brightness data meets the preset brightness condition; and adjusts the chroma data based on the chroma adjustment parameter until the adjusted chroma data meets the preset chroma condition ; Finally, perform image color dimension conversion on the luminance data satisfying the luminance enhancement condition and the chrominance data satisfying the chroma enhancement condition, to obtain the third image data whose color dimension is the same as that of the first image data, and return the third image data to Terminal 102.
  • the terminal 102 can be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server 104 can be realized by an independent server or a server cluster composed of multiple servers.
  • Image adjustment parameters parameters used to process converted image data, generally preset The parameter values can be modified according to requirements
  • image data the data information contained in an image corresponding to one color dimension, different image data corresponding to different color dimensions
  • expansion coefficient calculated according to the statistical results of image data , used to linearly process the image data
  • target interval the brightness data interval obtained based on the statistical results of the brightness data, and the brightness data whose brightness data value is within the target interval needs to be adjusted.
  • an image enhancement method is provided, and the method is applied to a computer device (the computer device may specifically be a terminal or a server in FIG. 1 ) as an example for illustration, including the following steps :
  • Step S202 acquiring image adjustment parameters; the image adjustment parameters include brightness adjustment parameters and chroma adjustment parameters.
  • the parameter value of the adjustment parameter can be preset in advance.
  • the adjustment parameter can be further adjusted and updated to obtain a new adjustment parameter and use the new adjustment parameter to adjust the specific image data again.
  • Step S204 converting the first image data to be processed into second image data; the first image data and the second image data belong to different color dimensions, and the second image data includes luminance data and chrominance data.
  • the computer device converts the first image data into second image data according to the image processing action to be performed.
  • the first image data and the second image data have different color dimensions.
  • the second image data includes brightness data and chrominance data.
  • the first image data belongs to the RGB color dimension
  • the second image data belongs to the YCrCb color dimension, wherein Y represents luminance data, and CrCb represents chrominance data.
  • Step S206 adjust the brightness data based on the brightness adjustment parameters to obtain adjusted brightness data, when the adjusted brightness data does not meet the preset brightness enhancement conditions, update the brightness adjustment parameters, and based on the updated brightness adjustment parameters
  • the adjusted brightness data continues to be adjusted until the finally adjusted brightness data meets the brightness enhancement condition.
  • the computer device converts the first image, it obtains the corresponding brightness data, and then further processes it based on the brightness adjustment parameters in the aforementioned image adjustment parameters, and judges the processing result to determine the adjusted brightness data Whether it meets the preset brightness enhancement conditions, if not, update and adjust the brightness adjustment parameters, and then adjust the adjusted brightness data again based on the adjusted brightness adjustment parameters, until the final adjusted brightness data can meet Preset brightness enhancement conditions.
  • the preset brightness enhancement condition can be modified according to the adjustment requirements of the first image data, such as brightening a darker image or dimming a brighter image, or performing brightness equalization on images with different brightness, etc. This is not specifically limited in this embodiment.
  • Step S208 adjust the chromaticity data based on the chromaticity adjustment parameters to obtain the adjusted chromaticity data, when the adjusted chromaticity data does not meet the preset chromaticity enhancement conditions, update the chromaticity adjustment parameters, and based on the updated The adjusted chromaticity parameters continue to adjust the adjusted chromaticity data until the final adjusted chromaticity data meets the chromaticity enhancement condition.
  • the computer device After the computer device obtains the corresponding chromaticity data, it needs to further process it based on the chromaticity adjustment parameters in the aforementioned image adjustment parameters, and judge the processing results to determine whether the adjusted chromaticity data conforms to the preset If the chromaticity enhancement condition is not met, adjust the chromaticity adjustment parameters, and then adjust the adjusted chromaticity data again based on the adjusted chromaticity adjustment parameters until the final adjusted chromaticity data can meet Preset chroma enhancement conditions.
  • the preset chromaticity enhancement condition can be modified according to the adjustment requirement of the first image data, for example, adjusting the dark image into bright colors, which is not specifically limited in this embodiment.
  • Step S210 perform image color dimension conversion on the luminance data satisfying the luminance enhancement condition and the chrominance data satisfying the chroma enhancement condition, to obtain third image data having the same color dimension as the first image data, and use the third image data as The result of image enhancement processing on the first image data.
  • the computer device After the computer device processes the luminance data and chrominance data respectively, it needs to convert the processed luminance data and chrominance data into third image data in the same format as the first image data.
  • the data is a result obtained through image enhancement processing on the first image data.
  • the brightness adjustment parameters and chrominance adjustment parameters used to adjust the image are first acquired; the first image data to be processed is converted into second image data, and the second image data includes brightness data and chrominance data , and the first image data and the second image data belong to different color dimensions; then adjust the brightness data based on the brightness adjustment parameter until the adjusted brightness data meets the preset brightness enhancement condition; and, based on the chroma adjustment parameter
  • the chromaticity data is adjusted until the adjusted chromaticity data meets the preset chromaticity enhancement condition; finally, the image color dimension conversion is performed on the luminance data that meets the luminance enhancement condition and the chrominance data that meets the chrominance enhancement condition, and the obtained
  • the third image data having the same color dimension as the first image data obtains a result of image enhancement processing of the first image data.
  • the parameters of the luminance data and the chrominance data are adjusted respectively, and then the parameter-adjusted luminance data and chrominance data are converted into
  • the third image data with the same data color dimension effectively overcomes the problem of poor color display of the image obtained after converting the first image data into the second image data for processing, so that the obtained third image data can still be processed after brightness processing Maintain a good color display effect.
  • adjusting the brightness data based on the brightness adjustment parameters to obtain the adjusted brightness data includes: performing statistics on the brightness data based on the brightness adjustment parameters, and determining according to the statistical results and the maximum required brightness in the brightness adjustment parameters Stretching coefficient; statistical results include the minimum brightness value, maximum brightness value and initial average brightness value in the brightness data; according to the scaling coefficient, the brightness data in the second image data is linearly stretched and stretched to obtain the brightness linear stretching process.
  • Brightness data and determine the corresponding stretched average brightness value according to the brightness data after the brightness linear stretching process; according to the stretched average brightness value, determine at least one target interval to be adjusted in the second image data; determine the second image data and A matched adaptive brightness adjustment method; based on the matched adaptive brightness adjustment method, the brightness data in at least one target interval is adjusted to obtain adjusted brightness data.
  • the computer equipment Before the computer equipment makes specific adjustments to the brightness data, it first needs to make statistics on the brightness data in the initial state, determine the frequency of occurrence of each brightness value, and determine the corresponding brightness data statistical table, as shown in Figure 5 , where the vertical axis represents the frequency. Based on this statistical result, the computer device further determines the minimum brightness value, maximum brightness value and initial average brightness value in the brightness data, and calculates the corresponding expansion coefficient according to the above minimum brightness value, maximum brightness value and initial average brightness value. Based on the scaling coefficient, the computer equipment linearly scales each brightness value one by one to obtain the stretched brightness data, calculates the average value of the stretched brightness data, and obtains the stretched average brightness value.
  • the computer device determines the target interval that requires brightness adjustment based on the stretched average brightness value, and then determines a matching adaptive brightness adjustment method, and adjusts the brightness data in the target interval based on the adaptive brightness adjustment method. It should be noted that, in the above steps, when adjusting the brightness data in the target interval, the adjustment object is the brightness data that has been linearly scaled.
  • the target interval for brightness adjustment is determined based on the statistical results of the brightness data, and the adjustment range and adjustment target of the brightness data can be clarified, so that the brightness adjustment process is more accurate, and the obtained enhanced image quality effect is better. it is good.
  • determining at least one target interval to be adjusted in brightness in the second image data according to the stretched average brightness value includes: dividing the brightness data after the brightness linear scaling process into the second image data based on the stretched average brightness value. A brightness data set and a second brightness data set; the first target brightness value with the highest frequency of occurrence is filtered from the first brightness data set, and the second target brightness value with the highest frequency of occurrence is filtered from the second brightness data set; According to frequency values corresponding to the first target brightness value and the second target brightness value respectively in the brightness data, the target interval corresponding to the brightness data to be adjusted is determined.
  • the scaled average brightness value M divides the abscissa corresponding to the stretched brightness data into two parts, that is, the first brightness data set is brightness data in the range of 0-M; the second brightness data Set for brightness data larger than M range.
  • the computer device filters the first target brightness value with the highest frequency of occurrence from the first brightness data set, and obtains the first target brightness value with the highest frequency of occurrence from the second brightness data set. 2 Target brightness value.
  • the computer device determines a target interval in the brightness data to be adjusted for brightness based on frequency values respectively corresponding to the first target brightness value and the second target brightness value.
  • the computer device determines the corresponding brightness value MLL (the brightness value corresponding to the middle frequency on the left side of the dark area) and MLR (the middle frequency corresponding to the middle frequency on the right side of the dark area) according to half of the frequency value corresponding to the first target brightness value. luminance value), most of the luminance data in the first luminance data set fall within the range of the MLL-MLR, so it is determined that the luminance data within the range of the MLL-MLR is an object that needs to be adjusted.
  • the frequency values corresponding to MLL and MLR in this embodiment are not necessarily half of the maximum frequency value of the first brightness data set. Based on specific image enhancement requirements, this weight can be specifically modified. In this embodiment Examples are not considered to be specific limitations.
  • the statistical results of the brightness data are analyzed by stretching the average brightness value, and the target interval for brightness adjustment is determined, so that the brightness data in the image data can be accurately processed, and the brightness enhancement of the image can be improved. the quality of.
  • determining the target interval corresponding to the brightness data to be brightness adjusted includes: determining the first target brightness value at the first brightness the first luminance frequency appearing in the data set; determining the second luminance frequency corresponding to the second target luminance value in the second luminance data set; based on the first luminance frequency, obtaining the first luminance data adjustment interval; wherein, the first target luminance Located within the range of the first brightness data adjustment interval; based on the second brightness frequency, the second brightness data adjustment interval is obtained; wherein, the second target brightness is located within the range of the second brightness data adjustment interval; the first brightness data adjustment interval and the second The brightness data adjustment interval is used as a target interval to be adjusted for brightness in the second image data.
  • obtaining the first brightness data adjustment interval based on the first brightness frequency includes: determining the brightness value corresponding to the middle frequency on the left side of the dark area and the brightness value corresponding to the middle frequency on the right side of the dark area according to the first brightness frequency. brightness value; wherein, the middle frequency of the dark area is half frequency of the first brightness frequency; A first brightness data adjustment area is determined in the set.
  • obtaining the second brightness data adjustment interval based on the second brightness frequency includes: determining the brightness value corresponding to the middle frequency on the left side of the bright area and the brightness value corresponding to the middle frequency on the right side of the bright area according to the second brightness frequency. brightness value; wherein, the middle frequency of the bright area is half frequency of the second brightness frequency; A second brightness data adjustment area is determined in the brightness data set.
  • the computer device determines the corresponding brightness values MLL and MLR according to the frequency value corresponding to the first target brightness value, and it can be seen from Figure 5 that most of the brightness values in the first brightness data set The data all fall within the interval range of MLL-MLR, so it is determined that the luminance data whose value is within the range of MLL-MLR is the object to be adjusted.
  • the frequency value corresponding to the second target brightness value it is determined that the object that needs to be adjusted in the second brightness data set is MHL (brightness value corresponding to the middle frequency on the left side of the bright area)-MHR (right side of the bright area). Brightness data within the range of the brightness value corresponding to the side middle frequency).
  • the target interval in which the brightness data is relatively concentrated in the first brightness data set and the second brightness data set is determined through the statistical results of the brightness data.
  • the brightness adjustment parameters include a maximum required brightness
  • determining an adaptive brightness adjustment method that matches the second image data includes: multiplying the maximum required brightness by a first weight to obtain a first brightness threshold, and multiplying the maximum required brightness The brightness is multiplied by the second weight to obtain the second brightness threshold; the first weight is smaller than the second weight; according to the stretched average brightness value, the first target brightness value, the second target brightness value, the first brightness threshold, and the second brightness threshold, from An adaptive brightness adjustment method matching the second image data is determined among the preset brightness adjustment methods.
  • the computer device determines the corresponding brightness values MLL and MLR according to half of the frequency value corresponding to the first target brightness value, and most of the brightness data in the first brightness data set fall in the MLL - within the interval range of the MLR, thus it is determined that the luminance data whose value is within the range of MLL-MLR is the object to be adjusted.
  • the frequency value corresponding to the second target brightness value it is determined that the object to be adjusted in the second brightness data set is the brightness data whose value is within the MHL-MHR range.
  • the frequency values corresponding to MLL and MLR in this embodiment are not necessarily half of the maximum frequency value of the first luminance data set, and this weight can be specifically modified based on specific image enhancement requirements. Examples are not considered to be specific limitations.
  • the preset brightness adjustment methods include the six situations described in the following embodiments, for details, please refer to the following description.
  • the computer device determines the target interval in which the brightness data is more concentrated in the first brightness data set and the second brightness data set based on the first target brightness value and the second target brightness value and the frequency values corresponding to the two, By adjusting the target interval, the enhancement of the first image data can be better realized.
  • the adaptive brightness adjustment method includes a gamma adjustment expression corresponding to the brightness data, and the method further includes the step of pre-constructing a gamma approximate expression corresponding to the brightness data, and this step specifically includes: based on the first image data grayscale level, calculate the normalized gamma value corresponding to each grayscale level, and based on the normalized gamma value corresponding to each grayscale level, obtain the gamma value mapping table corresponding to each grayscale level;
  • the data and the gamma coefficient are used as variables to perform bilinear interpolation calculations, and the first interpolation coefficient based on the variable representation is obtained, and the difference between the value 1 and the first interpolation coefficient is used as the second interpolation coefficient;
  • the brightness data variable is mapped to the gray scale space , determine the third interpolation coefficient based on the mapped luminance data variable, and use the difference between the value one and the third interpolation coefficient as the fourth interpolation coefficient; based on the first interpolation coefficient, the second
  • the computer device implements adaptive brightness adjustment on the brightness data based on the mapping relationship between the gamma coefficient and the brightness data. That is, before performing specific image enhancement processing, the computer device has already obtained the above mapping relationship.
  • the computer device can set the gamma coefficient to be bounded, and its endpoint list TS can be expressed as ⁇ A1, A2, ..., An, 1, 1/An, ..., 1/A2, 1/ A1 ⁇ .
  • the gamma coefficient is normalized to obtain the corresponding gamma value mapping table.
  • the computer device can use the brightness data variable y and the gamma coefficient variable J before adjustment as variables for bilinear interpolation, and confirm that J is within a certain interval of the endpoint list TS, that is, TS[i] ⁇ J ⁇ TS[ i+1], i ⁇ [0,2n], the first interpolation coefficient c1 and the second interpolation coefficient c2 can be obtained:
  • the computer equipment maps y to the grayscale space (256 space) to obtain y', and sets the third interpolation coefficient d1 as the difference between the mapped luminance data and the value rounded down from the mapped luminance data ;
  • the fourth interpolation coefficient d2 is the difference between 1 and the third interpolation coefficient d1.
  • the computer device when the computer device processes the brightness data, it does not need to calculate the gamma coefficient for each brightness data, and can directly calculate the gamma coefficient according to the gamma Adjusting the expression can realize the self-adaptive adjustment of the brightness data, which greatly saves the calculation pressure of the computer equipment and improves the image enhancement processing efficiency of the computer equipment.
  • the chroma adjustment parameters include hue rotation angle, saturation adjustment coefficient and chroma compensation table; the chroma data is adjusted based on the chroma adjustment parameters to obtain the adjusted chroma data, including: Adjust the parameters, make statistics on the brightness data before adjustment, and determine the expansion coefficient according to the statistical results and the maximum required brightness in the brightness adjustment parameters; the statistical results include the minimum brightness value, maximum brightness value and initial average brightness value in the brightness data before adjustment ;According to the hue rotation angle, two-dimensionally rotate the chroma data to obtain the first chroma data; convert the first chroma data according to the saturation adjustment coefficient and expansion coefficient to obtain the second chroma data; according to the chroma
  • the compensation table performs chromaticity compensation on the second chromaticity data to obtain third chromaticity data, and uses the third chromaticity data as adjusted chromaticity data.
  • the hue adjustment parameters in this embodiment include hue rotation angle, saturation adjustment coefficient, and hue compensation table.
  • the computer device first performs two-dimensional rotation on the hue data based on the hue rotation angle to obtain the first hue data, and then obtains the first hue data according to the scaling coefficient adjusting the first chroma data with the saturation adjustment coefficient to obtain second chroma data, and finally performing chroma compensation on the second chroma data based on the chroma compensation table to obtain chroma data after chroma adjustment.
  • the chromaticity data is specifically adjusted through the hue rotation angle, saturation adjustment coefficient and chromaticity compensation table, and the adjusted chromaticity data can be effectively displayed in the process of displaying the third image data. Avoid the problem of color distortion of the third image data.
  • FIG. 3 it is a specific embodiment of an image enhancement method.
  • the principle of this application is to convert the RGB image data to be processed into YCrCb, take out the brightness component Y and then combine the externally input brightness adjustment parameters to perform brightness adjustment processing, including brightness linear scaling and brightness adaptive adjustment, and the adaptive algorithm uses multiple different coefficients Gamma transformation, while the chroma component CrCb also needs to be adjusted according to the external input chroma adjustment parameters and internal processing parameters, and finally the adjusted YCrCb is converted back to RGB display data.
  • the process is shown in Figure 1, preloading brightness adjustment parameters, chroma adjustment parameters, gamma mapping table and chroma compensation table.
  • RGB YCrCb
  • chrominance information CrCb perform statistics on the brightness information, and perform brightness linear scaling processing after obtaining relevant data, and then according to the statistical data and
  • the preloaded gamma table performs brightness adaptive processing; while the chroma information will first perform a similar hue adjustment, then perform a similar saturation adjustment, and finally perform compensation and limit processing according to the chroma compensation table; after these two parts of information are processed Then convert YCrCb to RGB for output display.
  • RGB to YCrCb is the RGB color conversion YCrCb color module.
  • domain conversion formula Take the domain conversion formula as an example:
  • the converted Y is brightness information, and Cr and Cb are called chrominance information.
  • the scaling formula is:
  • Ylinear represents the brightness after linear stretching
  • Ycur represents the brightness before stretching
  • the judgment thresholds of low-brightness images and over-brightness images are obtained.
  • the basis for judging low-brightness images is that the average brightness is lower than 35% of the maximum brightness.
  • % is the threshold TH_H, the calculation formula of the two thresholds is:
  • the brightness of the image is divided into bright areas and dark areas. Each frame of the image in these two areas may be different because it is distinguished by the average brightness. As shown in Figure 3, the frequency of occurrence of each brightness is counted. According to the statistical results, the brightness values MH and ML with the highest frequency of occurrence in the bright area and the dark area are respectively found. The interval between the two points half of the frequency value is the brightness-intensive area of the area.
  • the steepness of the gamma curve is determined according to the "steepness" of the two waves in the bright area and the dark area, and the contrast of the brightness-intensive area is enlarged, thereby improving image enhancement. Effect, because there are many brightness distributions, the following will be divided into 6 cases according to the values of M, MH, ML, TH_L and TH_H for processing.
  • the "Y adjust” module is a brightness adaptive adjustment module, which performs brightness adaptive adjustment according to the M, MH, ML, TH_L and TH_H parameters.
  • the two thresholds of TH_L and TH_H divide the entire brightness range into low-brightness areas, normal areas and over-brightness areas. Area, as shown in Figure 4, is divided into 6 situations, the abscissa of each sub-graph represents the brightness before adaptive adjustment, the ordinate represents the brightness after adaptive adjustment, and the solid curve of each graph represents the adjustment function.
  • the brightness adjustment formula is:
  • Yadj represents the adjusted luminance data
  • TH_H is the second luminance threshold
  • Ylinear is the luminance data after the luminance linear stretching process.
  • the minimum value of gm is 1/3. The smaller the gm is, the steeper the low-brightness part of the curve is, the greater the contrast is, and the average brightness of the image is also larger, while the high-brightness area retains the stretching result.
  • the brightness adjustment formula is:
  • Yadj represents the adjusted brightness data
  • Ylinear represents the brightness data after the brightness linear scaling process
  • YMax represents the maximum required brightness
  • TH_L represents the first brightness threshold.
  • the maximum value of gm is 3. The larger gm is, the steeper the highlight part of the curve is, the greater the contrast is, and the average brightness of the image is also smaller, while the low-brightness area retains the stretching result.
  • the maximum value of gmL is 3, and the minimum value of gmH is 1/3.
  • the brightness adjustment formula is:
  • Yadj represents the adjusted luminance data
  • Ylinear is the luminance data after the luminance linear stretching process
  • M is the stretched average luminance value
  • YMax is the maximum required luminance.
  • the image is mainly concentrated in the low-brightness area and the over-brightness area.
  • the adaptive adjustment curve is divided into two gamma curves.
  • the gamma coefficient values in the 0-M interval and the M-YMax interval are gmL and gmH respectively, and the calculation formula is:
  • the maximum value of gmH is 3, and the minimum value of gmL is 1/3.
  • the brightness adjustment formula is:
  • Yadj represents the adjusted luminance data
  • M is the stretched average luminance value
  • Ylinear is the luminance data after the luminance linear stretching process
  • YMax is the maximum required luminance.
  • TH_L ⁇ ML ⁇ TH_H and MH>TH_H that is, the first brightness threshold is smaller than the first target brightness value, and the first target brightness value is smaller than the second brightness threshold, and, When the second brightness value is greater than the second brightness threshold), it means that the image brightness is mainly concentrated in the low-brightness area and the normal area, and the adaptive adjustment curve is divided into three gamma curves, 0-ML interval, ML-M interval and M-YMax interval
  • the gamma coefficient values of gmL, gmN and gmH are respectively, and the calculation formula is:
  • the maximum value of gmL is 3, the minimum value of gmN is 1/3, and the maximum value of gmH is 3.
  • the brightness adjustment formula is:
  • Yadj represents the adjusted luminance data
  • ML is the first target luminance value
  • Ylinear is the luminance data after the luminance linear stretching process
  • M is the stretched average luminance value
  • YMax is the maximum required luminance.
  • the maximum value of gmL is 3, the minimum value of gmN is 1/3, and the maximum value of gmH is 3.
  • the brightness adjustment formula is:
  • Yadj represents the adjusted luminance data
  • M is the stretched average luminance value
  • MH is the second target luminance value
  • Ylinear is the luminance data after the luminance linear scaling process
  • YMax is the maximum required luminance.
  • the above 6 situations include the adaptive adjustment of dark image brightening, overbright image darkening, and uneven brightness image tone balance, all of which use gamma operations with indeterminate coefficient values.
  • the gamma operation expression can be simplified as:
  • Y is the brightness after gamma adjustment
  • y is the brightness before adjustment
  • I is the maximum brightness
  • J is the gamma coefficient, that is, gm, gmL, gmN and gmH in the formulas of the above six situations. The effect limits the gamma coefficient J to the [1/3,3] closed interval.
  • the gamma calculation is implemented by hardware or software, its efficiency is relatively low.
  • the common method is to sacrifice the memory to store the gamma calculation results of the fixed gamma coefficient, and read them directly when needed.
  • the gamma coefficient in this application is calculated. is an indeterminate value, that is, it is impossible to calculate and store all the gamma values by sacrificing memory, so in order to avoid direct gamma calculations, this application proposes an approximate algorithm to improve efficiency, by pre-calculating multiple different coefficients
  • the normalized gamma mapping table and bilinear interpolation calculations get approximate results.
  • the gamma coefficients are first 'bounded', that is, the maximum and minimum gammas are limited, otherwise segmentation cannot be performed; then the gamma coefficients The interval is segmented. If the gamma coefficient exceeds 1, it is best to divide the gamma into two areas, the brightening area (0,1) and the darkening area (1,+ ⁇ ). The gamma segmentation is symmetrical between the two areas. That is, if the value is a in one interval, then the value in the other interval is 1/a.
  • the endpoint list TS segmented by this method can be expressed as ⁇ A1, A2, ..., An, 1, 1 /An, ..., 1/A2, 1/A1 ⁇ ; then let x range from 0 to 255, and the value of P takes the value in the segment endpoint list in turn, and the normalized gamma formula:
  • the brightness y and gamma coefficient J are used as bilinear interpolation variables to confirm that J is within a certain interval of TS, that is, TS[i] ⁇ J ⁇ TS[i+1], i ⁇ [ 0,2n], the interpolation coefficients c1 and c2 can be calculated:
  • GT1 represents the gamma mapping table whose gm coefficient is equal to TS[i]
  • GT2 represents the gamma mapping table whose gm coefficient is equal to TS[i+1].
  • Y of y is:
  • the accuracy of this approximation is related to the level of the gamma table, the segmental interval size of the gm coefficient, and the position of y in the formula.
  • the "Color adjust” module is a chroma adjustment, that is, an adjustment to CrCb.
  • YCrCb completely separates the brightness Y and chroma CrCb, if only the Y component is adjusted, the hue shift is likely to occur.
  • This solution Referring to the processing mode of HSV color space, the function of approximate hue rotation is added, and the two-dimensional rotation of E angle is performed on the CrCb component. This conversion is similar to the hue H rotation of HSV. This method is more efficient and convenient than the conversion between RGB and HSV. Circuit implementation, the approximate conversion formula is as follows:
  • K is the expansion and contraction coefficient of brightness, which is calculated by the previous "Y calc" module
  • K1 is the color saturation adjustment coefficient input from the outside, and the default is 1; as shown in Figure 8, the color is the value of CrCb with 256 gray levels
  • the range is -128 to 128, f(x) represents the saturation difference between the same RGB color value in the HSV color space and the YCrCb color space, and it is also a compensation value mapping table made to prevent the rotation processing results Cr1 and Cb1 from crossing the boundary. The actual measurements are collected.
  • the "YCrCb to RGB” module is a YCrCb color conversion RGB color module, which converts the adaptively adjusted YCrCb color into RGB color, which can be directly output to an external display device for display.
  • the scheme of converting RGB to YCrCb and then adjusting CrCb in the above process not only takes into account the color effect but also improves the conversion efficiency by 29% compared with the traditional RGB conversion and HSV conversion scheme.
  • a multi-segment variable coefficient gamma curve adaptive adjustment method is further proposed, which can well adjust the contrast of the gray-scale dense area to enhance the image enhancement effect.
  • These variable gamma coefficients are replaced by pre-calculating a plurality of different coefficient gamma mapping tables and a bilinear interpolation algorithm, which further improves the computing efficiency of computer equipment in the image enhancement process.
  • an image enhancement device 1000 including: an acquisition module 1002, a first conversion module 1004, a first adjustment module 1006, a second adjustment module 1008, and a second conversion module 1010, of which:
  • the acquisition module 1002 is configured to acquire image adjustment parameters; the image adjustment parameters include brightness adjustment parameters and chroma adjustment parameters.
  • a first conversion module 1004 configured to convert the first image data to be processed into second image data; the first image data and the second image data belong to different color dimensions, and the second image data includes luminance data and chrominance data .
  • the first adjustment module 1006 is configured to adjust the brightness data based on the brightness adjustment parameters to obtain adjusted brightness data.
  • update the brightness adjustment parameters and based on the updated
  • the adjusted brightness data is continuously adjusted by the brightness adjustment parameter until the finally adjusted brightness data satisfies the brightness enhancement condition.
  • the second adjustment module 1008 is configured to adjust the chromaticity data based on the chromaticity adjustment parameters to obtain the adjusted chromaticity data, and update the chromaticity adjustment when the adjusted chromaticity data does not meet the preset chromaticity enhancement conditions parameters, and continue to adjust the adjusted chromaticity data based on the updated chromaticity adjustment parameters until the final adjusted chromaticity data meets the chromaticity enhancement condition.
  • the second conversion module 1010 is configured to perform image color dimension conversion on the luminance data satisfying the luminance enhancement condition and the chrominance data satisfying the chrominance enhancement condition, to obtain third image data having the same color dimension as the first image data, and
  • the third image data is a result of image enhancement processing of the first image data.
  • the brightness adjustment parameters and chrominance adjustment parameters used to adjust the image are first obtained; the first image data to be processed is converted into second image data, and the second image data includes luminance data and chrominance data , and the first image data and the second image data belong to different color dimensions; then adjust the brightness data based on the brightness adjustment parameter until the adjusted brightness data meets the preset brightness enhancement condition; and, based on the chroma adjustment parameter
  • the chromaticity data is adjusted until the adjusted chromaticity data meets the preset chromaticity enhancement condition; finally, the image color dimension conversion is performed on the luminance data that meets the luminance enhancement condition and the chrominance data that meets the chrominance enhancement condition, and the obtained
  • the third image data having the same color dimension as the first image data obtains a result of image enhancement processing of the first image data.
  • the parameters of the luminance data and the chrominance data are respectively adjusted, and then the parameter-adjusted luminance data and chrominance data are converted into the color dimension and the second image data.
  • Reading three image data with the same image data effectively overcomes the problem of poor color display of the image obtained after converting the first image data into the second image data for processing, so that the obtained third image data can still be processed after brightness processing Maintain a good color display effect.
  • the above-mentioned first adjustment module is further configured to: perform statistics on the brightness data before adjustment based on the brightness adjustment parameters, and determine the expansion coefficient according to the statistical results and the maximum required brightness in the brightness adjustment parameters; the statistical results include adjustment The minimum luminance value, the maximum luminance value and the initial average luminance value in the previous luminance data; according to the expansion coefficient, the luminance data in the second image data is subjected to luminance linear expansion and contraction processing to obtain the luminance data after the brightness linear expansion and contraction processing, and Determine the stretched average brightness value according to the brightness data after the brightness linear stretching process; determine at least one target interval to be adjusted in the second image data according to the stretched average brightness value; determine the adaptive brightness matching the second image data An adjustment method: based on a matching adaptive brightness adjustment method, the brightness data in at least one target interval is adjusted to obtain adjusted brightness data.
  • the target interval to be adjusted is determined based on the statistical results of the brightness data, and the adjustment range and adjustment target of the brightness data can be clarified, so that the brightness adjustment process is more accurate, and the obtained enhanced image quality is better. .
  • the above-mentioned first adjustment module is further configured to: divide the luminance data after the luminance linear scaling process into a first luminance data set and a second luminance data set based on the stretched average luminance value; The first target luminance value with the highest frequency of occurrence is filtered from the data set, and the second target luminance value with the highest frequency of occurrence is filtered from the second luminance data set; The frequency value determines the target interval corresponding to the brightness data to be adjusted.
  • the statistical results of the brightness data are analyzed by stretching the average brightness, and the target interval for brightness adjustment is determined, so that the brightness data in the image data can be accurately processed, and the efficiency of image brightness enhancement is improved. quality.
  • the above-mentioned first adjustment module is further configured to: determine the first luminance frequency at which the first target luminance value appears in the first luminance data set; determine the second target luminance value to appear in the second luminance data set The second brightness frequency; based on the statistical results and the first brightness frequency, the first brightness data adjustment interval is obtained; wherein, the first target brightness value is located within the range of the first brightness data adjustment interval; based on the statistical results and the second brightness frequency, the The second brightness data adjustment interval; wherein, the second target brightness value is located within the range of the second brightness data adjustment interval; the first brightness data adjustment interval and the second brightness data adjustment interval are used as the brightness adjustment to be performed in the second image data target interval.
  • the first adjustment module is further configured to determine the brightness value corresponding to the middle frequency on the left side of the dark area and the middle frequency corresponding to the right side of the dark area according to the statistical result and the first brightness frequency.
  • brightness value wherein, the middle frequency of the dark area is half frequency of the first brightness frequency; and according to the brightness value corresponding to the middle frequency on the left side of the dark area and the brightness value corresponding to the middle frequency on the right side of the dark area, Determine the first brightness data adjustment area.
  • the first adjustment module is further configured to determine the brightness value corresponding to the middle frequency on the left side of the bright area and the middle frequency corresponding to the right side of the bright area according to the statistical result and the second brightness frequency.
  • brightness value wherein, the middle frequency of the bright area is half frequency of the second brightness frequency; and according to the brightness value corresponding to the middle frequency on the left side of the bright area and the brightness value corresponding to the middle frequency on the right side of the bright area, Determine the second brightness data adjustment area.
  • the target interval in which the brightness data is relatively concentrated in the first brightness data set and the second brightness data set is determined through the statistical results of the brightness data.
  • the brightness adjustment parameters include the maximum required brightness
  • the above-mentioned first adjustment module is further configured to: multiply the maximum required brightness by the first weight to obtain the first brightness threshold, and multiply the maximum required brightness by the second weight to obtain the second threshold.
  • Two brightness thresholds the first weight is less than the second weight; according to the stretched average brightness value, the first target brightness value, the second target brightness value, the first brightness threshold, and the second brightness threshold, determine the same value from the preset brightness adjustment method The adaptive brightness adjustment method that matches the second image data.
  • the computer device determines the target interval in which the brightness data is relatively concentrated in the first brightness data set and the second brightness data set based on the first target brightness value, the first target brightness value and the frequency value corresponding to the two, By adjusting the target interval, the enhancement of the first image data can be better realized.
  • the device further includes a mapping module, and the mapping module is configured to: calculate the normalized gamma value corresponding to each gray scale level based on the gray scale level of the first image data, and calculate the normalized gamma value corresponding to each gray scale level based on the Normalize the gamma value to obtain the gamma value mapping table corresponding to each gray scale level; perform bilinear interpolation calculation with brightness data and gamma coefficient as variables to obtain the first interpolation coefficient based on variable representation, and compare the value one with the second The difference between one interpolation coefficient is used as the second interpolation coefficient; the brightness data variable is mapped to the grayscale space, and the third interpolation coefficient is determined based on the mapped brightness data variable, and the difference between the value one and the third interpolation coefficient is used as the first Four interpolation coefficients; based on the first interpolation coefficient, the second interpolation coefficient, the third interpolation coefficient, the fourth interpolation coefficient, and the gamma value mapping table
  • the computer device when the computer device processes the brightness data, it does not need to calculate the gamma coefficient for each brightness data, and can directly calculate the gamma coefficient according to the gamma Adjusting the expression can realize the self-adaptive adjustment of the brightness data, which greatly saves the calculation pressure of the computer equipment and improves the image enhancement processing efficiency of the computer equipment.
  • the hue adjustment parameters include hue rotation angle, saturation adjustment coefficient, and hue compensation table; the above-mentioned second adjustment module is also used to: based on the brightness adjustment parameters, perform statistics on the brightness data before adjustment, according to The statistical results and the maximum required brightness in the brightness adjustment parameters determine the corresponding expansion coefficient; the statistical results include the minimum brightness value, the maximum brightness value and the initial average brightness value in the brightness data before adjustment; according to the hue rotation angle, the chromaticity data is Rotate two-dimensionally to obtain the first chroma data; convert the first chroma data according to the saturation adjustment coefficient and expansion coefficient to obtain the second chroma data; Compensation to obtain third chromaticity data, and use the third chromaticity data as adjusted chromaticity data.
  • the chromaticity data is specifically adjusted through the hue rotation angle, saturation adjustment coefficient and chromaticity compensation table, and the adjusted chromaticity data can be effectively displayed in the process of displaying the third image data. Avoid the problem of color distortion of the third image data.
  • Each module in the above-mentioned image enhancement device can be fully or partially realized by software, hardware and a combination thereof.
  • the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that the processor can invoke and execute the corresponding operations of the above-mentioned modules.
  • a computer device is provided.
  • the computer device may be a server or a terminal, and its internal structure may be as shown in FIG. 11 .
  • the computer device includes a processor, memory and a network interface connected by a system bus. Wherein, the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, computer programs and databases.
  • the internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium.
  • the computer device's database is used to store image enhancement data.
  • the network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by a processor, an image enhancement method is realized.
  • FIG. 11 is only a block diagram of a partial structure related to the solution of this application, and does not constitute a limitation on the computer equipment on which the solution of this application is applied.
  • the specific computer equipment can be More or fewer components than shown in the figures may be included, or certain components may be combined, or have a different arrangement of components.
  • a computer device including a memory and a processor, where a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
  • a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps in the foregoing method embodiments are implemented.
  • a computer program including program instructions. When executed on a computer device, the program instructions cause the computer device to implement the steps in the above method embodiments.
  • Non-volatile memory may include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory or optical memory, etc.
  • Volatile memory can include Random Access Memory (RAM) or external cache memory.
  • RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

Abstract

一种图像增强方法,包括:获取图像调整参数(S202),图像调整参数包括亮度调整参数和色度调整参数;将待处理的第一图像数据转换为第二图像数据(S204),第二图像数据包括亮度数据和色度数据;基于亮度调整参数对亮度数据进行调整,得到调整后的亮度数据,当调整后的亮度数据不满足预设的亮度增强条件时,更新亮度调整参数,并基于更新后的亮度调整参数对调整后的亮度数据继续进行调整,直至最终调整后的亮度数据满足亮度增强条件(S206);基于色度调整参数对色度数据进行调整,得到调整后的色度数据,当调整后的色度数据不满足预设的色度增强条件时,更新色度调整参数,并基于更新后的色度调整参数对调整后的色度数据继续进行调整,直至最终调整后的色度数据满足色度增强条件(S208);对满足亮度增强条件的亮度数据和满足色度增强条件的色度数据,进行图像颜色维度转换,得到与第一图像数据所属颜色维度相同的第三图像数据,将第三图像数据作为第一图像数据经过图像增强处理的结果(S210)。

Description

一种图像增强方法、装置、计算机设备和存储介质
本申请要求于2021年07月13日提交中国专利局,申请号为202110791702.6、发明名称为“一种图像增强方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像处理技术领域,特别是涉及一种图像增强方法、装置、计算机设备和存储介质。
背景技术
随着LED(light emitting diode,发光二极管)显示屏技术的发展,LED显示屏尺寸已经做越小,很多室外的屏幕也可以放到室内使用了。在多场景使用的过程中,LED显示屏就产生了室内室外使用的一屏两用甚至一屏多用的需求,但是因为外界光环境的因素,室内和室外的LED显示屏显示的亮度是不一样的,如果只是单纯的线性调节LED显示屏的RGB灯珠电流来调节灯珠的亮度,LED显示屏显示的色彩会产生偏移的现象,那么显示效果就大大下降。在这种情况下,就需要对LED显示屏的显示色彩进行调整。
亮度作为LED显示屏的显示特点,对亮度的控制以及图像的亮度处理都是至关重要的。较暗的图像和过亮的图像在LED显示屏上显示时,其亮度信息是很明显的。基于此,传统方案中通常是将RGB转换到YCrCb对亮度分量Y处理,但是通过这种方式处理获得的图像具有色彩显示效果差的问题。
发明内容
根据本申请的各种实施例提供了一种图像增强方法、装置、计算机设备和存储介质。
第一方面,本申请提供一种图像增强方法,由计算机设备执行,所述方法包括:
获取图像调整参数;所述图像调整参数包括亮度调整参数和色度调整参数;
将待处理的第一图像数据转换为第二图像数据;所述第一图像数据和第二图像数据属于不同的颜色维度,且所述第二图像数据包括亮度数据和色度数据;
基于所述亮度调整参数对所述亮度数据进行调整,得到调整后的亮度数据,当调整后的亮度数据不满足预设的亮度增强条件时,更新所述亮度调整参数,并基于更新后的亮度调整参数对调整后的亮度数据继续进行调整,直至最终调整后的亮度数据满足所述亮度增强条件;
基于所述色度调整参数对所述色度数据进行调整,得到调整后的色度数据,当调整后的色度数据不满足预设的色度增强条件时,更新所述色度调整参数,并基于更新后的色度调整参数对调整后的色度数据继续进行调整,直至最终调整后的色度数据满足所述色度增强条件;及
对满足所述亮度增强条件的亮度数据和满足所述色度增强条件的色度数据,进行图像颜色维度转换,得到与所述第一图像数据所属颜色维度相同的第三图像数据,将所述第三图像数据作为所述第一图像数据经过图像增强处理的结果。
在一些实施例中,基于所述亮度调整参数对所述亮度数据进行调整,得到调整后的亮度数据,包括:
基于所述亮度调整参数,对调整前的亮度数据进行统计,根据统计结果和亮度调整参数中的最大需求亮度确定伸缩系数;所述统计结果包括所述调整前的亮度数据中的最小亮度值、最大亮度值和初始平均亮度值;
根据所述伸缩系数,对所述第二图像数据中的亮度数据进行亮度线性伸缩处理,得到经过亮度线性伸缩处理后 的亮度数据,并根据所述经过亮度线性伸缩处理后的亮度数据确定伸缩平均亮度值;
根据所述伸缩平均亮度值,确定所述第二图像数据中待进行亮度调整的至少一个目标区间;
确定与所述第二图像数据相匹配的自适应亮度调整方式;及
基于相匹配的自适应亮度调整方式,对所述至少一个目标区间中的亮度数据进行调节,得到调整后的亮度数据。
在一些实施例中,根据所述伸缩平均亮度值,确定所述第二图像数据中待进行亮度调整的至少一个目标区间,包括:
基于所述伸缩平均亮度值,将所述经过亮度线性伸缩处理后的亮度数据分为第一亮度数据集合和第二亮度数据集合;
从所述第一亮度数据集合中筛选得到出现频率最高的第一目标亮度值,并从所述第二亮度数据集合中筛选得到出现频率最高的第二目标亮度值;及
根据所述第一目标亮度值和第二目标亮度值分别对应的频率值,确定待进行亮度调整的亮度数据对应的目标区间。
在一些实施例中,根据所述第一目标亮度值和第二目标亮度值分别对应的频率值,确定待进行亮度调整的亮度数据对应的目标区间,包括:
确定所述第一目标亮度值在所述第一亮度数据集合中出现的第一亮度频率;确定所述第二目标亮度值在所述第二亮度数据集合中出现的第二亮度频率;
基于所述第一亮度频率,得到第一亮度数据调整区间;其中所述第一目标亮度值位于所述第一亮度数据调整区间范围内;
基于所述第二亮度频率,得到第二亮度数据调整区间;其中所述第二目标亮度值位于所述第二亮度数据调整区间范围内;及
将所述第一亮度数据调整区间和所述第二亮度数据调整区间,作为所述第二图像数据中待进行亮度调整的目标区间。
在一些实施例中,所述基于所述第一亮度频率,得到第一亮度数据调整区间,包括:
根据所述第一亮度频率确定暗区左侧中间频率所应的亮度值、以及暗区右侧中间频率所对应的亮度值;其中,暗区的中间频率是所述第一亮度频率的一半频率;及
根据所述暗区左侧中间频率所应的亮度值和暗区右侧中间频率所对应的亮度值,从所述第一亮度数据集合中确定第一亮度数据调整区域。
在一些实施例中,所述基于所述第二亮度频率,得到第二亮度数据调整区间,包括:
根据所述第二亮度频率确定亮区左侧中间频率所应的亮度值、以及亮区右侧中间频率所对应的亮度值;其中,亮区的中间频率是所述第二亮度频率的一半频率;及
根据所述亮区左侧中间频率所应的亮度值和亮区右侧中间频率所对应的亮度值,从所述第二亮度数据集合中确定第二亮度数据调整区域。
在一些实施例中,亮度调整参数包括最大需求亮度,所述确定与所述第二图像数据相匹配的自适应亮度调整方式,包括:
将所述最大需求亮度乘以第一权重得到第一亮度阈值,将所述最大需求亮度乘以第二权重得到第二亮度阈值;所述第一权重小于所述第二权重;及
根据所述伸缩平均亮度值、所述第一目标亮度值、第二目标亮度值、所述第一亮度阈值、以及第二亮度阈值之 间的大小关系,从预设的亮度调整方式中确定与所述第二图像数据相匹配的自适应亮度调整方式。
在一些实施例中,自适应亮度调整方式包括与所述亮度数据对应的gamma调整表达式,所述方法还包括构建与所述亮度数据对应的gamma调整表达式的步骤,该步骤具体包括:
基于所述第一图像数据的灰阶等级,计算每个灰阶等级对应的归一化gamma值,并基于每个灰阶等级对应的归一化gamma值,得到与各灰阶等级相对应的gamma值映射表;
以亮度数据和gamma系数作为变量进行双线性插值计算,得到基于所述变量表征的第一插值系数,将数值一与所述第一插值系数的差,作为第二插值系数;
将亮度数据变量映射到灰阶空间,基于映射后的亮度数据变量确定第三插值系数,并将数值一与所述第三插值系数间的差,作为第四插值系数;
基于第一插值系数、第二插值系数、第三插值系数、第四插值系数,以及与各灰阶等级相对应的gamma值映射表,确定与所述亮度数据对应的gamma近似调整系数;及
根据所述gamma近似调整系数和最大亮度,确定与所述亮度数据对应的gamma调整表达式。
在一些实施例中,色度调整参数包括色调旋转角度、饱和度调整系数和色度补偿表;所述基于所述色度调整参数对所述色度数据进行调整,得到调整后的色度数据,包括:
基于所述亮度调整参数,对调整前的亮度数据进行统计,根据统计结果和所述亮度调整参数中的最大需求亮度确定伸缩系数;所述统计结果包括所述调整前的亮度数据中的最小亮度值、最大亮度值和初始平均亮度值;
根据所述色调旋转角度,对所述色度数据进行二维旋转,得到第一色度数据;
根据所述饱和度调整系数和所述伸缩系数,对所述第一色度数据进行转换,得到第二色度数据;及
根据所述色度补偿表,对所述第二色度数据进行色度补偿,得到第三色度数据,并将所述第三色度数据作为调整后的色度数据。
第二方面,本申请提供一种图像增强装置,所述装置包括:
获取模块,用于获取图像调整参数;所述图像调整参数包括亮度调整参数和色度调整参数;
第一转换模块,用于将待处理的第一图像数据转换为第二图像数据;所述第一图像数据和第二图像数据属于不同的颜色维度,且所述第二图像数据包括亮度数据和色度数据;
第一调整模块,用于基于所述亮度调整参数对所述亮度数据进行调整,得到调整后的亮度数据,当调整后的亮度数据不满足预设的亮度增强条件时,更新所述亮度调整参数,并基于更新后的亮度调整参数对调整后的亮度数据继续进行调整,直至最终调整后的亮度数据满足所述亮度增强条件;
第二调整模块,用于基于所述色度调整参数对所述色度数据进行调整,得到调整后的色度数据,当调整后的色度数据不满足预设的色度增强条件时,更新所述色度调整参数,并基于更新后的色度调整参数对调整后的色度数据继续进行调整,直至最终调整后的色度数据满足所述色度增强条件;及
第二转换模块,用于对满足所述亮度增强条件的亮度数据和满足所述色度增强条件的色度数据,进行图像颜色维度转换,得到与所述第一图像数据所属颜色维度相同的第三图像数据,将所述第三图像数据作为所述第一图像数据经过图像增强处理的结果。
在一些实施例中,所述第一调整模块,还用于基于所述亮度调整参数,对调整前的亮度数据进行统计,根据统计结果和所述亮度调整参数中的最大需求亮度确定伸缩系数;所述统计结果包括所述调整前的亮度数据中的最小亮度值、最大亮度值和初始平均亮度值;根据所述伸缩系数,对所述第二图像数据中的亮度数据进行亮度线性伸缩处理,得到经过亮度线性伸缩处理后的亮度数据,并根据经过亮度线性伸缩处理后的亮度数据确定伸缩平均亮度值; 根据所述伸缩平均亮度值,确定所述第二图像数据中待进行亮度调整的至少一个目标区间;确定与所述第二图像数据相匹配的自适应亮度调整方式;及基于相匹配的自适应亮度调整方式,对所述至少一个目标区间中的亮度数据进行调节,得到调整后的亮度数据。
在一些实施例中,所述第一调整模块,还用于基于所述伸缩平均亮度值,将经过亮度线性伸缩处理后的亮度数据分为第一亮度数据集合和第二亮度数据集合;从所述第一亮度数据集合中筛选得到出现频率最高的第一目标亮度值,并从所述第二亮度数据集合中筛选得到出现频率最高的第二目标亮度值;及根据所述第一目标亮度值和第二目标亮度值分别对应的频率值,确定待进行亮度调整的亮度数据对应的目标区间。
在一些实施例中,所述第一调整模块,还用于确定所述第一目标亮度值在所述第一亮度数据集合中出现的第一亮度频率;确定所述第二目标亮度值在所述第二亮度数据集合中出现的第二亮度频率;基于所述第一亮度频率,得到第一亮度数据调整区间;其中,所述第一目标亮度值位于所述第一亮度数据调整区间范围内;基于所述第二亮度频率,得到第二亮度数据调整区间;其中,所述第二目标亮度值位于所述第二亮度数据调整区间范围内;及将所述第一亮度数据调整区间和所述第二亮度数据调整区间,作为所述第二图像数据中待进行亮度调整的目标区间。
在一些实施例中,所述第一调整模块,还用于根据所述第一亮度频率确定暗区左侧中间频率所应的亮度值、以及暗区右侧中间频率所对应的亮度值;其中,暗区的中间频率是所述第一亮度频率的一半频率;及根据所述暗区左侧中间频率所应的亮度值和暗区右侧中间频率所对应的亮度值,从所述第一亮度数据集合中确定第一亮度数据调整区域。
在一些实施例中,所述第一调整模块,还用于根据所述第二亮度频率确定亮区左侧中间频率所应的亮度值、以及亮区右侧中间频率所对应的亮度值;其中,亮区的中间频率是所述第二亮度频率的一半频率;及根据所述亮区左侧中间频率所应的亮度值和亮区右侧中间频率所对应的亮度值,从所述第二亮度数据集合中确定第二亮度数据调整区域。
在一些实施例中,所述第一调整模块,还用于将所述最大需求亮度乘以第一权重得到第一亮度阈值,将所述最大需求亮度乘以第二权重得到第二亮度阈值;所述第一权重小于所述第二权重;及根据所述伸缩平均亮度值、所述第一目标亮度值、第二目标亮度值、所述第一亮度阈值以及第二亮度阈值,从预设的亮度调整方式中确定与所述第二图像数据相匹配的自适应亮度调整方式。
在一些实施例中,所述自适应亮度调整方式包括与所述亮度数据对应的gamma调整表达式,所述装置还包括映射模块,其中:所述映射模块,用于基于所述第一图像数据的灰阶等级,计算每个灰阶等级对应的归一化gamma值,并基于每个灰阶等级对应的归一化gamma值,得到与各灰阶等级相对应的gamma值映射表;以亮度数据和gamma系数作为变量进行双线性插值计算,得到基于所述变量表征的第一插值系数,将数值一与所述第一插值系数的差,作为第二插值系数;将亮度数据变量映射到灰阶空间,基于映射后的亮度数据变量确定第三插值系数,并将数值一与所述第三插值系数间的差,作为第四插值系数;基于第一插值系数、第二插值系数、第三插值系数、第四插值系数,以及与各灰阶等级相对应的gamma值映射表,确定与所述亮度数据对应的gamma近似调整系数;及根据所述gamma近似调整系数和最大亮度,确定与所述亮度数据对应的gamma调整表达式。
在一些实施例中,色度调整参数包括色调旋转角度、饱和度调整系数和色度补偿表,所述第二调整模块,还用于基于所述亮度调整参数,对调整前的亮度数据进行统计,根据统计结果和所述亮度调整参数中的最大需求亮度确定伸缩系数;所述统计结果包括所述调整前的亮度数据中的最小亮度值、最大亮度值和初始平均亮度值;根据所述色调旋转角度,对所述色度数据进行二维旋转,得到第一色度数据;根据所述饱和度调整系数和所述伸缩系数,对所述第一色度数据进行转换,得到第二色度数据;及根据所述色度补偿表,对所述第二色度数据进行色度补偿,得 到第三色度数据,并将所述第三色度数据作为调整后的色度数据。
第三方面,本申请提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:
获取图像调整参数;所述图像调整参数包括亮度调整参数和色度调整参数;
将待处理的第一图像数据转换为第二图像数据;所述第一图像数据和第二图像数据属于不同的颜色维度,且所述第二图像数据包括亮度数据和色度数据;
基于所述亮度调整参数对所述亮度数据进行调整,得到调整后的亮度数据,当调整后的亮度数据不满足预设的亮度增强条件时,更新所述亮度调整参数,并基于更新后的亮度调整参数对调整后亮度数据继续进行调整,直至最终调整后的亮度数据满足所述亮度增强条件;
基于所述色度调整参数对所述色度数据进行调整,得到调整后的色度数据,当调整后的色度数据不满足预设的色度增强条件时,更新所述色度调整参数,并基于更新后的色度调整参数对调整后的色度数据继续进行调整,直至最终调整后的色度数据满足所述色度增强条件;及
对满足所述亮度增强条件的亮度数据和满足所述色度增强条件的色度数据,进行图像颜色维度转换,得到与所述第一图像数据所属颜色维度相同的第三图像数据,将所述第三图像数据作为所述第一图像数据经过图像增强处理的结果。
第四方面,本申请提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:
获取图像调整参数;所述图像调整参数包括亮度调整参数和色度调整参数;
将待处理的第一图像数据转换为第二图像数据;所述第一图像数据和第二图像数据属于不同的颜色维度,且所述第二图像数据包括亮度数据和色度数据;
基于所述亮度调整参数对所述亮度数据进行调整,得到调整后的亮度数据,当调整后的亮度数据不满足预设的亮度增强条件时,更新所述亮度调整参数,并基于更新后的亮度调整参数对调整后的亮度数据继续进行调整,直至最终调整后的亮度数据满足所述亮度增强条件;
基于所述色度调整参数对所述色度数据进行调整,得到调整后的色度数据,当调整后的色度数据不满足预设的色度增强条件时,更新所述色度调整参数,并基于更新后的色度调整参数对调整后的色度数据继续进行调整,直至最终调整后的色度数据满足所述色度增强条件;及
对满足所述亮度增强条件的亮度数据和满足所述色度增强条件的色度数据,进行图像颜色维度转换,得到与所述第一图像数据所属颜色维度相同的第三图像数据,将所述第三图像数据作为所述第一图像数据经过图像增强处理的结果。
第五方面,本申请提供一种计算机程序,包括程序指令,当在计算机设备上执行时,所述程序指令使得所述计算机设备实现上述图像增强方法的步骤。
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征、目的和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更好地描述和说明这里公开的那些实施例和/或示例,可以参考一幅或多幅附图。用于描述附图的附加细节或示例不应当被认为是对所公开的申请、目前描述的实施例和/或示例以及目前理解的这些发明的最佳模式中的任何 一者的范围的限制。
图1为根据一些实施例的图像增强方法的应用环境图;
图2为根据一些实施例的图像增强方法的流程示意图;
图3为根据一些实施例的图像增强步骤的数据流向示意图;
图4为根据一些实施例的图像增强方法的流程示意图;
图5为根据一些实施例的图像增强方法的亮度统计图;
图6为根据一些实施例的图像增强方法的亮度自适应调整函数图;
图7为根据一些实施例的图像增强方法的gamma插值计算示意图;
图8为根据一些实施例的图像增强方法的二维色度数据坐标图;
图9为根据一些实施例的图像增强装置的原理图;
图10为根据一些实施例的图像增强装置的结构框图;
图11为根据一些实施例的计算机设备的内部结构图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请提供的图像增强方法,可以应用于如图1所示的应用环境中。其中,终端102通过网络与服务器104进行通信。终端102和服务器104可单独用于执行本申请中的图像增强方法,终端102和服务器104可协同用于执行本申请中的图像增强方法。以终端102和服务器104可协同用于执行本申请中的图像增强方法为例进行说明,在具体进行图像增强处理时,计算机设备首先获取用于对图像进行调整的亮度调整参数和色度调整参数;然后获取待处理的第一图像数据,将其转换为第二图像数据,第二图像数据包括亮度数据和色度数据,且第一图像数据和第二图像数据属于不同的颜色维度;然后基于亮度调整参数对亮度数据进行调整,直至调整后的亮度数据满足预设的亮度条件;以及,基于色度调整参数对色度数据进行调整,直至调整后的色度数据满足预设的色度条件;最后再对满足亮度增强条件的亮度数据和满足色度增强条件的色度数据,进行图像颜色维度转换,得到颜色维度与第一图像数据相同的第三图像数据,将第三图像数据返回给终端102。
其中,终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备,服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。
在对本申请中的图像增强方法进行描述之前,首先对本申请的实施例中涉及到的部分名词作如下解释:图像调整参数:用于对转换后的图像数据进行处理的参数,一般预设有一定的参数值,可以根据需求进行修改;图像数据:一种颜色维度对应的一种图像中所包含的数据信息,不同的颜色维度对应的图像数据不同;伸缩系数:根据图像数据统计结果计算而来,用于对图像数据进行线性处理;目标区间:基于亮度数据的统计结果得到的亮度数据区间,亮度数据值位于目标区间内的亮度数据需要进行调整。
在一些实施例中,如图2所示,提供了一种图像增强方法,以该方法应用于计算机设备(该计算机设备具体可以是图1中的终端或服务器)为例进行说明,包括以下步骤:
步骤S202,获取图像调整参数;图像调整参数包括亮度调整参数和色度调整参数。
具体来说,计算机设备在对具体的图像数据进行调整之前,首先要获取调整参数。调整参数的参数值可以提前预设,当调整效果不佳时,可以进一步对调整参数进行调整更新,获得新的调整参数并将新的调整参数用于对具体 的图像数据进行再次调整。
步骤S204,将待处理的第一图像数据转换为第二图像数据;第一图像数据和第二图像数据属于不同的颜色维度,且第二图像数据包括亮度数据和色度数据。
具体来说,计算机设备收到需要转换的第一图像数据后,根据所要进行的图像处理动作,将第一图像数据转换为第二图像数据。一般来说,第一图像数据和第二图像数据是不同的颜色维度,本实施例中,第二图像数据中包括第亮度数据和色度数据。在一个具体的实施例中,第一图像数据属于RGB颜色维度,第二图像数据属于YCrCb颜色维度,其中Y代表亮度数据,CrCb代表色度数据。
步骤S206,基于亮度调整参数对亮度数据进行调整,得到调整后的亮度数据,当调整后的亮度数据不满足预设的亮度增强条件时,更新亮度调整参数,并基于更新后的亮度调整参数对调整后的亮度数据继续进行调整,直至最终调整后的亮度数据满足亮度增强条件。
具体来说,计算机设备对第一图像进行转换后,获得对应的亮度数据,然后进一步基于前述图像调整参数中的亮度调整参数对其进行处理,并对处理结果进行判断,确定调整后的亮度数据是否符合预设的亮度增强条件,如果不符合,则对亮度调整参数进行更新调整,然后基于调整后的亮度调整参数,再次对调整后的亮度数据进行调整,直至最终调整后的亮度数据能够满足预设的亮度增强条件。其中,预设的亮度增强条件可以根据第一图像数据的调节需求进行修改,例如将较暗的图像调亮或者将较亮的图像调暗,或者是对亮度不一的图像进行亮度均衡等,本实施例中对此不作具体的限定。
步骤S208,基于色度调整参数对色度数据进行调整,得到调整后的色度数据,当调整后的色度数据不满足预设的色度增强条件时,更新色度调整参数,并基于更新后的色度调整参数对调整后的色度数据继续进行调整,直至最终调整后的色度数据满足色度增强条件。
具体来说,计算机设备获得对应的色度数据后,需要进一步基于前述图像调整参数中的色度调整参数对其进行处理,并对处理结果进行判断,确定调整后的色度数据是否符合预设的色度增强条件,如果不符合,则对色度调整参数进行调整,然后基于调整后的色度调整参数,再次对调整后的色度数据进行调整,直至最终调整后的色度数据能够满足预设的色度增强条件。其中,预设的色度增强条件可以根据第一图像数据的调节需求进行修改,例如将灰暗的图像调成艳丽的色彩,本实施例中对此不作具体的限定。
步骤S210,对满足亮度增强条件的亮度数据和满足色度增强条件的色度数据,进行图像颜色维度转换,得到与第一图像数据所属颜色维度相同的第三图像数据,将第三图像数据作为第一图像数据经过图像增强处理的结果。
具体来说,计算机设备分别对亮度数据和色度数据进行处理后,需要再将处理得到的亮度数据和色度数据对应转换成与第一图像数据格式相同的第三图像数据,这个第三图像数据,即为第一图像数据经过图像增强处理所获得的结果。
上述图像增强方法中,首先获取用于对图像进行调整的亮度调整参数和色度调整参数;将待处理的第一图像数据转换为第二图像数据,第二图像数据包括亮度数据和色度数据,且第一图像数据和第二图像数据属于不同的颜色维度;然后基于亮度调整参数对亮度数据进行调整,直至调整后的亮度数据满足预设的亮度增强条件;以及,基于色度调整参数对色度数据进行调整,直至调整后的色度数据满足预设的色度增强条件;最后再对满足亮度增强条件的亮度数据和满足色度增强条件的色度数据,进行图像颜色维度转换,得到颜色维度与第一图像数据相同的第三图像数据,得到第一图像数据经过图像增强处理的结果。上述方案中,在将第一图像数据转换为第二图像数据后,分别对亮度数据和色度数据进行了参数调整,再将参数调整好了的亮度数据和色度数据转换为与第一图像数据颜色维度相同的第三图像数据,有效克服了第一图像数据转换为第二图像数据进行处理后获得的图像色彩显示差的问题, 使得所获得的第三图像数据在进行亮度处理后仍然能够保持较好的色彩显示效果。
在其中一个实施例中,基于亮度调整参数对亮度数据进行调整,得到调整后的亮度数据,包括:基于亮度调整参数,对亮度数据进行统计,根据统计结果和亮度调整参数中的最大需求亮度确定伸缩系数;统计结果包括亮度数据中的最小亮度值、最大亮度值和初始平均亮度值;根据伸缩系数,对第二图像数据中的亮度数据进行亮度线性伸缩处理,得到经过亮度线性伸缩处理后的亮度数据,并根据经过亮度线性伸缩处理后的亮度数据确定对应的伸缩平均亮度值;根据伸缩平均亮度值,确定第二图像数据中待进行亮度调整的至少一个目标区间;确定与第二图像数据相匹配的自适应亮度调整方式;基于相匹配的自适应亮度调整方式,对至少一个目标区间中的亮度数据进行调节,得到调整后的亮度数据。
具体来说,计算机设备在对亮度数据进行具体调整之前,首先需要对初始状态下的亮度数据进行统计,确定每个亮度值出现的频率,可以确定对应的亮度数据统计表,如图5所示,其中纵坐标代表频率。基于这个统计结果,计算机设备进一步确定了亮度数据中的最小亮度值、最大亮度值和初始平均亮度值,并根据上述最小亮度值、最大亮度值以及初始平均亮度值计算得到对应的伸缩系数。计算机设备基于这个伸缩系数,对每个亮度值一一进行线性伸缩,得到伸缩后的亮度数据,计算伸缩后的亮度数据的平均值,得到伸缩平均亮度值。
进一步地,计算机设备基于伸缩平均亮度值,确定需要进行亮度调整的目标区间,然后确定与之匹配的自适应亮度调整方式,基于这个自适应亮度调整方式,对目标区间内的亮度数据进行调整。需要说明的是,在上述步骤中,对目标区间内的亮度数据进行调整时,调整的对象是已经经过线性伸缩处理的亮度数据。
在上述实施例中,基于亮度数据的统计结果来确定需要进行亮度调整的目标区间,可以明确亮度数据的调整范围以及调整目标,使得亮度调节过程更为精确,所获得的增强图像画质效果更好。
在其中一个实施例中,根据伸缩平均亮度值,确定第二图像数据中待进行亮度调整的至少一个目标区间,包括:基于伸缩平均亮度值,将经过亮度线性伸缩处理后的亮度数据分为第一亮度数据集合和第二亮度数据集合;从第一亮度数据集合中筛选得到出现频率最高的第一目标亮度值,并从第二亮度数据集合中筛选得到出现频率最高的第二目标亮度值;根据第一目标亮度值和第二目标亮度值分别在亮度数据中对应的频率值,确定待进行亮度调整的亮度数据对应的目标区间。
具体来说,如图5所示,伸缩平均亮度值M将伸缩后的亮度数据对应的横坐标分为两个部分,即第一亮度数据集合为亮度数据在0-M范围;第二亮度数据集合为亮度数据大于M范围。进一步地,计算机设备基于图5对应的亮度数据的统计结果,从第一亮度数据集合中筛选得到出现频率最高的第一目标亮度值,以及从第二亮度数据集合中筛选得到出现频率最高的第二目标亮度值。计算机设备基于第一目标亮度值和第二目标亮度值分别对应的频率值,确定亮度数据中待进行亮度调整的目标区间。
如图5所示,计算机设备根据第一目标亮度值对应的频率值的一半确定了对应亮度值MLL(暗区左侧中间频率所对应的亮度值)和MLR(暗区右侧中间频率所对应的亮度值),第一亮度数据集合中的大部分亮度数据都落在了MLL-MLR的区间范围内,由此确定在MLL-MLR范围内的亮度数据是需要进行调整的对象。需要说明的是,本实施例中MLL和MLR对应的频率值,并不一定是第一亮度数据集合最大频率值的一半,基于具体的图像增强需求,可以对这一权重进行具体修改,本实施例不视为对其作出具体的限定。
在上述实施例中,通过伸缩平均亮度值对亮度数据的统计结果进行了分析,从中确定了需要进行亮度调整的目标区间,可以实现对图像数据中的亮度数据进行精确处理,提高了图像亮度增强的质量。
在其中一个实施例中,根据第一目标亮度值和第二目标亮度值分别对应的频率值,确定待进行亮度调整的亮度数据对应的目标区间,包括:确定第一目标亮度值在第一亮度数据集合中出现的第一亮度频率;确定第二目标亮度 值在第二亮度数据集合中对应的第二亮度频率;基于第一亮度频率,得到第一亮度数据调整区间;其中,第一目标亮度位于第一亮度数据调整区间范围内;基于第二亮度频率,得到第二亮度数据调整区间;其中,第二目标亮度位于第二亮度数据调整区间范围内;将第一亮度数据调整区间和第二亮度数据调整区间,作为第二图像数据中待进行亮度调整的目标区间。
在一些实施例中,基于第一亮度频率,得到第一亮度数据调整区间,包括:根据第一亮度频率确定暗区左侧中间频率所应的亮度值、以及暗区右侧中间频率所对应的亮度值;其中,暗区的中间频率是第一亮度频率的一半频率;及根据暗区左侧中间频率所应的亮度值和暗区右侧中间频率所对应的亮度值,从第一亮度数据集合中确定第一亮度数据调整区域。
在一些实施例中,基于第二亮度频率,得到第二亮度数据调整区间,包括:根据第二亮度频率确定亮区左侧中间频率所应的亮度值、以及亮区右侧中间频率所对应的亮度值;其中,亮区的中间频率是所述第二亮度频率的一半频率;及根据亮区左侧中间频率所应的亮度值和亮区右侧中间频率所对应的亮度值,从第二亮度数据集合中确定第二亮度数据调整区域。
具体来说,如图5所示,计算机设备是根据第一目标亮度值对应的频率值,确定了对应亮度值MLL和MLR,从图5可以看出,第一亮度数据集合中的大部分亮度数据都落在了MLL-MLR的区间范围内,由此确定值在MLL-MLR范围内的亮度数据是需要进行调整的对象。类似地,根据第二目标亮度值对应的频率值,确定了第二亮度数据集合中需要进行调整的对象为值在MHL(亮区左侧中间频率所对应的亮度值)-MHR(亮区右侧中间频率所对应的亮度值)范围内的亮度数据。
在上述实施例中,通过亮度数据统计结果,确定了第一亮度数据集合和第二亮度数据集合中亮度数据较为集中的目标区间,通过对目标区间进行调整,可以更好地实现第一图像数据的增强。
在其中一个实施例中,亮度调整参数包括最大需求亮度,确定与第二图像数据相匹配的自适应亮度调整方式,包括:将最大需求亮度乘以第一权重得到第一亮度阈值,将最大需求亮度乘以第二权重得到第二亮度阈值;第一权重小于第二权重;根据伸缩平均亮度值、第一目标亮度值、第二目标亮度值、第一亮度阈值、以及第二亮度阈值,从预设的亮度调整方式中确定与第二图像数据相匹配的自适应亮度调整方式。
具体来说,如图5所示,计算机设备是根据第一目标亮度值对应的频率值的一半确定了对应亮度值MLL和MLR,第一亮度数据集合中的大部分亮度数据都落在了MLL-MLR的区间范围内,由此确定值在MLL-MLR范围内的亮度数据是需要进行调整的对象。类似地,根据第二目标亮度值对应的频率值,确定了第二亮度数据集合中需要进行调整的对象为值在MHL-MHR范围内的亮度数据。需要说明的是,本实施例中MLL和MLR对应的频率值,并不一定是第一亮度数据集合最大频率值的一半,基于具体的图像增强需求,可以对这一权重进行具体修改,本实施例不视为对其作出具体的限定。
其中,预设的亮度调整方式包括有下述实施例中所描述的六种情况,具体可参考下文的描述内容。
在上述实施例中,计算机设备基于第一目标亮度值和第二目标亮度值以及两者对应的频率值,确定了第一亮度数据集合和第二亮度数据集合中亮度数据较为集中的目标区间,通过对目标区间进行调整,可以更好地实现第一图像数据的增强。
在其中一个实施例中,自适应亮度调整方式包括与亮度数据对应的gamma调整表达式,方法还包括预先构建与亮度数据对应的gamma近似表达式的步骤,该步骤具体包括:基于第一图像数据的灰阶等级,计算每个灰阶等级对应的归一化gamma值,并基于每个灰阶等级对应的归一化gamma值,得到与各灰阶等级相对应的gamma值映射表;以亮度数据和gamma系数作为变量进行双线性插值计算,得到基于该变量表征的第一插值系数,将数值一 与第一插值系数的差,作为第二插值系数;将亮度数据变量映射到灰阶空间,基于映射后的亮度数据变量确定第三插值系数,并将数值一与第三插值系数间的差,作为第四插值系数;基于第一插值系数、第二插值系数、第三插值系数、第四插值系数,以及与各灰阶等级相对应的gamma值映射表,确定与亮度数据对应的gamma近似调整系数;根据gamma近似调整系数和最大亮度,确定与亮度数据对应的gamma调整表达式。
具体来说,本实施例中计算机设备基于gamma系数和亮度数据之间的映射关系来实现对亮度数据进行自适应亮度调整。即在进行具体的图像增强处理之前,计算机设备就已经获得了上述映射关系。在一些实施例中,计算机设备可设置gamma系数有界化,其端点列表TS可以表示为{A1、A2、...、An、1、1/An、...、1/A2、1/A1}。进而基于0-255的灰阶等级,对gamma系数归一化,得到对应的gamma值映射表。其中,计算机设备可通过以下公式对gamma系数进行归一化:GT=(x/255) P;其中,GT表示归一化后的gamma系数,x表示灰阶等级(从0到255),P的值依次取TS分段端点列表中的值。这样,将x从0至255代入到上述归一化gamma计算公式,P=1时不用计算,算出其余不同P值在256级灰阶等级中的归一化gamma映射表。
进一步地,计算机设备可以调整前的亮度数据变量y和gamma系数变量J做为双线性插值的变量,并确认J在端点列表TS的某一区间内,即TS[i]≤J≤TS[i+1],i∈[0,2n],可以得到第一插值系数c1和第二插值系数c2:
c1=(J-TS[i])/(TS[i+1]-TS[i]);
c2=1-c1;
进而,计算机设备将y映射到灰阶空间(256空间)得到y’,并设置第三插值系数d1为映射后的亮度数据与该映射后的亮度数据向下取整的值之间的差值;第四插值系数d2为1与第三插值系数d1的差值。其中具体的计算方式,可参考下面的公式:
y'=y×256/I;
Figure PCTCN2022101173-appb-000001
y2=y1+1;d1=y'-y1;d2=1-d1;其中,
Figure PCTCN2022101173-appb-000002
表示向下取整。
接下来,假设GT1表示gm系数等于TS[i]的gamma映射表,GT2表示gm系数等于TS[i+1]的gamma映射表,那么与所述亮度数据对应的gamma近似调整系数:G=GT1[y1]×c2×d2+GT1[y2]×c2×d1+GT2[y1]×c1×d2+GT2[y2]×c1×d1;进而计算设备可将gamma近似调整系数G与最大亮度I的乘积,作为调整后的亮度数据。也就是说,与所述亮度数据对应的gamma调整表达式为:Y=I×G。
在上述实施例中,通过预先得到与亮度数据对应的gamma调整表达式,计算机设备在对亮度数据进行处理的时候,不需要再针对每个亮度数据分别进行gamma系数的计算,可直接根据该gamma调整表达式就能实现对亮度数据的自适应调整,大大节省了计算机设备的计算压力,提高了计算机设备的图像增强处理效率。
在其中一个实施例中,色度调整参数包括色调旋转角度、饱和度调整系数和色度补偿表;基于色度调整参数对色度数据进行调整,得到调整后的色度数据,包括:基于亮度调整参数,对调整前的亮度数据进行统计,根据统计结果和亮度调整参数中的最大需求亮度确定伸缩系数;统计结果包括调整前的亮度数据中的最小亮度值、最大亮度值和初始平均亮度值;根据色调旋转角度,对色度数据进行二维旋转,得到第一色度数据;根据饱和度调整系数和伸缩系数,对第一色度数据进行转换,得到第二色度数据;根据色度补偿表,对第二色度数据进行色度补偿,得到第三色度数据,并将第三色度数据作为调整后的色度数据。
具体来说,在完成亮度数据的调整后,还需要进一步进行色度调整,以保证色度数据在最终得到的增强图像中不会出现色彩失真的情况。本实施例中的色度调整参数包括色调旋转角度、饱和度调整系数和色度补偿表,计算机设备首先基于色调旋转角度对色度数据进行二维旋转得到第一色度数据,然后根据伸缩系数和饱和度调整系数对第 一色度数据进行调整得到第二色度数据,最后基于色度补偿表对第二色度数据进行色度补偿,得到经过色度调整后的色度数据。其中,关于伸缩系数的具体确定方式,可参考前述实施例中的具体描述。
在上述实施例中,通过色调旋转角度、饱和度调整系数和色度补偿表对色度数据进行了具体的色度调整,调整后的色度数据在展示第三图像数据的过程中,可以有效避免第三图像数据颜色失真的问题。
如图3所示,是一个具体的图像增强方法实施例。
本申请的原理是将需要处理的RGB图像数据进行YCrCb转换,取出亮度分量Y再结合外部输入的亮度调整参数进行亮度调整处理,包含亮度线性伸缩和亮度自适应调整,自适应算法采用多段不同系数gamma变换,同时色度分量CrCb也需要根据外部输入的色度调节参数以及内部处理的参数进行调整处理,最后将调整好的YCrCb转换回RGB显示数据。流程如图1所示,预先加载亮度调节参数、色度调节参数、gamma映射表和色度补偿表。当图像数据输入时,先进行RGB转YCrCb,将信息分为两部分,亮度信息Y和色度信息CrCb,对亮度信息进行统计,得到相关数据后进行亮度线性伸缩处理,然后根据统计的数据和预先加载的gamma表进行亮度自适应处理;而色度信息会先进行一个类似色调调整,然后在进行类似饱和度调整,最后根据色度补偿表进行补偿和限制处理;这两部分信息处理完后再进行YCrCb转RGB进行输出显示。
如图9所示,本方案原理实现分成5个模块,“RGB to YCrCb”是RGB色彩转换YCrCb色彩模块,该模块通过将RGB色彩转成YCrCb色彩,各色域转换公式不同,本方案以BT709色域的转换公式为例:
Y=(0.2126×R)+(0.7152×G)+(0.0722×B)
Cr=(0.5×R)-(0.4542×G)-(0.0458×B)
Cb=(0.5×B)-(0.114563×R)-(0.385437×G)
转换后的Y为亮度信息,Cr和Cb称为色度信息。
“Y calc”模块是亮度计算模块,包含亮度统计和亮度线性伸缩,首先在伸缩处理前先获取调整最大需求亮度YMax(YMax=A),然后统计图像的所有亮度,确定伸缩前的最小亮度值Ymin、最大亮度值Ymax以及计算出图像的平均亮度值Ymean,最后对图像进行亮度线性伸缩,使最小亮度调整为0,最大亮度为调整最大需求亮度YMax,伸缩系数K为:
K=YMax/(Ymax-Ymin)
伸缩公式为:
Ylinear=K×(Ycur-Ymin)
式中Ylinear表示线性伸缩后的亮度,Ycur表示伸缩前的亮度。
根据YMax求出低亮图和过亮图的判断阈值,本方案低亮图判断依据是平均亮度低于最大亮度的35%为阈值TH_L,过亮图判断依据是平均亮度高于最大亮度的65%为阈值TH_H,两个阈值的计算公式为:
TH_L=YMax×0.35
TH_H=YMax×0.65
伸缩后的平均亮度M:
M=K×(Ymean-Ymin)
以M为分界,将图像亮度分为亮区和暗区,这两个区每帧图像可能都是不一样的,因为是通过平均亮度区分的,如图3所示,统计各亮度出现频率,在根据统计结果分别找出亮区和暗区出现频率最高的亮度值MH和ML,本方案实施例定义在每个区的出现频率最大点的两侧最远且出现频率大于等于频率最大点的频率值的一半的两个点内的区间为该区域的亮度密集区,如图3所示分别找出距离MH和ML点两侧最远的2个出现频率大于等于MH 和ML点的频率值一半的点MHL、MHR、MLL和MLR,从而确定暗区和亮区内的两个亮度密集区,其中MHL、MHR分别表示距离MH点两侧最远的两个大于等于MH/2的左侧点和右侧点,其中MLL、MLR分别表示距离ML点两侧最远的两个大于等于ML/2的左侧点和右侧点,此四个值用于确定调整的gamma曲线系数,当MH和ML点两侧很窄时,MHR-MHL和MLR-MLL的值就很小,表示有较多的像素亮度集中在MH和ML点附近,那么gamma曲线比较陡,能更好的拉大亮度密集区域的亮度对比度,若MHR-MHL和MLR-MLL的值较大,那么说明亮度分布较为均匀,gamma系数会接近1使gamma曲线比较接近y=x,相当于不做调整,gamma系数的计算会根据不同情况进行计算,通过图3统计的亮度情况,根据亮区和暗区的两个波“陡峭程度”去决定gamma曲线的陡峭程度,拉大亮度密集区的对比度,从而提升图像增强效果,由于亮度分布情况较多,下面会根据M、MH、ML、TH_L和TH_H数值分为6种情况进行处理。
“Y adjust”模块是亮度自适应调整模块,根据M、MH、ML、TH_L和TH_H参数进行亮度自适应调整,TH_L和TH_H两个阈值将整个亮度区间划分为低亮区、普通区和过亮区,如图4所示,分为6种情况,每个子图的横坐标表示自适应调整前的亮度,纵坐标表示自适应调整之后的亮度,每个图的实曲线就表示调整函数。
情况1:
如图6(a)子图所示,当MH≤TH_L时(也就是第二目标亮度值小于等于第一亮度阈值时),表示大部分像素都在低亮区,表明图像太暗,自适应调整曲线分为两段,对图像的低亮区和普通区(0~TH_H区间)进行增亮调整,同时增大亮度密集区的亮度对比度,采用gamma曲线进行调整是避免过增益导致色调偏移,gamma系数值的计算公式为:
gm=(MHR-MLL)/TH_H
亮度调整公式为:
Figure PCTCN2022101173-appb-000003
其中,Yadj表示调整后的亮度数据,TH_H为第二亮度阈值,Ylinear为经过亮度线性伸缩处理后的亮度数据。gm最小值取1/3,gm越小曲线低亮部分越陡,对比度越大,同时图像平均亮度也越大,而高亮区保留伸缩结果。
情况2:
如图6(d)子图所示,当ML≥TH_H时(也就是第一目标亮度值大于等于第二亮度阈值时),表示图像太亮,自适应调整曲线分为两段,对图像的过亮区和普通区(TH_L~YMax区间)进行调暗,采用gamma曲线进行调整,gamma系数值的计算公式为:
gm=(YMax-TH_L)/(MHR-MLL)
亮度调整公式为:
Figure PCTCN2022101173-appb-000004
其中,Yadj表示调整后的亮度数据,Ylinear为经过亮度线性伸缩处理后的亮度数据,YMax为最大需求亮度,TH_L为第一亮度阈值。gm最大值取3,gm越大曲线高亮部分越陡,对比度越大,同时图像平均亮度也越小,而低亮区保留伸缩结果。
情况3:
如图6(b)子图所示,当ML≥TH_L并且MH≤TH_H时(也就是第一目标亮度值大于等于第一亮度阈值,且第二目标亮度值小于等于第二亮度阈值时),表示图像亮度主要集中在普通区,自适应调整曲线分为两段gamma 曲线,0~M区间和M~YMax区间的gamma系数值分别为gmL和gmH,则计算公式为:
gmL=M/(MLR-MLL)
gmH=(MHR-MHL)/(YMax-M)
gmL最大值取3,gmH最小值取1/3。
亮度调整公式为:
Figure PCTCN2022101173-appb-000005
其中,Yadj表示调整后的亮度数据,Ylinear为经过亮度线性伸缩处理后的亮度数据,M为伸缩平均亮度值,YMax为最大需求亮度。
情况4:
如图6(c)子图所示,当ML<TH_L并且MH>TH_H时(也就是第一目标亮度值小于第一亮度阈值,且第二目标亮度值大于第二亮度阈值时),表示图像亮度主要集中在低亮区和过亮区,自适应调整曲线分为两段gamma曲线,0~M区间和M~YMax区间的gamma系数值分别为gmL和gmH,则计算公式为:
gmL=(MLR-MLL)/M
gmH=(YMax-M)/(MHR-MHL)
gmH最大值取3,gmL最小值取1/3。
亮度调整公式为:
Figure PCTCN2022101173-appb-000006
其中,Yadj表示调整后的亮度数据,M为伸缩平均亮度值,Ylinear为经过亮度线性伸缩处理后的亮度数据,YMax为最大需求亮度。
情况5:
如图6(e)子图所示,当TH_L<ML<TH_H并且MH>TH_H时(也就是第一亮度阈值小于第一目标亮度值,且第一目标亮度值小于第二亮度阈值,并且,第二亮度值大于第二亮度阈值时),表示图像亮度主要集中在低亮区和普通区,自适应调整曲线分为三段gamma曲线,0~ML区间、ML~M区间和M~YMax区间的gamma系数值分别为gmL、gmN和gmH,则计算公式为:
gmL=M/(MLR-MLL)
gmN=(M-ML)/(YMax-TH_L)
gmH=(YMax-M)/(MHR-MHL)
gmL最大值取3,gmN最小值取1/3,gmH最大值取3。
亮度调整公式为:
Figure PCTCN2022101173-appb-000007
其中,Yadj表示调整后的亮度数据,ML为第一目标亮度值,Ylinear为经过亮度线性伸缩处理后的亮度数据,M为伸缩平均亮度值,YMax为最大需求亮度。
情况6:
如图6(f)子图所示,当ML<TH_L并且TH_L<MH<TH_H时(也就是第一目标亮度值小于第一亮度阈值,并且,第一亮度阈值小于第二目标亮度值,且第二目标亮度值小于第二亮度阈值时),表示图像亮度主要集中在低亮区和普通区,自适应调整曲线分为三段gamma曲线,0~M区间、M~MH区间和MH~YMax区间的gamma系数值分别为gmL、gmN和gmH,则计算公式为:
gmL=(MLR-MLL)/M
gmN=(MH-M)/TH_H
gmH=(YMax-M)/(MHR-MHL)
gmL最大值取3,gmN最小值取1/3,gmH最大值取3。
亮度调整公式为:
Figure PCTCN2022101173-appb-000008
其中,Yadj表示调整后的亮度数据,M为伸缩平均亮度值,MH为第二目标亮度值,Ylinear为经过亮度线性伸缩处理后的亮度数据,YMax为最大需求亮度。
上述6种情况包含了暗图调亮、过亮图调暗以及亮度不均图调均衡的自适应调整,都采用不定系数值的gamma运算,gamma运算表达式可简化为:
Y=I×(y/I) J
式中Y为gamma调整后的亮度,y为调整前的亮度,I为最大亮度,J为gamma系数,即上述6种情况公式中的gm、gmL、gmN和gmH,本方案实施例中为了调整效果将gamma系数J限制在[1/3,3]闭区间内。
gamma运算不管是硬件实现还是软件实现,其效率都比较低,常用方法都是牺牲内存将固定gamma系数的gamma运算结果存储起来,需要时直接读取出来,本申请中的gamma系数是通过计算出来的属于不定值,即无法做到通过牺牲内存的将所有的gamma值都计算好存储起来,所以为了避免直接gamma运算,本申请提出一种提高效率的近似算法,通过预先算好多个不同系数归一化的gamma映射表和双线性插值计算得到近似结果,具体的,首先将gamma系数‘有界化’,即对gamma的最大最小做出限制,否则无法进行分段;然后对gamma系数所在区间进行分段,若gamma系数跨越1,最好将gamma分成两个区,调亮区(0,1)和调暗区(1,+∞),gamma的分段在两个区对称,即一个区间内取值为a,则另一个区间取值为1/a,这样的取值分段方法是因为这样的两个系数的gamma曲线以y=x直线成对称关系,使调亮和调暗达到的变化率一致,同时‘有界化’也可以参考该方法进行限制左右边界,以该方法分段的端点列表TS可以表示为{A1、A2、...、An、1、1/An、...、1/A2、1/A1};接着令x从0到255,P的值依次取分段端点列表中的值,归一化gamma公式:
GT=(x/255) P
代入归一化gamma计算公式,P=1时不用计算,算出其余2n个256级的归一化gamma映射表。
最后如图7所示,以亮度y和gamma系数J做为双线性插值的变量,确认J在TS某一区间内,即TS[i]≤J≤TS[i+1],i∈[0,2n],可以算出插值系数c1和c2:
c1=(J-TS[i])/(TS[i+1]-TS[i])
c2=1-c1
将y映射到256空间的值y’,以及另外两个插值系数d1和d2:
y'=y×256/I
Figure PCTCN2022101173-appb-000009
y2=y1+1
d1=y'-y1
d2=1-d1
Figure PCTCN2022101173-appb-000010
表示向下取整,假设GT1表示gm系数等于TS[i]的gamma映射表,GT2表示gm系数等于TS[i+1]的gamma映射表,那么y的gamma近似值Y为:
G=GT1[y1]×c2×d2+GT1[y2]×c2×d1+GT2[y1]×c1×d2+GT2[y2]×c1×d1
Y=I×G
该近似值的精确度与gamma表的等级、gm系数分段区间大小以及式中y所在位置有关,上述6种情况中说明了本方案实施例的gm系数限制在[1/3,3]闭区间内,分成8段,分段的端点列表TS为{1/3、2/5、1/2、2/3、1、3/2、2、5/2、3}的9个不同gamma系数的映射表,由于gm=1时gamma曲线属于线性函数可以不用制作映射表,对其余8个系数做出256个等级gamma映射表即可。
如图9所示,“Color adjust”模块是色度调整,即对CrCb的调整,虽然YCrCb将亮度Y和色度CrCb完全分离,但是如果只调整Y分量很可能会出现色调偏移,本方案参照HSV色彩空间的处理模式,增加了近似色调旋转的功能,对CrCb分量进行E角度的二维旋转,这种转换近似HSV的色调H旋转,这种方式比RGB和HSV相互转换要效率,方便电路实现,其近似转换公式如下:
Cr1=Cr×sinE+Cb×cosE
Cb1=Cb×sinE+Cr×cosE
从转换公式可以看出,在不需要色彩旋转时设置sinE=1,cosE=0即可。
上述是近似色调调整,下面是近似HSV饱和度调整,对CrCb的同比调整,调整公式为:
Cr2=K×(Cr1+K1×f(Cr1))
Cb2=K×(Cb1+K1×f(Cb1))
其中K为亮度的伸缩系数,由前面“Y calc”模块计算得到,K1为外部输入的色彩饱和度调整系数,默认为1;如图8所示,色彩为256灰阶等级的CrCb的取值范围是-128到128,f(x)表示同一个RGB色彩值在HSV色彩空间与YCrCb色彩空间的饱和度差异,同时也是避免旋转处理结果Cr1和Cb1越界,而做的补偿值映射表,由实际测量采集得到。
“YCrCb to RGB”模块是YCrCb色彩转换RGB色彩模块,将自适应调整好的YCrCb色彩转换成RGB色彩,可以直接输出给外部显示设备进行显示。
上述过程中的将RGB转换YCrCb再调整CrCb的方案比传统的RGB转换HSV转换方案既兼顾了色彩效果又提高了29%的转换效率。且进一步提出了一种多段可变系数gamma曲线自适应调节方法能够很好调节灰度密集区的对比度提升图像增强效果。这些可变的gamma系数是通过预先算好多个不同系数gamma映射表和双线性插值算法替换而来的,进一步提高了图像增强过程中的计算机设备运算效率。
应该理解的是,虽然图2和4的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2和4中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然 是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。
在一些实施例中,如图10所示,提供了一种图像增强装置1000,包括:获取模块1002,第一转换模块1004,第一调整模块1006,第二调整模块1008,和第二转换模块1010,其中:
获取模块1002,用于获取图像调整参数;图像调整参数包括亮度调整参数和色度调整参数。
第一转换模块1004,用于将待处理的第一图像数据转换为第二图像数据;第一图像数据和第二图像数据属于不同的颜色维度,且第二图像数据包括亮度数据和色度数据。
第一调整模块1006,用于基于亮度调整参数对亮度数据进行调整,得到调整后的亮度数据,当调整后的亮度数据不满足预设的亮度增强条件时,更新亮度调整参数,并基于更新后的亮度调整参数对调整后的亮度数据继续进行调整,直至最终调整后的亮度数据满足亮度增强条件。
第二调整模块1008,用于基于色度调整参数对色度数据进行调整,得到调整后的色度数据,当调整后的色度数据不满足预设的色度增强条件时,更新色度调整参数,并基于更新后的色度调整参数对调整后的色度数据继续进行调整,直至最终调整后的色度数据满足色度增强条件。
第二转换模块1010,用于对满足亮度增强条件的亮度数据和满足色度增强条件的色度数据,进行图像颜色维度转换,得到与第一图像数据所属颜色维度相同的第三图像数据,将第三图像数据作为第一图像数据经过图像增强处理的结果。
上述图像增强装置中,首先获取用于对图像进行调整的亮度调整参数和色度调整参数;将待处理的第一图像数据转换为第二图像数据,第二图像数据包括亮度数据和色度数据,且第一图像数据和第二图像数据属于不同的颜色维度;然后基于亮度调整参数对亮度数据进行调整,直至调整后的亮度数据满足预设的亮度增强条件;以及,基于色度调整参数对色度数据进行调整,直至调整后的色度数据满足预设的色度增强条件;最后再对满足亮度增强条件的亮度数据和满足色度增强条件的色度数据,进行图像颜色维度转换,得到颜色维度与第一图像数据相同的第三图像数据,得到第一图像数据经过图像增强处理的结果。上述方案中,在将第一图像数据转换为第二图像数据后,分别对亮度数据和色度数据进行了参数调整,再将参数调整好了的亮度数据和色度数据转换为颜色维度与第一图像数据相同的读三图像数据,有效克服了第一图像数据转换为第二图像数据进行处理后获得的图像色彩显示差的问题,使得所获得的第三图像数据在进行亮度处理后仍然能够保持较好的色彩显示效果。
在一些实施例中,上述第一调整模块,还用于:基于亮度调整参数,对调整前的亮度数据进行统计,根据统计结果和亮度调整参数中的最大需求亮度确定伸缩系数;统计结果包括调整前的亮度数据中的最小亮度值、最大亮度值和初始平均亮度值;根据伸缩系数,对第二图像数据中的亮度数据进行亮度线性伸缩处理,得到经过亮度线性伸缩处理后的亮度数据,并根据经过亮度线性伸缩处理后的亮度数据确定伸缩平均亮度值;根据伸缩平均亮度值,确定第二图像数据中待进行亮度调整的至少一个目标区间;确定与第二图像数据相匹配的自适应亮度调整方式;基于相匹配的自适应亮度调整方式,对至少一个目标区间中的亮度数据进行调节,得到调整后的亮度数据。
在上述实施例中,基于亮度数据的统计结果来确定需要进行调节的目标区间,可以明确亮度数据的调整范围以及调整目标,使得亮度调节过程更为精确,所获得的增强图像画质效果更好。
在一些实施例中,上述第一调整模块,还用于:基于伸缩平均亮度值,将经过亮度线性伸缩处理后的亮度数据分为第一亮度数据集合和第二亮度数据集合;从第一亮度数据集合中筛选得到出现频率最高的第一目标亮度值,并从第二亮度数据集合中筛选得到出现频率最高的第二目标亮度值;根据第一目标亮度值和第二目标亮度值分别对应的频率值,确定待进行亮度调整的亮度数据对应的目标区间。
在上述实施例中,通过伸缩平均亮度对亮度数据的统计结果进行了分析,从中确定了需要进行亮度调整的目标区间,可以实现对图像数据中的亮度数据进行精确处理,提高了图像亮度增强的质量。
在一些实施例中,上述第一调整模块,还用于:确定第一目标亮度值在第一亮度数据集合中出现的第一亮度频率;确定第二目标亮度值在第二亮度数据集合中出现的第二亮度频率;基于统计结果和第一亮度频率,得到第一亮度数据调整区间;其中,第一目标亮度值位于第一亮度数据调整区间范围内;基于统计结果和第二亮度频率,得到第二亮度数据调整区间;其中,第二目标亮度值位于第二亮度数据调整区间范围内;将第一亮度数据调整区间和第二亮度数据调整区间,作为第二图像数据中待进行亮度调整的目标区间。
在一些实施例中,所述第一调整模块,还用于根据所述统计结果和所述第一亮度频率确定暗区左侧中间频率所应的亮度值、以及暗区右侧中间频率所对应的亮度值;其中,暗区的中间频率是所述第一亮度频率的一半频率;及根据所述暗区左侧中间频率所应的亮度值和暗区右侧中间频率所对应的亮度值,确定第一亮度数据调整区域。
在一些实施例中,所述第一调整模块,还用于根据所述统计结果和所述第二亮度频率确定亮区左侧中间频率所应的亮度值、以及亮区右侧中间频率所对应的亮度值;其中,亮区的中间频率是所述第二亮度频率的一半频率;及根据所述亮区左侧中间频率所应的亮度值和亮区右侧中间频率所对应的亮度值,确定第二亮度数据调整区域。
在上述实施例中,通过亮度数据统计结果,确定了第一亮度数据集合和第二亮度数据集合中亮度数据较为集中的目标区间,通过对目标区间进行调整,可以更好地实现第一图像数据的增强。
在一些实施例中,亮度调整参数包括最大需求亮度,上述第一调整模块,还用于:将最大需求亮度乘以第一权重得到第一亮度阈值,将最大需求亮度乘以第二权重得到第二亮度阈值;第一权重小于第二权重;根据伸缩平均亮度值、第一目标亮度值、第二目标亮度值、第一亮度阈值、第二亮度阈值,从预设的亮度调整方式中确定与第二图像数据相匹配的自适应亮度调整方式。
在上述实施例中,计算机设备基于第一目标亮度值和第一目标亮度值以及两者对应的频率值,确定了第一亮度数据集合和第二亮度数据集合中亮度数据较为集中的目标区间,通过对目标区间进行调整,可以更好地实现第一图像数据的增强。
在一些实施例中,装置还包括映射模块,映射模块用于:基于第一图像数据的灰阶等级,计算每个灰阶等级对应的归一化gamma值,并基于每个灰阶等级对应的归一化gamma值,得到与各灰阶等级相对应的gamma值映射表;以亮度数据和gamma系数作为变量进行双线性插值计算,得到基于变量表征的第一插值系数,将数值一与第一插值系数的差,作为第二插值系数;将亮度数据变量映射到灰阶空间,基于映射后的亮度数据变量确定第三插值系数,并将数值一与第三插值系数间的差,作为第四插值系数;基于第一插值系数、第二插值系数、第三插值系数、第四插值系数,以及与各灰阶等级相对应的gamma值映射表,确定与亮度数据对应的gamma近似调整系数;根据gamma近似调整系数和最大亮度,确定与亮度数据对应的gamma调整表达式。
在上述实施例中,通过预先得到与亮度数据对应的gamma调整表达式,计算机设备在对亮度数据进行处理的时候,不需要再针对每个亮度数据分别进行gamma系数的计算,可直接根据该gamma调整表达式就能实现对亮度数据的自适应调整,大大节省了计算机设备的计算压力,提高了计算机设备的图像增强处理效率。
在一些实施例中,色度调整参数包括色调旋转角度、饱和度调整系数和色度补偿表;上述第二调整模块,还用于:基于亮度调整参数,对调整前的亮度数据进行统计,根据统计结果和亮度调整参数中的最大需求亮度确定对应的伸缩系数;统计结果包括调整前的亮度数据中的最小亮度值、最大亮度值和初始平均亮度值;根据色调旋转角度,对色度数据进行二维旋转,得到第一色度数据;根据饱和度调整系数和伸缩系数,对第一色度数据进行转换,得到第二色度数据;根据色度补偿表,对第二色度数据进行色度补偿,得到第三色度数据,并将第三色度数据作为调整 后的色度数据。
在上述实施例中,通过色调旋转角度、饱和度调整系数和色度补偿表对色度数据进行了具体的色度调整,调整后的色度数据在展示第三图像数据的过程中,可以有效避免第三图像数据颜色失真的问题。
关于图像增强装置的具体限定可以参见上文中对于图像增强方法的限定,在此不再赘述。上述图像增强装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一些实施例中,提供了一种计算机设备,该计算机设备可以是服务器或终端,其内部结构图可以如图11所示。该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储图像增强数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种图像增强方法。
本领域技术人员可以理解,图11中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在一些实施例中,还提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现上述各方法实施例中的步骤。
在一些实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述各方法实施例中的步骤。
在一些实施例中,提供了一种计算机程序,包括程序指令,当在计算机设备上执行时,所述程序指令使得所述计算机设备实现上述各方法实施例中的步骤。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存或光存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (21)

  1. 一种图像增强方法,由计算机设备执行,所述方法包括:
    获取图像调整参数;所述图像调整参数包括亮度调整参数和色度调整参数;
    将待处理的第一图像数据转换为第二图像数据;所述第一图像数据和第二图像数据属于不同的颜色维度,且所述第二图像数据包括亮度数据和色度数据;
    基于所述亮度调整参数对所述亮度数据进行调整,得到调整后的亮度数据,当调整后的亮度数据不满足预设的亮度增强条件时,更新所述亮度调整参数,并基于更新后的亮度调整参数对调整后的亮度数据继续进行调整,直至最终调整后的亮度数据满足所述亮度增强条件;
    基于所述色度调整参数对所述色度数据进行调整,得到调整后的色度数据,当调整后的色度数据不满足预设的色度增强条件时,更新所述色度调整参数,并基于更新后的色度调整参数对调整后的色度数据继续进行调整,直至最终调整后的色度数据满足所述色度增强条件;及
    对满足所述亮度增强条件的亮度数据和满足所述色度增强条件的色度数据,进行图像颜色维度转换,得到与所述第一图像数据所属颜色维度相同的第三图像数据,将所述第三图像数据作为所述第一图像数据经过图像增强处理的结果。
  2. 根据权利要求1所述的方法,其特征在于,所述基于所述亮度调整参数对所述亮度数据进行调整,得到调整后的亮度数据,包括:
    基于所述亮度调整参数,对调整前的亮度数据进行统计,根据统计结果和所述亮度调整参数中的最大需求亮度确定伸缩系数;所述统计结果包括所述调整前的亮度数据中的最小亮度值、最大亮度值和初始平均亮度值;
    根据所述伸缩系数,对所述第二图像数据中的亮度数据进行亮度线性伸缩处理,得到经过亮度线性伸缩处理后的亮度数据,并根据经过亮度线性伸缩处理后的亮度数据确定伸缩平均亮度值;
    根据所述伸缩平均亮度值,确定所述第二图像数据中待进行亮度调整的至少一个目标区间;
    确定与所述第二图像数据相匹配的自适应亮度调整方式;及
    基于相匹配的自适应亮度调整方式,对所述至少一个目标区间中的亮度数据进行调节,得到调整后的亮度数据。
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述伸缩平均亮度值,确定所述第二图像数据中待进行亮度调整的至少一个目标区间,包括:
    基于所述伸缩平均亮度值,将经过亮度线性伸缩处理后的亮度数据分为第一亮度数据集合和第二亮度数据集合;
    从所述第一亮度数据集合中筛选得到出现频率最高的第一目标亮度值,并从所述第二亮度数据集合中筛选得到出现频率最高的第二目标亮度值;及
    根据所述第一目标亮度值和第二目标亮度值分别对应的频率值,确定待进行亮度调整的亮度数据对应的目标区间。
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述第一目标亮度值和第二目标亮度值分别对应的频率值,确定待进行亮度调整的亮度数据对应的目标区间,包括:
    确定所述第一目标亮度值在所述第一亮度数据集合中出现的第一亮度频率;
    确定所述第二目标亮度值在所述第二亮度数据集合中出现的第二亮度频率;
    基于所述第一亮度频率,得到第一亮度数据调整区间;其中,所述第一目标亮度值位于所述第一亮度数据调整区间范围内;
    基于所述第二亮度频率,得到第二亮度数据调整区间;其中,所述第二目标亮度值位于所述第二亮度数据调整区间范围内;及
    将所述第一亮度数据调整区间和所述第二亮度数据调整区间,作为所述第二图像数据中待进行亮度调整的目标区间。
  5. 根据权利要求4所述的方法,其特征在于,所述基于所述第一亮度频率,得到第一亮度数据调整区间,包括:
    根据所述第一亮度频率确定暗区左侧中间频率所应的亮度值、以及暗区右侧中间频率所对应的亮度值;其中,暗区的中间频率是所述第一亮度频率的一半频率;及
    根据所述暗区左侧中间频率所应的亮度值和暗区右侧中间频率所对应的亮度值,从所述第一亮度数据集合中确定第一亮度数据调整区域。
  6. 根据权利要求4所述的方法,其特征在于,所述基于所述第二亮度频率,得到第二亮度数据调整区间,包括:
    根据所述第二亮度频率确定亮区左侧中间频率所应的亮度值、以及亮区右侧中间频率所对应的亮度值;其中,亮区的中间频率是所述第二亮度频率的一半频率;及
    根据所述亮区左侧中间频率所应的亮度值和亮区右侧中间频率所对应的亮度值,从所述第二亮度数据集合中确定第二亮度数据调整区域。
  7. 根据权利要求3所述的方法,其特征在于,所述亮度调整参数包括最大需求亮度,所述确定与所述第二图像数据相匹配的自适应亮度调整方式,包括:
    将所述最大需求亮度乘以第一权重得到第一亮度阈值,将所述最大需求亮度乘以第二权重得到第二亮度阈值;所述第一权重小于所述第二权重;及
    根据所述伸缩平均亮度值、所述第一目标亮度值、第二目标亮度值、所述第一亮度阈值以及第二亮度阈值,从预设的亮度调整方式中确定与所述第二图像数据相匹配的自适应亮度调整方式。
  8. 根据权利要求7所述的方法,其特征在于,所述自适应亮度调整方式包括与所述亮度数据对应的gamma调整表达式,所述方法还包括:
    基于所述第一图像数据的灰阶等级,计算每个灰阶等级对应的归一化gamma值,并基于每个灰阶等级对应的归一化gamma值,得到与各灰阶等级相对应的gamma值映射表;
    以亮度数据和gamma系数作为变量进行双线性插值计算,得到基于所述变量表征的第一插值系数,将数值一与所述第一插值系数的差,作为第二插值系数;
    将亮度数据变量映射到灰阶空间,基于映射后的亮度数据变量确定第三插值系数,并将数值一与所述第三插值系数间的差,作为第四插值系数;
    基于第一插值系数、第二插值系数、第三插值系数、第四插值系数,以及与各灰阶等级相对应的gamma值映射表,确定与所述亮度数据对应的gamma近似调整系数;及
    根据所述gamma近似调整系数和最大亮度,确定与所述亮度数据对应的gamma调整表达式。
  9. 根据权利要求1所述的方法,其特征在于,所述色度调整参数包括色调旋转角度、饱和度调整系数和色度补偿表;所述基于所述色度调整参数对所述色度数据进行调整,得到调整后的色度数据,包括:
    基于所述亮度调整参数,对调整前的亮度数据进行统计,根据统计结果和所述亮度调整参数中的最大需求亮度确定伸缩系数;所述统计结果包括所述调整前的亮度数据中的最小亮度值、最大亮度值和初始平均亮度值;
    根据所述色调旋转角度,对所述色度数据进行二维旋转,得到第一色度数据;
    根据所述饱和度调整系数和所述伸缩系数,对所述第一色度数据进行转换,得到第二色度数据;及
    根据所述色度补偿表,对所述第二色度数据进行色度补偿,得到第三色度数据,并将所述第三色度数据作为调整后的色度数据。
  10. 一种图像增强装置,其特征在于,所述装置包括:
    获取模块,用于获取图像调整参数;所述图像调整参数包括亮度调整参数和色度调整参数;
    第一转换模块,用于将待处理的第一图像数据转换为第二图像数据;所述第一图像数据和第二图像数据属于不同的颜色维度,且所述第二图像数据包括亮度数据和色度数据;
    第一调整模块,用于基于所述亮度调整参数对所述亮度数据进行调整,得到调整后的亮度数据,当调整后的亮度数据不满足预设的亮度增强条件时,更新所述亮度调整参数,并基于更新后的亮度调整参数对调整后的亮度数据继续进行调整,直至最终调整后的亮度数据满足所述亮度增强条件;
    第二调整模块,用于基于所述色度调整参数对所述色度数据进行调整,得到调整后的色度数据,当调整后的色度数据不满足预设的色度增强条件时,更新所述色度调整参数,并基于更新后的色度调整参数对调整后的色度数据继续进行调整,直至最终调整后的色度数据满足所述色度增强条件;及
    第二转换模块,用于对满足所述亮度增强条件的亮度数据和满足所述色度增强条件的色度数据,进行图像颜色维度转换,得到与所述第一图像数据所属颜色维度相同的第三图像数据,将所述第三图像数据作为所述第一图像数据经过图像增强处理的结果。
  11. 根据权利要求10所述的装置,其特征在于,所述第一调整模块,还用于基于所述亮度调整参数,对调整前的亮度数据进行统计,根据统计结果和所述亮度调整参数中的最大需求亮度确定伸缩系数;所述统计结果包括所述调整前的亮度数据中的最小亮度值、最大亮度值和初始平均亮度值;根据所述伸缩系数,对所述第二图像数据中的亮度数据进行亮度线性伸缩处理,得到经过亮度线性伸缩处理后的亮度数据,并根据经过亮度线性伸缩处理后的亮度数据确定伸缩平均亮度值;根据所述伸缩平均亮度值,确定所述第二图像数据中待进行亮度调整的至少一个目标区间;确定与所述第二图像数据相匹配的自适应亮度调整方式;及基于相匹配的自适应亮度调整方式,对所述至少一个目标区间中的亮度数据进行调节,得到调整后的亮度数据。
  12. 根据权利要求11所述的装置,其特征在于,所述第一调整模块,还用于基于所述伸缩平均亮度值,将经过亮度线性伸缩处理后的亮度数据分为第一亮度数据集合和第二亮度数据集合;从所述第一亮度数据集合中筛选得到出现频率最高的第一目标亮度值,并从所述第二亮度数据集合中筛选得到出现频率最高的第二目标亮度值;及根据所述第一目标亮度值和第二目标亮度值分别对应的频率值,确定待进行亮度调整的亮度数据对应的目标区间。
  13. 根据权利要求12所述的装置,其特征在于,所述第一调整模块,还用于确定所述第一目标亮度值在所述第一亮度数据集合中出现的第一亮度频率;确定所述第二目标亮度值在所述第二亮度数据集合中出现的第二亮度频率;基于所述第一亮度频率,得到第一亮度数据调整区间;其中,所述第一目标亮度值位于所述第一亮度数据调整区间范围内;基于所述第二亮度频率,得到第二亮度数据调整区间;其中,所述第二目标亮度值位于所述第二亮度数据调整区间范围内;及将所述第一亮度数据调整区间和所述第二亮度数据调整区间,作为所述第二图像数据中待进行亮度调整的目标区间。
  14. 根据权利要求13所述的装置,其特征在于,所述第一调整模块,还用于根据所述第一亮度频率确定暗区左侧中间频率所应的亮度值、以及暗区右侧中间频率所对应的亮度值;其中,暗区的中间频率是所述第一亮度频率的一半频率;及根据所述暗区左侧中间频率所应的亮度值和暗区右侧中间频率所对应的亮度值,从所述第一亮度数 据集合中确定第一亮度数据调整区域。
  15. 根据权利要求13所述的装置,其特征在于,所述第一调整模块,还用于根据所述第二亮度频率确定亮区左侧中间频率所应的亮度值、以及亮区右侧中间频率所对应的亮度值;其中,亮区的中间频率是所述第二亮度频率的一半频率;及根据所述亮区左侧中间频率所应的亮度值和亮区右侧中间频率所对应的亮度值,从所述第二亮度数据集合中确定第二亮度数据调整区域。
  16. 根据权利要求12所述的装置,其特征在于,所述第一调整模块,还用于将所述最大需求亮度乘以第一权重得到第一亮度阈值,将所述最大需求亮度乘以第二权重得到第二亮度阈值;所述第一权重小于所述第二权重;及根据所述伸缩平均亮度值、所述第一目标亮度值、第二目标亮度值、所述第一亮度阈值以及第二亮度阈值,从预设的亮度调整方式中确定与所述第二图像数据相匹配的自适应亮度调整方式。
  17. 根据权利要求16所述的装置,其特征在于,所述自适应亮度调整方式包括与所述亮度数据对应的gamma调整表达式,所述装置还包括映射模块,其中:所述映射模块,用于基于所述第一图像数据的灰阶等级,计算每个灰阶等级对应的归一化gamma值,并基于每个灰阶等级对应的归一化gamma值,得到与各灰阶等级相对应的gamma值映射表;以亮度数据和gamma系数作为变量进行双线性插值计算,得到基于所述变量表征的第一插值系数,将数值一与所述第一插值系数的差,作为第二插值系数;将亮度数据变量映射到灰阶空间,基于映射后的亮度数据变量确定第三插值系数,并将数值一与所述第三插值系数间的差,作为第四插值系数;基于第一插值系数、第二插值系数、第三插值系数、第四插值系数,以及与各灰阶等级相对应的gamma值映射表,确定与所述亮度数据对应的gamma近似调整系数;及根据所述gamma近似调整系数和最大亮度,确定与所述亮度数据对应的gamma调整表达式。
  18. 根据权利要求10所述的装置,其特征在于,色度调整参数包括色调旋转角度、饱和度调整系数和色度补偿表,所述第二调整模块,还用于基于所述亮度调整参数,对调整前的亮度数据进行统计,根据统计结果和所述亮度调整参数中的最大需求亮度确定伸缩系数;所述统计结果包括所述调整前的亮度数据中的最小亮度值、最大亮度值和初始平均亮度值;根据所述色调旋转角度,对所述色度数据进行二维旋转,得到第一色度数据;根据所述饱和度调整系数和所述伸缩系数,对所述第一色度数据进行转换,得到第二色度数据;及根据所述色度补偿表,对所述第二色度数据进行色度补偿,得到第三色度数据,并将所述第三色度数据作为调整后的色度数据。
  19. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至9中任一项所述的方法的步骤。
  20. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至9中任一项所述的方法的步骤。
  21. 一种计算机程序,包括程序指令,当在计算机设备上执行时,所述程序指令使得所述计算机设备实现根据权利要求1至9中任一项所述的方法的步骤。
PCT/CN2022/101173 2021-07-13 2022-06-24 一种图像增强方法、装置、计算机设备和存储介质 WO2023284528A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110791702.6 2021-07-13
CN202110791702.6A CN113643651B (zh) 2021-07-13 2021-07-13 一种图像增强方法、装置、计算机设备和存储介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/412,379 Continuation US20240161452A1 (en) 2021-07-13 2024-01-12 Image enhancement method, device, and computer program

Publications (1)

Publication Number Publication Date
WO2023284528A1 true WO2023284528A1 (zh) 2023-01-19

Family

ID=78417302

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/101173 WO2023284528A1 (zh) 2021-07-13 2022-06-24 一种图像增强方法、装置、计算机设备和存储介质

Country Status (2)

Country Link
CN (1) CN113643651B (zh)
WO (1) WO2023284528A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113643651B (zh) * 2021-07-13 2022-08-09 深圳市洲明科技股份有限公司 一种图像增强方法、装置、计算机设备和存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779330A (zh) * 2012-06-13 2012-11-14 京东方科技集团股份有限公司 图像增强方法、图像增强装置和显示装置
CN105205792A (zh) * 2015-09-18 2015-12-30 天津大学 一种基于亮度色度分离的水下图像增强方法
CN109658341A (zh) * 2018-10-26 2019-04-19 深圳市华星光电技术有限公司 增强图像对比度的方法及其装置
CN111899182A (zh) * 2019-05-06 2020-11-06 浙江宇视科技有限公司 颜色增强方法及装置
CN112330564A (zh) * 2020-11-11 2021-02-05 海宁奕斯伟集成电路设计有限公司 图像处理方法、装置、电子设备以及可读存储介质
KR102261532B1 (ko) * 2020-05-29 2021-06-04 동아대학교 산학협력단 단일 스케일 영상 융합에 기반한 안개 제거 시스템 및 방법
CN113643651A (zh) * 2021-07-13 2021-11-12 深圳市洲明科技股份有限公司 一种图像增强方法、装置、计算机设备和存储介质

Family Cites Families (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE3629469C2 (de) * 1986-08-29 1994-10-06 Agfa Gevaert Ag Verfahren zur Einstellung der Farbsättigung bei der elektronischen Bildverarbeitung
AU2005202791A1 (en) * 2004-07-15 2006-02-02 Canon Kabushiki Kaisha Image brightness adjustment using hyperbolic tone mappings
CN101523480B (zh) * 2006-10-12 2013-06-12 Tp视觉控股有限公司 颜色映射方法
TWI384437B (zh) * 2006-12-18 2013-02-01 Sony Corp An image signal processing device, an image signal processing method, and a computer program product
EP2178075A1 (en) * 2007-11-05 2010-04-21 Hisense Beijing Electric Co. , Ltd. A liquid crystal display method and apparatus
TR200908819A2 (tr) * 2009-11-20 2011-06-21 Vestel Elektron�K San. Ve T�C. A.�. Belirginliğe dayalı video kontrast iyileştirme metodu.
TW201312531A (zh) * 2011-09-08 2013-03-16 Beyond Innovation Tech Co Ltd 多原色液晶顯示器及其色彩訊號轉換裝置與方法
CN102306378B (zh) * 2011-09-14 2013-02-13 电子科技大学 一种图像增强方法
WO2014027569A1 (ja) * 2012-08-15 2014-02-20 富士フイルム株式会社 表示装置
CN103353982B (zh) * 2013-05-15 2016-03-09 中山大学 一种基于直方图均衡化的色调映射方法
US10366672B2 (en) * 2014-12-11 2019-07-30 Koninklijke Philips N.V. Optimizing high dynamic range images for particular displays
JP2016126307A (ja) * 2015-01-08 2016-07-11 株式会社ジャパンディスプレイ 表示装置及び電子機器
CN105869582B (zh) * 2015-01-20 2018-06-12 敦泰电子股份有限公司 Lcd白平衡实时切换选择的优化方法与系统
JP6614859B2 (ja) * 2015-08-24 2019-12-04 キヤノン株式会社 表示装置、表示装置の制御方法、画像処理装置、プログラム、及び、記録媒体
EP3399497A1 (en) * 2017-05-05 2018-11-07 Koninklijke Philips N.V. Optimizing decoded high dynamic range image saturation
CN108711142B (zh) * 2018-05-22 2020-09-29 深圳市华星光电技术有限公司 图像处理方法及图像处理装置
CN113066020A (zh) * 2021-03-11 2021-07-02 Oppo广东移动通信有限公司 图像处理方法及装置、计算机可读介质和电子设备

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779330A (zh) * 2012-06-13 2012-11-14 京东方科技集团股份有限公司 图像增强方法、图像增强装置和显示装置
CN105205792A (zh) * 2015-09-18 2015-12-30 天津大学 一种基于亮度色度分离的水下图像增强方法
CN109658341A (zh) * 2018-10-26 2019-04-19 深圳市华星光电技术有限公司 增强图像对比度的方法及其装置
CN111899182A (zh) * 2019-05-06 2020-11-06 浙江宇视科技有限公司 颜色增强方法及装置
KR102261532B1 (ko) * 2020-05-29 2021-06-04 동아대학교 산학협력단 단일 스케일 영상 융합에 기반한 안개 제거 시스템 및 방법
CN112330564A (zh) * 2020-11-11 2021-02-05 海宁奕斯伟集成电路设计有限公司 图像处理方法、装置、电子设备以及可读存储介质
CN113643651A (zh) * 2021-07-13 2021-11-12 深圳市洲明科技股份有限公司 一种图像增强方法、装置、计算机设备和存储介质

Also Published As

Publication number Publication date
CN113643651A (zh) 2021-11-12
CN113643651B (zh) 2022-08-09

Similar Documents

Publication Publication Date Title
CN108090879B (zh) 一种对输入的高动态范围图像进行处理的方法和显示设备
CN101340511B (zh) 一种基于亮度检测的自适应视频图像增强方法
WO2018133609A1 (zh) 从低动态图像生成高动态图像的方法
CN108109180B (zh) 一种对输入的高动态范围图像进行处理的方法和显示设备
CN109979401B (zh) 驱动方法、驱动装置、显示设备和计算机可读介质
CN109274985B (zh) 视频转码方法、装置、计算机设备和存储介质
CN107257452B (zh) 一种图像处理方法、装置及计算设备
US9147238B1 (en) Adaptive histogram-based video contrast enhancement
CN104581105B (zh) 基于色温距离变换权重图和块可靠性修正的自动白平衡方法
CN108024104B (zh) 一种对输入的高动态范围图像进行处理的方法和显示设备
CN111292269B (zh) 图像色调映射方法、计算机装置及计算机可读存储介质
CN115115554B (zh) 基于增强图像的图像处理方法、装置和计算机设备
US8269898B2 (en) Image processing apparatus
CN112037144A (zh) 一种基于局部对比度拉伸的低照度图像增强方法
CN116825039B (zh) 背光亮度计算方法、显示设备及计算机可读存储介质
WO2023284528A1 (zh) 一种图像增强方法、装置、计算机设备和存储介质
TWI462575B (zh) 影像處理裝置及影像處理方法
CN112929625B (zh) 一种显示素材渲染方法及装置
CN107358592B (zh) 一种迭代式全局自适应图像增强方法
WO2023000868A1 (zh) 图像处理方法及装置、设备、存储介质
CN103685972A (zh) 影像优化方法以及使用此方法的系统
CN111105756B (zh) 液晶显示图像的背光补偿方法及装置、存储介质、终端
CN116489330A (zh) 一种自适应白平衡方法、装置、电子设备及存储介质
WO2022244073A1 (ja) 画像処理装置、プログラム及び画像処理方法
WO2022120799A9 (zh) 图像处理方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22841167

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2022841167

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2022841167

Country of ref document: EP

Effective date: 20240213