WO2021238655A1 - 图像处理方法及装置、存储介质、终端 - Google Patents

图像处理方法及装置、存储介质、终端 Download PDF

Info

Publication number
WO2021238655A1
WO2021238655A1 PCT/CN2021/093255 CN2021093255W WO2021238655A1 WO 2021238655 A1 WO2021238655 A1 WO 2021238655A1 CN 2021093255 W CN2021093255 W CN 2021093255W WO 2021238655 A1 WO2021238655 A1 WO 2021238655A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
brightness
processed
statistical histogram
global mapping
Prior art date
Application number
PCT/CN2021/093255
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 WO2021238655A1 publication Critical patent/WO2021238655A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration using histogram techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details

Definitions

  • the present invention relates to the field of image processing, in particular to an image processing method and device, storage medium, and terminal.
  • liquid crystal display In existing electronic devices, liquid crystal display (LCD) is commonly used as a display device, and the LCD screen relies on its built-in backlight module to emit light. Users can adjust the brightness of the screen by adjusting the brightness of the backlight module to adapt to different viewing content.
  • the brightness adjustment range of the backlight module is limited, and it cannot provide a more comfortable screen brightness for all occasions. For example, when the ambient light is very weak, the higher backlight brightness will stimulate the eyes, and the dim details on the screen under the lower backlight cannot be clearly expressed.
  • the dark light enhancement algorithm was created to solve this problem.
  • the ambient light is dim
  • the readability of the image and the comfort of the human eye can be greatly improved when the ambient light is dim.
  • the global mapping process can be used to calculate a new brightness histogram using the brightness histogram of the image.
  • the original image can be transformed into one by using two brightness histograms.
  • New images For example, the brightness of pixels with brightness a1 in the original image can be replaced by b1 in the new image, and the brightness of pixels with brightness a2 in the original image can be replaced by b2 in the new image, and so on.
  • the overall image brightness is usually adjusted. If most of the pixels of the original image are bright, this processing method will reduce the overall image brightness, causing the originally dark pixels to become Darker, unable to achieve the effect of dark light enhancement. And it is impossible to adjust the details of the image, and the flexibility is poor.
  • the technical problem solved by the present invention is to provide an image processing method and device, storage medium, and terminal, which have the opportunity to increase the brightness of pixels in the dark area, and adjust the details of the image in the process of achieving the effect of dark light enhancement , Get better flexibility.
  • an embodiment of the present invention provides an image processing method, including the following steps: providing an image to be processed, and determining a statistical histogram of the image to be processed; according to the statistical histogram, the brightness is less than the preset brightness
  • the number of threshold pixels determines the global mapping weight value, wherein the greater the number of pixels whose brightness is less than the preset brightness threshold, the greater the global mapping weight value; the brightness enhancement process is performed on the image to be processed to Obtain the brightness-enhanced image, and determine the statistical histogram of the brightness-enhanced image; according to the global mapping weight value, the statistical histogram of the image to be processed, and the statistical histogram of the brightness-enhanced image, The statistical histogram performs global mapping processing to obtain a global mapping statistical histogram.
  • the following formula is used to determine the global mapping weight value according to the number of pixels in the statistical histogram whose brightness is less than a preset brightness threshold:
  • w is used to represent the global mapping weight value
  • N is used to represent the preset brightness threshold
  • i is used to represent the i-th brightness value
  • hist(i) is used to represent the i-th brightness value in the statistical histogram.
  • N is a positive integer
  • Lvl is the number of gray levels of the statistical histogram.
  • performing brightness enhancement processing on the to-be-processed image to obtain a brightness-enhanced image includes: using a CLAHE algorithm to process the to-be-processed image to obtain the brightness-enhanced image.
  • the following formula is used to determine the number of pixels of each brightness value in the statistical histogram of the image to be processed and the number of pixels of each brightness value in the statistical histogram of the brightness enhanced image according to the global mapping weight value, Perform global mapping processing on the statistical histogram of the image to be processed to obtain the number of pixels of each brightness value in the global mapping statistical histogram:
  • outImage(k) is used to represent the number of pixels with the k-th brightness value in the global mapping statistical histogram
  • origImage(k) is used to represent the pixel with the k-th brightness value in the statistical histogram of the image to be processed
  • CHAHEImage(k) is used to represent the number of pixels of the k-th brightness value in the statistical histogram of the brightness-enhanced image, 0 ⁇ k ⁇ Lvl, where Lvl is the number of gray levels of the statistical histogram, w Used to represent the global mapping weight value, m is used to represent the weight threshold, and m is a positive integer.
  • the image processing method further includes: determining n frames of images before the to-be-processed image and their statistical histograms; performing global mapping processing on the statistical histograms of the n frames of images to obtain the n A global mapping statistical histogram of a frame image; filtering processing is performed on the statistical histogram of the global mapping image according to the number of pixels of each brightness value in the global mapping statistical histogram of the n frames of images; where n is a positive integer.
  • the following formula is used to perform filtering processing on the statistical histogram of the global mapped image according to the number of pixels of each brightness value in the global mapped statistical histogram of the n frames of images:
  • heCur(i) is used to represent the number of pixels of the i-th brightness value in the statistical histogram of the global mapped image after filtering
  • heMappingNew(i) is used to represent the statistical histogram of the global mapped image of the image to be processed
  • the number of pixels with the i-th brightness value in the frameHist(j)(i) is used to represent the number of pixels with the i-th brightness value in the statistical histogram of the j-th frame image in the n-frame image, where, i is a positive integer, and 0 ⁇ i ⁇ Lvl, and the Lvl is the gray level number of the statistical histogram.
  • the image processing method further includes: determining a global mapping processed image after global mapping processing; performing local mapping processing on each pixel in the global mapping processed image to obtain the output brightness value of each pixel .
  • performing local mapping processing on each pixel in the global mapping processed image to obtain the output brightness value of each pixel includes: determining a pixel to be processed and a set of neighboring pixels of the pixel to be processed, wherein, The set of neighboring pixels is one or more pixels within a preset range around the pixel to be processed in the global mapping processed image and the pixel to be processed; the brightness of each pixel in the set of neighboring pixels Perform low-pass filtering to obtain a low-pass filtered brightness value a3; determine the output brightness value c of the pixel to be processed according to the brightness value a1 of the pixel to be processed and the low-pass filtered brightness value a3.
  • performing a low-pass filtering process on the brightness value of each pixel in the neighborhood pixel set to obtain a low-pass filtered brightness value a3 includes: the low-pass filtering process is a Gaussian filtering process, and the low-pass filtering brightness The value a3 is a Gaussian filtered brightness value after Gaussian filtering is performed on the brightness value of each pixel in the neighborhood pixel set; or, the low-pass filtering process is an average filtering process, and the low-pass filtered brightness value a3 is a pair The average brightness value of the brightness value of each pixel in the neighborhood pixel set after the average filtering process is performed.
  • performing a low-pass filtering process on the brightness value of each pixel in the neighborhood pixel set to obtain a low-pass filtered brightness value a3 includes: the low-pass filtering process is a Gaussian filtering process, and the low-pass filtering brightness The value a3 is a Gaussian filtered brightness value after Gaussian filtering is performed on the brightness value of each pixel in the neighborhood pixel set; or, the low-pass filtering process is an average filtering process, and the low-pass filtered brightness value a3 is a pair The average brightness value of the brightness value of each pixel in the neighborhood pixel set after the average filtering process is performed.
  • the larger the brightness value of the pixel to be processed the smaller the value of the local mapping weight value p.
  • an embodiment of the present invention provides an image processing device, including: a first histogram determining module, configured to provide an image to be processed and determine the statistical histogram of the image to be processed; a weight value determining module , Used to determine the global mapping weight value according to the number of pixels in the statistical histogram whose brightness is less than the preset brightness threshold; the second histogram determination module is used to perform brightness enhancement processing on the image to be processed to obtain the brightness Enhance the image, and determine the statistical histogram of the brightness-enhanced image; a third histogram determination module is used to determine the statistical histogram of the image to be processed and the statistical histogram of the brightness-enhanced image according to the global mapping weight value, Perform global mapping processing on the statistical histogram of the image to be processed to obtain a global mapping statistical histogram.
  • an embodiment of the present invention provides a storage medium on which a computer program is stored, and the computer program executes the steps of the above image processing method when the computer program is run by a processor.
  • an embodiment of the present invention provides a terminal, including a memory and a processor, the memory stores a computer program that can run on the processor, and the processor executes the computer program when the computer program is running. The steps of the image processing method described above.
  • the global mapping weight value and the brightness enhanced image are determined, and the global mapping statistical histogram is obtained according to the global mapping weight value and the brightness enhanced image, and the number of pixels whose brightness is less than the preset brightness threshold.
  • the solution of the embodiment of the present invention can be used to achieve the effect of dark light enhancement.
  • the image is adjusted in detail for greater flexibility.
  • filtering the statistical histogram of the global mapping image can effectively realize the anti-flicker function between frames , To improve the user experience when watching continuous images.
  • the brightness value a1 and the low-pass filtered brightness value a3 of the pixel to be processed are converted into the logarithmic domain, which can be Increasing the dynamic range of pixels in the dark area, and then subtracting the result of the neighborhood low-pass filtering (that is, the background or ambient brightness) with the darker pixels, helps to achieve background suppression and improve the details and contrast of the dark areas of the image. Further, by setting the local mapping weight value, the brightness of the currently processed pixel can be effectively considered, and the consistent processing of all pixels can be avoided.
  • the factor of the brightness of the currently processed pixel can be incorporated in a weighted manner to strengthen the suppression of the low-frequency part in the pixel area with low brightness.
  • the suppression of the low-frequency part in the pixel area with low brightness is weakened, so that the dark area can be more strongly suppressed. Weaken the background and enhance more details, effectively reducing image distortion problems.
  • Fig. 1 is a flowchart of an image processing method in an embodiment of the present invention
  • FIG. 2 is a partial flowchart of another image processing method in an embodiment of the present invention.
  • Fig. 3 is a schematic diagram of a partial mapping process in an embodiment of the present invention.
  • Fig. 4 is a schematic structural diagram of an image processing device in an embodiment of the present invention.
  • a global mapping processing method can be used to calculate a new brightness histogram using the brightness histogram of the image.
  • the image can transform the original image into a new image. For example, the brightness of pixels with brightness a1 in the original image can be replaced by b1 in the new image, and the brightness of pixels with brightness a2 in the original image can be replaced by b2 in the new image, and so on.
  • the existing global mapping processing method cannot adjust the details of the image, and the flexibility is poor.
  • the inventor of the present invention has discovered through research that in the existing global mapping processing method, the overall image brightness is usually adjusted. If most of the pixels of the original image are bright, this processing method will reduce the overall image brightness, resulting in The originally dim pixels become darker, unable to achieve the effect of dark light enhancement, and unable to adjust the details of the image, and the flexibility is poor.
  • the global mapping weight value and the brightness enhanced image are determined, and the global mapping statistical histogram is obtained according to the global mapping weight value and the brightness enhanced image, and the number of pixels whose brightness is less than the preset brightness threshold.
  • the solution of the embodiment of the present invention can be used to achieve the effect of dark light enhancement.
  • the image is adjusted in detail for greater flexibility.
  • Fig. 1 is a flowchart of an image processing method in an embodiment of the present invention.
  • the image processing method may include:
  • Step S11 Provide an image to be processed, and determine a statistical histogram of the image to be processed
  • Step S12 Determine a global mapping weight value according to the number of pixels whose brightness is less than a preset brightness threshold in the statistical histogram, where the greater the number of pixels whose brightness is less than the preset brightness threshold, the global mapping weight value Bigger
  • Step S13 Perform brightness enhancement processing on the image to be processed to obtain a brightness enhanced image, and determine a statistical histogram of the brightness enhanced image;
  • Step S14 Perform global mapping processing on the statistical histogram of the image to be processed according to the global mapping weight value, the statistical histogram of the image to be processed, and the statistical histogram of the brightness enhanced image to obtain a global mapping statistical histogram picture.
  • the method can be implemented in the form of a software program that runs on a processor integrated inside a chip or a chip module.
  • step S11 an appropriate conventional technique may be used to determine the statistical histogram of the image to be processed.
  • step S12 the pixels whose brightness is less than the preset brightness threshold in the statistical histogram are used to indicate the dark area pixels. It can be understood that the greater the number of pixels whose brightness is less than the preset brightness threshold, the more The darker the processed image.
  • the global mapping weight value is determined according to the number of pixels with brightness less than the preset brightness threshold in the statistical histogram, where the larger the number of pixels with brightness less than the preset brightness threshold, the greater the global mapping weight value.
  • the preset brightness threshold may also be referred to as a dark area pixel ratio threshold.
  • the threshold may be set to measure the dark area pixel ratio in the image. Taking the number of gray levels of the statistical histogram as an example of 256, the preset brightness threshold is selected from the value interval [1, 255], as a non-limiting example, the preset brightness threshold can be set to 16 ⁇ 64, for example, it can be 32.
  • the preset brightness threshold should not be set too large. Too large may easily lead to misjudgement of the image as dark, resulting in the subsequent global mapping weight value being too large, so that the global mapping statistical histogram obtained after the global mapping process
  • the brightness of the dark area pixels is increased too high, which affects the image quality
  • the preset brightness threshold should not be set too small, too small may cause the image to be misjudged as brighter, resulting in the subsequent global mapping weight value being too high Therefore, in the global mapping statistical histogram obtained after the global mapping processing, the brightness of the pixels in the dark area is too low, which affects the imaging quality.
  • the following formula may be used to determine the global mapping weight value according to the number of pixels in the statistical histogram whose brightness is less than a preset brightness threshold:
  • w is used to represent the global mapping weight value
  • N is used to represent the preset brightness threshold
  • i is used to represent the i-th brightness value
  • hist(i) is used to represent the i-th brightness value in the statistical histogram.
  • N is a positive integer
  • Lvl is the number of gray levels of the statistical histogram.
  • w is the sum of the lowest 32 bins in the calculation histogram (ie the number of darker pixels in the image), which can be used as a measure of the amount of detail in the dark area of the image .
  • the image is darker, there are more darker pixels in the image, the smaller w is, so w can be used as a signal of the global mapping intensity.
  • the weight in the process of calculating the number of pixels of each brightness value in the global mapping statistics histogram, by setting the weight to take the value m ⁇ w when w is small, and take the value 1 when w is large, it is possible to achieve The pixels in the dark area are increased more brightness, and the pixels in the bright area are increased less brightness, thereby further achieving a better dark light enhancement effect and increasing flexibility.
  • a proper algorithm may be used to perform brightness enhancement processing on the image to be processed to obtain a brightness enhanced image, and a proper method may be used to determine the statistical histogram of the brightness enhanced image.
  • the step of performing brightness enhancement processing on the image to be processed to obtain a brightness enhanced image may include: using a CLAHE algorithm to process the image to be processed to obtain the brightness enhanced image.
  • Contrast Limited Adaptive Histogram Equalization can effectively limit the situation of noise amplification for the contrast-limited adaptive histogram equalization algorithm. More specifically, when there is a place in the image that is obviously brighter or darker than other areas, the ordinary histogram equalization algorithm cannot describe the detailed information of the place.
  • the CLAHE algorithm works by performing in a rectangular area around the currently processed pixel The histogram equalization can achieve the effect of expanding the local contrast and showing the details of the smooth area.
  • step S14 when performing global mapping processing on the statistical histogram of the image to be processed, it needs to be based on the statistical histogram of the image to be processed and the statistical histogram of the brightness-enhanced image. The number of pixels is determined.
  • the following formula may be used to determine the number of pixels of each brightness value in the statistical histogram of the image to be processed and the number of pixels of each brightness value in the statistical histogram of the brightness enhanced image according to the global mapping weight value, Perform global mapping processing on the statistical histogram of the image to be processed to obtain the number of pixels of each brightness value in the global mapping statistical histogram:
  • outImage(k) is used to represent the number of pixels with the k-th brightness value in the global mapping statistical histogram
  • origImage(k) is used to represent the pixel with the k-th brightness value in the statistical histogram of the image to be processed
  • CHAHEImage(k) is used to represent the number of pixels of the k-th brightness value in the statistical histogram of the brightness-enhanced image, 0 ⁇ k ⁇ Lvl, where Lvl is the number of gray levels of the statistical histogram, w Used to represent the global mapping weight value, m is used to represent the weight threshold, and m is a positive integer.
  • the image histogram gray level Lvl may be 255, and the value of the weight threshold m may satisfy 3 ⁇ m ⁇ 5, for example, 4.
  • the global mapping weight value and the brightness enhanced image are determined, and the global mapping statistical histogram is obtained according to the global mapping weight value and the brightness enhanced image, and the number of pixels whose brightness is less than the preset brightness threshold.
  • the solution of the embodiment of the present invention can be used to achieve the effect of dark light enhancement.
  • the image is adjusted in detail for greater flexibility.
  • the image processing method may further include: determining n frames of images before the to-be-processed image and their statistical histograms; performing global mapping processing on the statistical histograms of the n frames of images to obtain the n A global mapping statistical histogram of a frame image; filtering processing is performed on the statistical histogram of the global mapping image according to the number of pixels of each brightness value in the global mapping statistical histogram of the n frames of images; where n is a positive integer.
  • the following formula may be used to perform filtering processing on the statistical histogram of the global mapped image according to the number of pixels of each brightness value in the global mapped statistical histogram of the n frames of images:
  • heCur(i) is used to represent the number of pixels of the i-th brightness value in the statistical histogram of the global mapped image after filtering
  • heMappingNew(i) is used to represent the statistical histogram of the global mapped image of the image to be processed
  • the number of pixels with the i-th brightness value in the frameHist(j)(i) is used to represent the number of pixels with the i-th brightness value in the statistical histogram of the j-th frame image in the n-frame image, where, i is a positive integer, and 0 ⁇ i ⁇ Lvl, and the Lvl is the gray level number of the statistical histogram.
  • an array for example named frameHist[n]
  • the weighted global mapping result of n frames before the current frame for example, heMapping
  • heMappingNew the nearest n weighted global mapping relationship results heMapping stored in the array frameHist[n]
  • the filtered output value heCur is recorded as the global mapping relationship finally adopted in the current frame.
  • Lvl is the gray level number of the image histogram, which can be 255.
  • the global brightness mapping relationship between adjacent frames is quite different, it is likely to visually cause the effect of frequent changes in the brightness of the previous and subsequent frames, which is called inter-frame flicker.
  • the flicker between frames greatly affects the comfort of viewing.
  • the global brightness mapping relationship of several frames before the current frame is stored in advance, and the anti-flicker global brightness mapping relationship is obtained through smoothing processing.
  • the anti-flicker global brightness mapping relationship determines the brightness value of each pixel. The output brightness value after global mapping and anti-flicker.
  • the image processing method may further include: determining a global mapping processed image after global mapping processing; performing local mapping processing on each pixel in the global mapping processed image to obtain the output brightness value of each pixel .
  • FIG. 2 is a partial flowchart of another image processing method in an embodiment of the present invention.
  • the another image processing method may include steps S11 to S14 shown in FIG. 1, and may also include a step of determining a global mapping processed image after global mapping processing, and processing each pixel in the global mapping processed image, The step of performing local mapping processing to obtain the output brightness value of each pixel.
  • the steps of performing local mapping processing on each pixel in the global mapping processed image to obtain the output brightness value of each pixel may include step S21 to step S23, and each step will be described below.
  • step S21 a pixel to be processed and a set of neighboring pixels of the pixel to be processed are determined, wherein the set of neighboring pixels is one of the pixels to be processed within a preset range around the global mapping processed image Or a plurality of pixels and the pixel to be processed.
  • step S22 low-pass filtering is performed on the brightness value of each pixel in the neighborhood pixel set to obtain a low-pass filtered brightness value a3.
  • the image can be regarded as a two-dimensional signal, and the level of the gray value of the pixel point represents the strength of the signal.
  • High-frequency filtering can be aimed at points in the image with sharp gray-scale changes, such as image outlines or noise; low-frequency filtering can be aimed at points in the image that are flat with little gray-level changes, such as most areas in the image.
  • high-pass filter and low-pass filter can be set.
  • High-pass filter can detect sharp and obvious changes in the image;
  • low-pass filter can smooth the image and filter out the noise in the image .
  • Typical low-pass filters include: linear mean filter, Gaussian filter, non-linear bilateral filter, median filter;
  • high-pass filter has various edge filters based on Canny, Sobel, etc.
  • the step of performing low-pass filtering processing on the brightness value of each pixel in the neighborhood pixel set to obtain a low-pass filtered brightness value a3 may include: the low-pass filtering processing is Gaussian filtering processing, and the low-pass filtering processing is Gaussian filtering processing.
  • the filtered brightness value a3 is a Gaussian filtered brightness value after Gaussian filtering is performed on the brightness value of each pixel in the neighborhood pixel set; or, the low-pass filtering process is an average filtering process, and the low-pass filtered brightness value a3 It is an average brightness value obtained by performing an average filtering process on the brightness value of each pixel in the neighborhood pixel set.
  • step S23 the output brightness value c of the pixel to be processed is determined according to the brightness value a1 of the pixel to be processed and the low-pass filtered brightness value a3.
  • the following formula may be used to determine the output brightness value c of the pixel to be processed according to the brightness value a1 of the pixel to be processed and the low-pass filtered brightness value a3:
  • a2 is used to represent the logarithmic value of the brightness value a1 of the pixel to be processed
  • a4 is used to represent the logarithmic value of the low-pass filtered brightness value a3
  • p is the local mapping weight value
  • 0 ⁇ p ⁇ 1, b It is used to represent the logarithmic value of the output brightness value c of the pixel to be processed.
  • the local mapping weight value p may be a parameter that controls the intensity of the local mapping.
  • the calculation of p is related to the corresponding pixel brightness.
  • the local mapping weight value p can have a value range of [0 1], that is, when the brightness is low, P is large, and when the brightness is high, p is approximately zero.
  • FIG. 3 is a schematic diagram of a local mapping process in an embodiment of the present invention.
  • the neighborhood pixel set 311 of the pixels to be processed and the pixel to be processed 321 are determined, and the brightness value of each pixel in the neighborhood pixel set 311 is subjected to global mapping processing to obtain the neighborhood after global mapping processing.
  • the pixel set 312 is further processed by low-pass filtering on the neighborhood pixel set 312 to obtain the neighborhood pixel set 313 after the low-pass filtering process, and the low-pass filtered brightness value a3 can be obtained.
  • the pixel to be processed 321 is determined, and the brightness value of the pixel to be processed 321 is subjected to a global mapping process to obtain the pixel a1 to be processed after the global mapping process.
  • the above formula can be used, taking the logarithm of a1 to obtain a2, and taking the logarithm of a3 to obtain a4, which can be converted to the logarithmic domain to increase the dynamic range of the dark area pixels.
  • a weight p can be provided, and b and c can be calculated using the above formula.
  • the p can be determined by the following formula:
  • LocalLvl is a preset parameter, the larger the LocalLvl, the stronger the edge stroke effect, and the smaller the LocalLvl, the less the details of the dark area are improved.
  • p can be selected from 0.3 to 0.5.
  • the larger the brightness value of the pixel to be processed the smaller the value of the local mapping weight value p.
  • the factor of the brightness of the currently processed pixel can be incorporated in a weighted manner to strengthen the suppression of the low-frequency part in the pixel area with low brightness.
  • the suppression of the low-frequency part in the pixel area with low brightness is weakened, so that the dark area can be more strongly suppressed. Weaken the background and enhance more details, effectively reducing image distortion problems.
  • both the brightness value a1 and the low-pass filtered brightness value a3 of the pixel to be processed are converted to the corresponding
  • the dynamic range of pixels in the dark area can be increased, and the result of the neighborhood low-pass filtering (ie, background or ambient brightness) can be subtracted from the darker pixels, which helps to achieve background suppression and improve the details and contrast of the dark areas of the image.
  • the local mapping weight value the brightness of the currently processed pixel can be effectively considered, and the consistent processing of all pixels can be avoided.
  • FIG. 4 is a schematic structural diagram of an image processing apparatus in an embodiment of the present invention.
  • the image processing device may include:
  • the first histogram determining module 41 is configured to provide an image to be processed and determine the statistical histogram of the image to be processed;
  • the weight value determination module 42 is configured to determine the global mapping weight value according to the number of pixels whose brightness is less than a preset brightness threshold in the statistical histogram;
  • the second histogram determining module 43 is configured to perform brightness enhancement processing on the image to be processed to obtain a brightness enhanced image, and determine a statistical histogram of the brightness enhanced image;
  • the third histogram determining module 44 is configured to perform global mapping processing on the statistical histogram of the image to be processed according to the global mapping weight value, the statistical histogram of the image to be processed, and the statistical histogram of the brightness enhanced image , In order to get the global mapping statistical histogram.
  • the above-mentioned device may correspond to a chip with data processing function in user equipment, such as a baseband chip; or a chip module including a chip with data processing function in user equipment, or a user equipment.
  • the embodiment of the present invention also provides a storage medium on which a computer program is stored, and the computer program executes the steps of the foregoing method when the computer program is run by a processor.
  • the storage medium may be a computer-readable storage medium, for example, it may include a non-volatile memory (non-volatile) or a non-transitory (non-transitory) memory, and may also include an optical disk, a mechanical hard disk, a solid state hard disk, and the like.
  • An embodiment of the present invention also provides a terminal, including a memory and a processor, the memory stores a computer program that can run on the processor, and the processor executes the steps of the above method when the computer program is running.
  • the terminal includes, but is not limited to, terminal devices such as mobile phones, computers, and tablets.
  • modules/units contained in the various devices and products described in the above embodiments may be software modules/units, hardware modules/units, or part software modules/units and part hardware modules/units.
  • the various modules/units contained therein can be implemented in the form of hardware such as circuits, or at least part of the modules/units can be implemented in the form of software programs. Runs on the integrated processor inside the chip, and the remaining (if any) part of the modules/units can be implemented by hardware methods such as circuits; for each device and product applied to or integrated in the chip module, the modules/units included in it can be All are implemented by hardware such as circuits.
  • Different modules/units can be located in the same component (such as a chip, circuit module, etc.) or different components of the chip module, or at least some of the modules/units can be implemented by software programs.
  • the software program runs on the processor integrated inside the chip module, and the remaining (if any) part of the modules/units can be implemented by hardware methods such as circuits; for each device and product applied to or integrated in the terminal, each module included
  • the modules/units can all be implemented by hardware such as circuits, and different modules/units can be located in the same component (for example, chip, circuit module, etc.) or different components in the terminal, or at least part of the modules/units can be implemented in the form of software programs Implementation, the software program runs on the processor integrated inside the terminal, and the remaining (if any) part of the modules/units can be implemented in hardware such as circuits.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

一种图像处理方法及装置、存储介质、终端,所述方法包括:提供待处理图像,并确定所述待处理图像的统计直方图;根据所述统计直方图中亮度小于预设亮度阈值的像素的数量,确定全局映射权重值,其中,所述亮度小于预设亮度阈值的像素的数量越大,所述全局映射权重值越大;对所述待处理图像进行亮度增强处理,以得到亮度增强图像,并确定所述亮度增强图像的统计直方图;根据所述全局映射权重值、所述待处理图像的统计直方图以及亮度增强图像的统计直方图,对所述待处理图像的统计直方图进行全局映射处理,以得到全局映射统计直方图。本发明可以对暗区像素提升更高的亮度,并在达到暗光增强的效果过程中,对图像进行细节性调整,获得更好的灵活性。

Description

图像处理方法及装置、存储介质、终端
本申请要求于2020年5月29日提交中国专利局、申请号为202010482224.6、发明名称为“图像处理方法及装置、存储介质、终端”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及图像处理领域,尤其涉及一种图像处理方法及装置、存储介质、终端。
背景技术
在现有的电子设备中,普遍使用液晶显示屏(Liquid crystal display,LCD)作为显示设备,LCD屏是依靠其内置的背光模组来发光的。用户可以通过调节背光模组的亮度来调节屏幕亮度,以适应不同观看内容。而背光模组的亮度调节幅度是有限的,并不能对所有场合都提供较舒适的屏幕亮度。比如当环境光很弱时,较高的背光亮度会对眼睛产生刺激,而较低的背光下屏幕上昏暗的细节又无法被清晰的表达出来。
暗光增强算法就是为了解决这一问题而产生的。在环境光昏暗时,调高昏暗像素的亮度并作锐化处理,使得昏暗的细节更加清晰;同时调低高亮像素的亮度,使得明亮的细节不再刺眼。通过这样的调整就能在环境光昏暗时,大大提高图像的可读性和人眼的舒适性。
具体而言,可以采用全局映射处理方式,利用图像的亮度直方图计算出新的亮度直方图,两个直方图间具有明确的对应关系,也即利用两个亮度直方图可以将原图像变换成一张新的图像。例如可以将原图像中亮度为a1的像素在新图像中的亮度都由b1代替,原图像中亮 度为a2的像素在新图像中的亮度都由b2代替等等。
然而在现有的全局映射处理方式中,通常是对图像亮度整体进行调整,如果原图像大部分像素都很明亮,该处理方式会将图像亮度整体调低,导致原本就比较昏暗的像素变得更暗,无法达到暗光增强的效果。并且无法对图像进行细节性调整,灵活性较差。
发明内容
本发明解决的技术问题是提供一种图像处理方法及装置、存储介质、终端,有机会对暗区像素提升更高的亮度,并在达到暗光增强的效果过程中,对图像进行细节性调整,获得更好的灵活性。
为解决上述技术问题,本发明实施例提供一种图像处理方法,包括以下步骤:提供待处理图像,并确定所述待处理图像的统计直方图;根据所述统计直方图中亮度小于预设亮度阈值的像素的数量,确定全局映射权重值,其中,所述亮度小于预设亮度阈值的像素的数量越大,所述全局映射权重值越大;对所述待处理图像进行亮度增强处理,以得到亮度增强图像,并确定所述亮度增强图像的统计直方图;根据所述全局映射权重值、所述待处理图像的统计直方图以及亮度增强图像的统计直方图,对所述待处理图像的统计直方图进行全局映射处理,以得到全局映射统计直方图。
可选的,采用下述公式,根据所述统计直方图中亮度小于预设亮度阈值的像素的数量,确定全局映射权重值:
Figure PCTCN2021093255-appb-000001
其中,w用于表示所述全局映射权重值,N用于表示所述预设亮度阈值,i用于表示第i个亮度值,hist(i)用于表示在所述统计直方图中第i个亮度值的像素的数量,其中,N为正整数,且0<N≤Lvl,所述Lvl为所述统计直方图的灰度级数。
可选的,对所述待处理图像进行亮度增强处理,以得到亮度增强图像包括:采用CLAHE算法对所述待处理图像进行处理,以得到所述亮度增强图像。
可选的,采用下述公式,根据所述全局映射权重值、所述待处理图像的统计直方图中各个亮度值的像素数以及亮度增强图像的统计直方图中各个亮度值的像素数,对所述待处理图像的统计直方图进行全局映射处理,以得到全局映射统计直方图中各个亮度值的像素数:
outImage(k)
=origImage(k)×(1-weight)+CHAHEImage(k)
×weight
Figure PCTCN2021093255-appb-000002
其中,outImage(k)用于表示所述全局映射统计直方图中第k个亮度值的像素数,origImage(k)用于表示所述待处理图像的统计直方图中第k个亮度值的像素数,CHAHEImage(k)用于表示所述亮度增强图像的统计直方图中第k个亮度值的像素数,0≤k≤Lvl,所述Lvl为所述统计直方图的灰度级数,w用于表示所述全局映射权重值,m用于表示权重阈值,且m为正整数。
可选的,所述的图像处理方法还包括:确定所述待处理图像之前的n帧图像及其统计直方图;对所述n帧图像的统计直方图进行全局映射处理,以得到所述n帧图像的全局映射统计直方图;根据所述n帧图像的全局映射统计直方图中各个亮度值的像素数,对所述全局映射图像的统计直方图进行滤波处理;其中,n为正整数。
可选的,采用下述公式,根据所述n帧图像的全局映射统计直方图中各个亮度值的像素数,对所述全局映射图像的统计直方图进行滤波处理:
Figure PCTCN2021093255-appb-000003
其中,heCur(i)用于表示滤波处理后的全局映射图像的统计直方图中第i个亮度值的像素数,heMappingNew(i)用于表示所述待处理图像的全局映射图像的统计直方图中第i个亮度值的像素数,frameHist(j)(i)用于表示所述n帧图像中第j帧图像的全局映射图像的统计直方图中第i个亮度值的像素数,其中,i为正整数,且0≤i≤Lvl,所述Lvl为所述统计直方图的灰度级数。
可选的,所述的图像处理方法还包括:确定全局映射处理后的全局映射处理图像;对所述全局映射处理图像中的各个像素,分别进行局部映射处理,以得到各个像素的输出亮度值。
可选的,对所述全局映射处理图像中的各个像素,分别进行局部映射处理,以得到各个像素的输出亮度值包括:确定待处理像素以及所述待处理像素的邻域像素集合,其中,所述邻域像素集合为所述待处理像素在所述全局映射处理图像中周边预设范围内的一个或多个像素以及所述待处理像素;对所述邻域像素集合中各个像素的亮度值进行低通滤波处理,以得到低通滤波亮度值a3;根据所述待处理像素的亮度值a1以及所述低通滤波亮度值a3,确定所述待处理像素的输出亮度值c。
可选的,对所述邻域像素集合中各个像素的亮度值进行低通滤波处理,以得到低通滤波亮度值a3包括:所述低通滤波处理为高斯滤波处理,所述低通滤波亮度值a3为对所述邻域像素集合中各个像素的亮度值进行高斯滤波处理后的高斯滤波亮度值;或者,所述低通滤波处理为均值滤波处理,所述低通滤波亮度值a3为对所述邻域像素集合中各个像素的亮度值进行均值滤波处理后的平均亮度值。
可选的,对所述邻域像素集合中各个像素的亮度值进行低通滤波处理,以得到低通滤波亮度值a3包括:所述低通滤波处理为高斯滤 波处理,所述低通滤波亮度值a3为对所述邻域像素集合中各个像素的亮度值进行高斯滤波处理后的高斯滤波亮度值;或者,所述低通滤波处理为均值滤波处理,所述低通滤波亮度值a3为对所述邻域像素集合中各个像素的亮度值进行均值滤波处理后的平均亮度值。
可选的,所述待处理像素的亮度值越大,所述局部映射权重值p的取值越小。
为解决上述技术问题,本发明实施例提供一种图像处理装置,包括:第一直方图确定模块,用于提供待处理图像,并确定所述待处理图像的统计直方图;权重值确定模块,用于根据所述统计直方图中亮度小于预设亮度阈值的像素的数量,确定全局映射权重值;第二直方图确定模块,用于对所述待处理图像进行亮度增强处理,以得到亮度增强图像,并确定所述亮度增强图像的统计直方图;第三直方图确定模块,用于根据所述全局映射权重值、所述待处理图像的统计直方图以及亮度增强图像的统计直方图,对所述待处理图像的统计直方图进行全局映射处理,以得到全局映射统计直方图。
为解决上述技术问题,本发明实施例提供一种存储介质,其上存储有计算机程序,所述计算机程序被处理器运行时执行上述图像处理方法的步骤。
为解决上述技术问题,本发明实施例提供一种终端,包括存储器和处理器,所述存储器上存储有能够在所述处理器上运行的计算机程序,所述处理器运行所述计算机程序时执行上述图像处理方法的步骤。
与现有技术相比,本发明实施例的技术方案具有以下有益效果:
在本发明实施例中,通过确定全局映射权重值以及亮度增强图像,并根据所述全局映射权重值以及亮度增强图像得到全局映射统计直方图,且所述亮度小于预设亮度阈值的像素的数量越大,所述全局映射权重值越大,从而对于暗区像素较多的图像,可以得到较大的全局映射权重值,从而在全局映射处理后得到的全局映射统计直方图中, 相比于亮区像素,有机会对暗区像素提升更高的亮度,相比于现有技术中对图像亮度整体进行调整,采用本发明实施例的方案,可以在达到暗光增强的效果过程中,对图像进行细节性调整,获得更好的灵活性。
进一步,在计算全局映射统计直方图中各个亮度值的像素数的过程中,通过设置weight在w较小时取值m×w,在w较大时取值1,可以实现对于暗区像素提升较多亮度,对亮区像素提升较少亮度,从而进一步实现更好的暗光增强效果,提高灵活性。
进一步,根据所述待处理图像之前的n帧图像的全局映射统计直方图中各个亮度值的像素数,对所述全局映射图像的统计直方图进行滤波处理,可以有效地实现帧间抗闪烁功能,提高观看连续图像时的用户体验。
进一步,在对所述全局映射处理图像中的各个像素,分别进行局部映射处理的过程中,将所述待处理像素的亮度值a1以及低通滤波亮度值a3均转换至对数域中,可以增大暗区像素的动态范围,进而用较暗像素减去邻域低通滤波结果(即背景或环境亮度),有助于实现背景抑制,提升图像暗区细节和对比度。进一步地,通过设置局部映射权重值,可以有效考虑当前处理像素的亮度,避免对所有像素进行一致的处理。
进一步,所述待处理像素的亮度值越大,所述局部映射权重值p的取值越小。可以通过加权的方式融入当前处理像素的亮度这一因素,使亮度小的像素区域中低频部分抑制得到加强,相反在亮度小的像素区域中低频部分抑制得到减弱,从而使得暗区能够更强地削弱背景且增强更多的细节,有效降低图像失真问题。
附图说明
图1是本发明实施例中一种图像处理方法的流程图;
图2是本发明实施例中另一种图像处理方法的部分流程图;
图3是本发明实施例中一种局部映射处理的示意图;
图4是本发明实施例中一种图像处理装置的结构示意图。
具体实施方式
如前所述,在现有技术中,可以采用全局映射处理方式,利用图像的亮度直方图计算出新的亮度直方图,两个直方图间具有明确的对应关系,也即利用两个亮度直方图可以将原图像变换成一张新的图像。例如可以将原图像中亮度为a1的像素在新图像中的亮度都由b1代替,原图像中亮度为a2的像素在新图像中的亮度都由b2代替等等。然而现有的全局映射处理方式无法对图像进行细节性调整,灵活性较差。
本发明的发明人经过研究发现,在现有的全局映射处理方式中,通常是对图像亮度整体进行调整,如果原图像大部分像素都很明亮,该处理方式会将图像亮度整体调低,导致原本就比较昏暗的像素变得更暗,无法达到暗光增强的效果,并且无法对图像进行细节性调整,灵活性较差。
在本发明实施例中,通过确定全局映射权重值以及亮度增强图像,并根据所述全局映射权重值以及亮度增强图像得到全局映射统计直方图,且所述亮度小于预设亮度阈值的像素的数量越大,所述全局映射权重值越大,从而对于暗区像素较多的图像,可以得到较大的全局映射权重值,从而在全局映射处理后得到的全局映射统计直方图中,相比于亮区像素,有机会对暗区像素提升更高的亮度,相比于现有技术中对图像亮度整体进行调整,采用本发明实施例的方案,可以在达到暗光增强的效果过程中,对图像进行细节性调整,获得更好的灵活性。
为使本发明的上述目的、特征和有益效果能够更为明显易懂,下面结合附图对本发明的具体实施例做详细的说明。
参照图1,图1是本发明实施例中一种图像处理方法的流程图。所述图像处理方法可以包括:
步骤S11:提供待处理图像,并确定所述待处理图像的统计直方图;
步骤S12:根据所述统计直方图中亮度小于预设亮度阈值的像素的数量,确定全局映射权重值,其中,所述亮度小于预设亮度阈值的像素的数量越大,所述全局映射权重值越大;
步骤S13:对所述待处理图像进行亮度增强处理,以得到亮度增强图像,并确定所述亮度增强图像的统计直方图;
步骤S14:根据所述全局映射权重值、所述待处理图像的统计直方图以及亮度增强图像的统计直方图,对所述待处理图像的统计直方图进行全局映射处理,以得到全局映射统计直方图。
可以理解的是,在具体实施中,所述方法可以采用软件程序的方式实现,该软件程序运行于芯片或芯片模组内部集成的处理器中。
在步骤S11的具体实施中,可以采用适当的常规技术,确定所述待处理图像的统计直方图。
在本发明实施例中,对于确定统计直方图的具体方式不作限制。
在步骤S12的具体实施中,统计直方图中亮度小于预设亮度阈值的像素用于指示暗区像素,可以理解的是,所述亮度小于预设亮度阈值的像素的数量越大,所述待处理图像越昏暗。
根据所述统计直方图中亮度小于预设亮度阈值的像素的数量,确定全局映射权重值,其中,所述亮度小于预设亮度阈值的像素的数量越大,所述全局映射权重值越大。
其中,所述预设亮度阈值又可称为暗区像素比例阈值,在全局映射关系中可以通过设置该阈值来衡量图像中暗区像素比例。以所述统计直方图的灰度级数为256为例,所述预设亮度阈值选自取值区间[1, 255],作为一个非限制性的例子,预设亮度阈值可以设置为16~64,例如可以为32。
需要指出的是,所述预设亮度阈值越小全局映射效果越强,所述预设亮度阈值越大越接近原图。具体地,所述预设亮度阈值不应当设置过大,过大容易导致对图像误判为偏暗,导致后续得到的全局映射权重值过大,从而在全局映射处理后得到的全局映射统计直方图中,对暗区像素提升过高的亮度,影响成像质量;所述预设亮度阈值不应当设置过小,过小容易导致对图像误判为偏亮,导致后续得到的全局映射权重值过小,从而在全局映射处理后得到的全局映射统计直方图中,对暗区像素提升的亮度过低,影响成像质量。
进一步地,可以采用下述公式,根据所述统计直方图中亮度小于预设亮度阈值的像素的数量,确定全局映射权重值:
Figure PCTCN2021093255-appb-000004
其中,w用于表示所述全局映射权重值,N用于表示所述预设亮度阈值,i用于表示第i个亮度值,hist(i)用于表示在所述统计直方图中第i个亮度值的像素的数量,其中,N为正整数,且0<N≤Lvl,所述Lvl为所述统计直方图的灰度级数。
在具体实施中,以所述预设亮度阈值为32为例,w是计算直方图中最低的32个bin的和(即图像中较暗的像素数量),可以作为图像暗区细节多少的度量。当图像较暗图像中较暗的像素越多,则w越小,因此可以用w来作为全局映射强度的一个信号。
在本发明实施例中,在计算全局映射统计直方图中各个亮度值的像素数的过程中,通过设置weight在w较小时取值m×w,在w较大时取值1,可以实现对于暗区像素提升较多亮度,对亮区像素提升较少亮度,从而进一步实现更好的暗光增强效果,提高灵活性。
在步骤S13的具体实施中,可以采用适当的算法对所述待处理图像进行亮度增强处理,以得到亮度增强图像,并采用适当的方法,确定所述亮度增强图像的统计直方图。
进一步地,对所述待处理图像进行亮度增强处理,以得到亮度增强图像的步骤可以包括:采用CLAHE算法对所述待处理图像进行处理,以得到所述亮度增强图像。
具体地,限制对比度自适应直方图均衡(Contrast Limited Adaptive Histogram Equalization,CLAHE)对于对比度受限的自适应直方图均衡算法就能够有效的限制噪声放大的情形。更具体地,对于图像中存在明显比其他区域亮或者暗的地方时,普通的直方图均衡算法就不能将该处的细节信息描述出来,CLAHE算法通过在当前处理像素周边的一个矩形区域内进行直方图均衡,可以达到扩大局部对比度,显示平滑区域细节的作用。
在步骤S14的具体实施中,在对所述待处理图像的统计直方图进行全局映射处理时,需要基于所述待处理图像的统计直方图以及亮度增强图像的统计直方图中的各个亮度值的像素数来确定。
进一步地,可以采用下述公式,根据所述全局映射权重值、所述待处理图像的统计直方图中各个亮度值的像素数以及亮度增强图像的统计直方图中各个亮度值的像素数,对所述待处理图像的统计直方图进行全局映射处理,以得到全局映射统计直方图中各个亮度值的像素数:
outImage(k)
=origImage(k)×(1-weight)+CHAHEImage(k)
×weight
Figure PCTCN2021093255-appb-000005
其中,outImage(k)用于表示所述全局映射统计直方图中第k个亮度值的像素数,origImage(k)用于表示所述待处理图像的统计直方图 中第k个亮度值的像素数,CHAHEImage(k)用于表示所述亮度增强图像的统计直方图中第k个亮度值的像素数,0≤k≤Lvl,所述Lvl为所述统计直方图的灰度级数,w用于表示所述全局映射权重值,m用于表示权重阈值,且m为正整数。
在本发明实施例的一种具体实施方式中,图像直方图灰度级数Lvl可以为255,权重阈值m的取值可以满足3≤m≤5,例如为4。
则上述公式可以变化为:
outImage=origImage*(1-weight)+CHAHEImage*weight
Figure PCTCN2021093255-appb-000006
在本发明实施例中,通过确定全局映射权重值以及亮度增强图像,并根据所述全局映射权重值以及亮度增强图像得到全局映射统计直方图,且所述亮度小于预设亮度阈值的像素的数量越大,所述全局映射权重值越大,从而对于暗区像素较多的图像,可以得到较大的全局映射权重值,从而在全局映射处理后得到的全局映射统计直方图中,相比于亮区像素,有机会对暗区像素提升更高的亮度,相比于现有技术中对图像亮度整体进行调整,采用本发明实施例的方案,可以在达到暗光增强的效果过程中,对图像进行细节性调整,获得更好的灵活性。
进一步地,所述的图像处理方法还可以包括:确定所述待处理图像之前的n帧图像及其统计直方图;对所述n帧图像的统计直方图进行全局映射处理,以得到所述n帧图像的全局映射统计直方图;根据所述n帧图像的全局映射统计直方图中各个亮度值的像素数,对所述全局映射图像的统计直方图进行滤波处理;其中,n为正整数。
在本发明实施例中,根据所述待处理图像之前的n帧图像的全局映射统计直方图中各个亮度值的像素数,对所述全局映射图像的统计直方图进行滤波处理,可以有效地实现帧间抗闪烁功能,提高观看连续图像时的用户体验。
更进一步地,可以采用下述公式,根据所述n帧图像的全局映射统计直方图中各个亮度值的像素数,对所述全局映射图像的统计直方图进行滤波处理:
Figure PCTCN2021093255-appb-000007
其中,heCur(i)用于表示滤波处理后的全局映射图像的统计直方图中第i个亮度值的像素数,heMappingNew(i)用于表示所述待处理图像的全局映射图像的统计直方图中第i个亮度值的像素数,frameHist(j)(i)用于表示所述n帧图像中第j帧图像的全局映射图像的统计直方图中第i个亮度值的像素数,其中,i为正整数,且0≤i≤Lvl,所述Lvl为所述统计直方图的灰度级数。
在本发明实施例的一种具体实施方式中,可以设置一个数组(例如命名为frameHist[n]),在其中保存当前帧之前n帧的加权全局映射关系结果(例如记为heMapping)用来做抗闪烁处理。每当新的加权全局映射关系(记为heMappingNew)计算完毕后,可以将所述数组frameHist[n]内存储的最近的n个加权全局映射关系结果heMapping与新的加权全局映射关系heMappingNew做一个均值滤波,则滤波输出值heCur记为当前帧最终采用的全局映射关系。
其中,Lvl为图像直方图灰度级数,可以为255。
需要指出的是,n越小,抗闪烁效果越弱;n越大,全局映射关系越近似,全局映射效果越不明显。作为一个非限制性的例子,为实现帧间抗闪烁同时保证处理效果,n可以选自6~8,例如可以为n=7(即前7帧)。
在视频处理过程中,每一帧图像进行全局映射后,会产生不同的全局亮度映射关系。如果相邻帧全局亮度映射关系差异较大,很可能在视觉上造成前后帧明暗频繁变化的效果,称为帧间闪烁。帧间闪烁非常影响观看的舒适度。通过平滑处理,将相邻帧的全局亮度映射关 系变化幅度降低到人眼无法识别的程度,就可以消除这种影响,更适合观看。在本发明实施例中,通过预先存储当前帧前若干帧的全局亮度映射关系,并通过平滑处理得到抗闪烁的全局亮度映射关系,上述抗闪烁的全局亮度映射关系确定了每个像素的亮度值经过全局映射和抗闪烁后的输出亮度值。
进一步地,所述的图像处理方法还可以包括:确定全局映射处理后的全局映射处理图像;对所述全局映射处理图像中的各个像素,分别进行局部映射处理,以得到各个像素的输出亮度值。
参照图2,图2是本发明实施例中另一种图像处理方法的部分流程图。所述另一种图像处理方法可以包括图1示出的步骤S11至步骤S14,还可以包括确定全局映射处理后的全局映射处理图像的步骤,以及对所述全局映射处理图像中的各个像素,分别进行局部映射处理,以得到各个像素的输出亮度值的步骤。
其中,所述对所述全局映射处理图像中的各个像素,分别进行局部映射处理,以得到各个像素的输出亮度值的步骤可以包括步骤S21至步骤S23,以下对各个步骤进行说明。
在步骤S21中,确定待处理像素以及所述待处理像素的邻域像素集合,其中,所述邻域像素集合为所述待处理像素在所述全局映射处理图像中周边预设范围内的一个或多个像素以及所述待处理像素。
在步骤S22中,对所述邻域像素集合中各个像素的亮度值进行低通滤波处理,以得到低通滤波亮度值a3。
在具体实施中,图像可以视为二维的信号,像素点灰度值的高低代表信号的强弱。高频滤波可以针对图像中灰度变化剧烈的点,例如图像轮廓或者是噪声;低频滤波可以针对图像中平坦的,灰度变化不大的点,例如图像中的大部分区域。
根据图像的高频与低频的特征,可以设置高通滤波器与低通滤波器,高通滤波可以检测图像中尖锐、变化明显的地方;低通滤波可以 让图像变得光滑,滤除图像中的噪声。比较典型的低通滤波有:线性的均值滤波器、高斯滤波器,非线性的双边滤波器、中值滤波器;高通滤波有基于Canny,Sobel等各种边缘滤波。
进一步地,对所述邻域像素集合中各个像素的亮度值进行低通滤波处理,以得到低通滤波亮度值a3的步骤可以包括:所述低通滤波处理为高斯滤波处理,所述低通滤波亮度值a3为对所述邻域像素集合中各个像素的亮度值进行高斯滤波处理后的高斯滤波亮度值;或者,所述低通滤波处理为均值滤波处理,所述低通滤波亮度值a3为对所述邻域像素集合中各个像素的亮度值进行均值滤波处理后的平均亮度值。
在步骤S23中,根据所述待处理像素的亮度值a1以及所述低通滤波亮度值a3,确定所述待处理像素的输出亮度值c。
进一步地,可以采用下述公式,根据所述待处理像素的亮度值a1以及所述低通滤波亮度值a3,确定所述待处理像素的输出亮度值c:
a2=log(a1)
a4=log(a3)
b=a2-p×a4
c=exp(b)
其中,a2用于表示所述待处理像素的亮度值a1的对数值,a4用于表示所述低通滤波亮度值a3的对数值,p为局部映射权重值,且0≤p≤1,b用于表示所述待处理像素的输出亮度值c的对数值。
需要指出的是,局部映射权重值p可以是控制局部映射强度的参数。p的计算与对应的像素亮度相关。
更进一步地,所述待处理像素的亮度值越大,所述局部映射权重值p的取值越小。
其中,所述局部映射权重值p取值范围可以为[0 1],也即当亮度 低时P较大,亮度较高时p近似为0。
参照图3,图3是本发明实施例中一种局部映射处理的示意图。
如图3所示,确定待处理像素的邻域像素集合311以及待处理像素321,对所述邻域像素集合311中各个像素的亮度值进行全局映射处理,以得到全局映射处理后的邻域像素集合312,进而对邻域像素集合312进行低通滤波处理,以得到低通滤波处理后的邻域像素集合313,并可以得到低通滤波亮度值a3。
确定待处理像素321,对所述待处理像素321的亮度值进行全局映射处理,以得到全局映射处理后的待处理像素a1。
进而可以采用上述公式,对a1取对数得到a2,对a3取对数得到a4,将其转换至对数域中,可以增大暗区像素的动态范围。
进而可以提供权重p,并采用上述公式计算b以及c。
进一步地,在本发明实施例中,可以通过以下公式,确定所述p:
p=LocalLvl*(1–a),a∈[0,1]
其中,LocalLvl为预设参数,所述LocalLvl越大,边缘描边效果越强,所述LocalLvl越小,暗区细节提高的越少。作为一个非限制性的例子,p可以选自0.3~0.5。
在本发明实施例中,所述待处理像素的亮度值越大,所述局部映射权重值p的取值越小。可以通过加权的方式融入当前处理像素的亮度这一因素,使亮度小的像素区域中低频部分抑制得到加强,相反在亮度小的像素区域中低频部分抑制得到减弱,从而使得暗区能够更强地削弱背景且增强更多的细节,有效降低图像失真问题。
在本发明实施例中,在对所述全局映射处理图像中的各个像素,分别进行局部映射处理的过程中,将所述待处理像素的亮度值a1以及低通滤波亮度值a3均转换至对数域中,可以增大暗区像素的动态范围,进而用较暗像素减去邻域低通滤波结果(即背景或环境亮度), 有助于实现背景抑制,提升图像暗区细节和对比度。进一步地,通过设置局部映射权重值,可以有效考虑当前处理像素的亮度,避免对所有像素进行一致的处理。
参照图4,图4是本发明实施例中一种图像处理装置的结构示意图。所述图像处理装置可以包括:
第一直方图确定模块41,用于提供待处理图像,并确定所述待处理图像的统计直方图;
权重值确定模块42,用于根据所述统计直方图中亮度小于预设亮度阈值的像素的数量,确定全局映射权重值;
第二直方图确定模块43,用于对所述待处理图像进行亮度增强处理,以得到亮度增强图像,并确定所述亮度增强图像的统计直方图;
第三直方图确定模块44,用于根据所述全局映射权重值、所述待处理图像的统计直方图以及亮度增强图像的统计直方图,对所述待处理图像的统计直方图进行全局映射处理,以得到全局映射统计直方图。
关于该图像处理装置的原理、具体实现和有益效果请参照前文及图1至图3示出的关于图像处理方法的相关描述,此处不再赘述。
在具体实施中,上述装置可以对应于用户设备中具有数据处理功能的芯片,如基带芯片;或者对应于用户设备中包括具有数据处理功能芯片的芯片模组,或者对应于用户设备。
本发明实施例还提供了一种存储介质,其上存储有计算机程序,所述计算机程序被处理器运行时执行上述方法的步骤。所述存储介质可以是计算机可读存储介质,例如可以包括非挥发性存储器(non-volatile)或者非瞬态(non-transitory)存储器,还可以包括光盘、机械硬盘、固态硬盘等。
本发明实施例还提供了一种终端,包括存储器和处理器,所述存 储器上存储有能够在所述处理器上运行的计算机程序,所述处理器运行所述计算机程序时执行上述方法的步骤。所述终端包括但不限于手机、计算机、平板电脑等终端设备。
关于上述实施例中描述的各个装置、产品包含的各个模块/单元,其可以是软件模块/单元,也可以是硬件模块/单元,或者也可以部分是软件模块/单元,部分是硬件模块/单元。例如,对于应用于或集成于芯片的各个装置、产品,其包含的各个模块/单元可以都采用电路等硬件的方式实现,或者,至少部分模块/单元可以采用软件程序的方式实现,该软件程序运行于芯片内部集成的处理器,剩余的(如果有)部分模块/单元可以采用电路等硬件方式实现;对于应用于或集成于芯片模组的各个装置、产品,其包含的各个模块/单元可以都采用电路等硬件的方式实现,不同的模块/单元可以位于芯片模组的同一组件(例如芯片、电路模块等)或者不同组件中,或者,至少部分模块/单元可以采用软件程序的方式实现,该软件程序运行于芯片模组内部集成的处理器,剩余的(如果有)部分模块/单元可以采用电路等硬件方式实现;对于应用于或集成于终端的各个装置、产品,其包含的各个模块/单元可以都采用电路等硬件的方式实现,不同的模块/单元可以位于终端内同一组件(例如,芯片、电路模块等)或者不同组件中,或者,至少部分模块/单元可以采用软件程序的方式实现,该软件程序运行于终端内部集成的处理器,剩余的(如果有)部分模块/单元可以采用电路等硬件方式实现。
虽然本发明披露如上,但本发明并非限定于此。任何本领域技术人员,在不脱离本发明的精神和范围内,均可作各种更动与修改,因此本发明的保护范围应当以权利要求所限定的范围为准。

Claims (14)

  1. 一种图像处理方法,其特征在于,包括以下步骤:
    提供待处理图像,并确定所述待处理图像的统计直方图;
    根据所述统计直方图中亮度小于预设亮度阈值的像素的数量,确定全局映射权重值,其中,所述亮度小于预设亮度阈值的像素的数量越大,所述全局映射权重值越大;
    对所述待处理图像进行亮度增强处理,以得到亮度增强图像,并确定所述亮度增强图像的统计直方图;
    根据所述全局映射权重值、所述待处理图像的统计直方图以及亮度增强图像的统计直方图,对所述待处理图像的统计直方图进行全局映射处理,以得到全局映射统计直方图。
  2. 根据权利要求1所述的图像处理方法,其特征在于,采用下述公式,根据所述统计直方图中亮度小于预设亮度阈值的像素的数量,确定全局映射权重值:
    Figure PCTCN2021093255-appb-100001
    其中,w用于表示所述全局映射权重值,N用于表示所述预设亮度阈值,i用于表示第i个亮度值,hist(i)用于表示在所述统计直方图中第i个亮度值的像素的数量,其中,N为正整数,且0<N≤Lvl,所述Lvl为所述统计直方图的灰度级数。
  3. 根据权利要求1所述的图像处理方法,其特征在于,对所述待处理图像进行亮度增强处理,以得到亮度增强图像包括:
    采用CLAHE算法对所述待处理图像进行处理,以得到所述亮度增强图像。
  4. 根据权利要求1所述的图像处理方法,其特征在于,采用下述公 式,根据所述全局映射权重值、所述待处理图像的统计直方图中各个亮度值的像素数以及亮度增强图像的统计直方图中各个亮度值的像素数,对所述待处理图像的统计直方图进行全局映射处理,以得到全局映射统计直方图中各个亮度值的像素数:
    Figure PCTCN2021093255-appb-100002
    其中,outImage(k)用于表示所述全局映射统计直方图中第k个亮度值的像素数,origImage(k)用于表示所述待处理图像的统计直方图中第k个亮度值的像素数,CHAHEImage(k)用于表示所述亮度增强图像的统计直方图中第k个亮度值的像素数,0≤k≤Lvl,所述Lvl为所述统计直方图的灰度级数,w用于表示所述全局映射权重值,m用于表示权重阈值,且m为正整数。
  5. 根据权利要求1所述的图像处理方法,其特征在于,还包括:
    确定所述待处理图像之前的n帧图像及其统计直方图;
    对所述n帧图像的统计直方图进行全局映射处理,以得到所述n帧图像的全局映射统计直方图;
    根据所述n帧图像的全局映射统计直方图中各个亮度值的像素数,对所述全局映射图像的统计直方图进行滤波处理;
    其中,n为正整数。
  6. 根据权利要求5所述的图像处理方法,其特征在于,采用下述公式,根据所述n帧图像的全局映射统计直方图中各个亮度值的像素数,对所述全局映射图像的统计直方图进行滤波处理:
    Figure PCTCN2021093255-appb-100003
    其中,heCur(i)用于表示滤波处理后的全局映射图像的统计直方图中第i个亮度值的像素数,heMappingNew(i)用于表示所述待处理图像的全局映射图像的统计直方图中第i个亮度值的像素数,frameHist(j)(i)用于表示所述n帧图像中第j帧图像的全局映射图像的统计直方图中第i个亮度值的像素数,其中,i为正整数,且0≤i≤Lvl,所述Lvl为所述统计直方图的灰度级数。
  7. 根据权利要求1所述的图像处理方法,其特征在于,还包括:
    确定全局映射处理后的全局映射处理图像;
    对所述全局映射处理图像中的各个像素,分别进行局部映射处理,以得到各个像素的输出亮度值。
  8. 根据权利要求7所述的图像处理方法,其特征在于,对所述全局映射处理图像中的各个像素,分别进行局部映射处理,以得到各个像素的输出亮度值包括:
    确定待处理像素以及所述待处理像素的邻域像素集合,其中,所述邻域像素集合为所述待处理像素在所述全局映射处理图像中周边预设范围内的一个或多个像素以及所述待处理像素;
    对所述邻域像素集合中各个像素的亮度值进行低通滤波处理,以得到低通滤波亮度值a3;
    根据所述待处理像素的亮度值a1以及所述低通滤波亮度值a3,确定所述待处理像素的输出亮度值c。
  9. 根据权利要求8所述的图像处理方法,其特征在于,对所述邻域像素集合中各个像素的亮度值进行低通滤波处理,以得到低通滤波亮度值a3包括:
    所述低通滤波处理为高斯滤波处理,所述低通滤波亮度值a3为对所述邻域像素集合中各个像素的亮度值进行高斯滤波处理后的高斯滤波亮度值;
    或者,所述低通滤波处理为均值滤波处理,所述低通滤波亮度值a3为对所述邻域像素集合中各个像素的亮度值进行均值滤波处理后的平均亮度值。
  10. 根据权利要求8所述的图像处理方法,其特征在于,采用下述公式,根据所述待处理像素的亮度值a1以及所述低通滤波亮度值a3,确定所述待处理像素的输出亮度值c:
    a2=log(a1)
    a4=log(a3)
    b=a2-p×a4
    c=exp(b)
    其中,a2用于表示所述待处理像素的亮度值a1的对数值,a4用于表示所述低通滤波亮度值a3的对数值,p为局部映射权重值,且0≤p≤1,b用于表示所述待处理像素的输出亮度值c的对数值。
  11. 根据权利要求10所述的图像处理方法,其特征在于,所述待处理像素的亮度值越大,所述局部映射权重值p的取值越小。
  12. 一种图像处理装置,其特征在于,包括:
    第一直方图确定模块,用于提供待处理图像,并确定所述待处理图像的统计直方图;
    权重值确定模块,用于根据所述统计直方图中亮度小于预设亮度阈值的像素的数量,确定全局映射权重值;
    第二直方图确定模块,用于对所述待处理图像进行亮度增强处理,以得到亮度增强图像,并确定所述亮度增强图像的统计直方图;
    第三直方图确定模块,用于根据所述全局映射权重值、所述待处理图像的统计直方图以及亮度增强图像的统计直方图,对所述待处理图像的统计直方图进行全局映射处理,以得到全局映射统计直方图。
  13. 一种存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器运行时执行权利要求1至11任一项所述图像处理方法的步骤。
  14. 一种终端,包括存储器和处理器,所述存储器上存储有能够在所述处理器上运行的计算机程序,其特征在于,所述处理器运行所述计算机程序时执行权利要求1至11任一项所述图像处理方法的步骤。
PCT/CN2021/093255 2020-05-29 2021-05-12 图像处理方法及装置、存储介质、终端 WO2021238655A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010482224.6 2020-05-29
CN202010482224.6A CN111738966B (zh) 2020-05-29 2020-05-29 图像处理方法及装置、存储介质、终端

Publications (1)

Publication Number Publication Date
WO2021238655A1 true WO2021238655A1 (zh) 2021-12-02

Family

ID=72646675

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/093255 WO2021238655A1 (zh) 2020-05-29 2021-05-12 图像处理方法及装置、存储介质、终端

Country Status (2)

Country Link
CN (1) CN111738966B (zh)
WO (1) WO2021238655A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116108896A (zh) * 2023-04-11 2023-05-12 上海登临科技有限公司 模型量化方法、装置、介质及电子设备
CN117274227A (zh) * 2023-10-23 2023-12-22 宁波市宇星水表有限公司 水表表面状态管理系统
CN117408657A (zh) * 2023-10-27 2024-01-16 杭州静嘉科技有限公司 一种基于人工智能的人力资源服务系统
CN117274227B (zh) * 2023-10-23 2024-06-07 宁波埃美柯水表有限公司 水表表面状态管理系统

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111738966B (zh) * 2020-05-29 2022-08-09 展讯通信(上海)有限公司 图像处理方法及装置、存储介质、终端
CN113345382B (zh) * 2021-05-28 2023-03-10 惠州视维新技术有限公司 屏幕显示图像的处理方法、系统及存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101292261A (zh) * 2005-10-21 2008-10-22 卡尔斯特里姆保健公司 用于医用图像的增强可视化的方法
CN101621704A (zh) * 2008-06-30 2010-01-06 英特尔公司 图形图像的颜色增强
US8731290B1 (en) * 2005-12-07 2014-05-20 Marvell International Ltd. Adaptive histogram-based video contrast enhancement
CN107563984A (zh) * 2017-10-30 2018-01-09 清华大学深圳研究生院 一种图像增强方法和计算机可读存储介质
CN108447040A (zh) * 2018-02-09 2018-08-24 深圳市朗驰欣创科技股份有限公司 直方图均衡化方法、装置及终端设备
CN109688292A (zh) * 2018-12-18 2019-04-26 电子科技大学 一种去除图像闪烁直方图映射方法
CN111738966A (zh) * 2020-05-29 2020-10-02 展讯通信(上海)有限公司 图像处理方法及装置、存储介质、终端

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5991486B2 (ja) * 2010-08-04 2016-09-14 日本電気株式会社 画像処理方法、画像処理装置及び画像処理プログラム
CN108198155B (zh) * 2017-12-27 2021-11-23 合肥君正科技有限公司 一种自适用色调映射方法及系统
CN110602472A (zh) * 2018-06-13 2019-12-20 上海富瀚微电子股份有限公司 一种基于直方图和引导滤波的局部色调映射方法及装置

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101292261A (zh) * 2005-10-21 2008-10-22 卡尔斯特里姆保健公司 用于医用图像的增强可视化的方法
US8731290B1 (en) * 2005-12-07 2014-05-20 Marvell International Ltd. Adaptive histogram-based video contrast enhancement
CN101621704A (zh) * 2008-06-30 2010-01-06 英特尔公司 图形图像的颜色增强
CN107563984A (zh) * 2017-10-30 2018-01-09 清华大学深圳研究生院 一种图像增强方法和计算机可读存储介质
CN108447040A (zh) * 2018-02-09 2018-08-24 深圳市朗驰欣创科技股份有限公司 直方图均衡化方法、装置及终端设备
CN109688292A (zh) * 2018-12-18 2019-04-26 电子科技大学 一种去除图像闪烁直方图映射方法
CN111738966A (zh) * 2020-05-29 2020-10-02 展讯通信(上海)有限公司 图像处理方法及装置、存储介质、终端

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116108896A (zh) * 2023-04-11 2023-05-12 上海登临科技有限公司 模型量化方法、装置、介质及电子设备
CN117274227A (zh) * 2023-10-23 2023-12-22 宁波市宇星水表有限公司 水表表面状态管理系统
CN117274227B (zh) * 2023-10-23 2024-06-07 宁波埃美柯水表有限公司 水表表面状态管理系统
CN117408657A (zh) * 2023-10-27 2024-01-16 杭州静嘉科技有限公司 一种基于人工智能的人力资源服务系统
CN117408657B (zh) * 2023-10-27 2024-05-17 杭州静嘉科技有限公司 一种基于人工智能的人力资源服务系统

Also Published As

Publication number Publication date
CN111738966A (zh) 2020-10-02
CN111738966B (zh) 2022-08-09

Similar Documents

Publication Publication Date Title
WO2021238655A1 (zh) 图像处理方法及装置、存储介质、终端
US11127122B2 (en) Image enhancement method and system
Wang et al. Simple low-light image enhancement based on Weber–Fechner law in logarithmic space
TWI455085B (zh) 液晶顯示器之背光控制方法
US8374430B2 (en) Apparatus and method for feature-based dynamic contrast enhancement
US8761539B2 (en) System for high ambient image enhancement
CN111986120A (zh) 一种基于帧累加和多尺度Retinex的低光照图像增强优化方法
CN105407296B (zh) 实时视频增强方法和装置
US9396526B2 (en) Method for improving image quality
CN112419162A (zh) 图像去雾方法、装置、电子设备及可读存储介质
WO2020124873A1 (zh) 图像处理方法
Mathias et al. Underwater image restoration based on diffraction bounded optimization algorithm with dark channel prior
CN111968065A (zh) 一种亮度不均匀图像的自适应增强方法
TW202046698A (zh) 影像調整方法以及相關的影像處理電路
Acharya et al. Contrast improvement using local gamma correction
Mu et al. Low and non-uniform illumination color image enhancement using weighted guided image filtering
Tsai et al. A novel simultaneous dynamic range compression and local contrast enhancement algorithm for digital video cameras
Ding et al. Color image enhancement with a human visual system based adaptive filter
Asari et al. Nonlinear enhancement of extremely high contrast images for visibility improvement
TWI382395B (zh) 一種背光調整與影像處理的方法
CN114429426B (zh) 一种基于Retinex模型的低照度图像质量改善方法
WO2021093718A1 (zh) 视频处理方法、视频修复方法、装置及设备
CN110852977B (zh) 融合边缘灰度直方图与人眼视觉感知特性的图像增强方法
CN110992294B (zh) 一种类纸显示器的图像对比度提升方法
CN112561906A (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: 21813708

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21813708

Country of ref document: EP

Kind code of ref document: A1