WO2021189222A1 - Image enhancement processing method and device - Google Patents

Image enhancement processing method and device Download PDF

Info

Publication number
WO2021189222A1
WO2021189222A1 PCT/CN2020/080774 CN2020080774W WO2021189222A1 WO 2021189222 A1 WO2021189222 A1 WO 2021189222A1 CN 2020080774 W CN2020080774 W CN 2020080774W WO 2021189222 A1 WO2021189222 A1 WO 2021189222A1
Authority
WO
WIPO (PCT)
Prior art keywords
histogram
sub
curve
histograms
mapping
Prior art date
Application number
PCT/CN2020/080774
Other languages
French (fr)
Chinese (zh)
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 华为技术有限公司
Priority to CN202080098763.8A priority Critical patent/CN115298688A/en
Priority to PCT/CN2020/080774 priority patent/WO2021189222A1/en
Publication of WO2021189222A1 publication Critical patent/WO2021189222A1/en

Links

Images

Classifications

    • G06T5/92
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration by the use of histogram techniques
    • 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/20081Training; Learning
    • 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/20084Artificial neural networks [ANN]

Abstract

Provided are an image enhancement processing method and device. The image enhancement processing method comprises: acquiring a histogram of an image to be processed; dividing the histogram into n sub-histograms, n being a positive integer; calculating a mapping curve of each of the n sub-histograms, a first sub-histogram being any one of the n sub-histograms; synthesizing mapping curves of the n sub-histograms to obtain a mapping curve of the histogram; performing, according to the mapping curve of the histogram, enhancement processing on said image. The prevent invention not only achieves the purpose of fine adjustment, but also considers the adjustment of both brightness distribution and contrast distribution, achieving the purpose of balancing.

Description

图像增强处理方法和装置Image enhancement processing method and device 技术领域Technical field
本申请涉及图像处理技术,尤其涉及一种图像增强处理方法和装置。This application relates to image processing technology, and in particular to an image enhancement processing method and device.
背景技术Background technique
图像信号处理器(Image Signal Processor,ISP)主要负责对图像传感器输出的信号进行处理,该信号通常为图像传感器输出的未经加工(RAW)格式图像(RAW Image Format)。ISP包括亮度、对比度、颜色、噪声、缩放等一系列处理子模块,可以将RAW格式图像处理为适应人眼观察或显示器显示的图像。其中,亮度和对比度处理子模块主要负责调整图像信号的亮度分布和对比度,通常使用一条全局色阶映射曲线(Global Tone Mapping Curve,GTMC)对图像的全局直方图进行重映射,使图像的全局亮度分布更加合理。如何最大限度发挥GTMC的作用,成为提升图像质量并保证视频稳定性的关键因素之一。The image signal processor (Image Signal Processor, ISP) is mainly responsible for processing the signal output by the image sensor, and the signal is usually the RAW image format (RAW Image Format) output by the image sensor. ISP includes a series of processing sub-modules such as brightness, contrast, color, noise, zoom, etc., which can process RAW format images into images suitable for human observation or display. Among them, the brightness and contrast processing sub-module is mainly responsible for adjusting the brightness distribution and contrast of the image signal. Usually a global tone mapping curve (Global Tone Mapping Curve, GTMC) is used to remap the global histogram of the image to make the global brightness of the image The distribution is more reasonable. How to maximize the role of GTMC has become one of the key factors to improve image quality and ensure video stability.
相关技术中,先对图像中的每个图像块的局部亮度分布信息进行分析,得到每个图像块的直方图,然后对每个直方图进行均衡化操作,得到每个图像块的色阶映射曲线(Tone Mapping Curve,TMC),TMC的作用是将输入像素的亮度映射到输出亮度上,以达到调整图像亮度分布的目的,例如图像亮度增强、对比度调节等处理经常会用到TMC作为调节手段。对图像上所有图像块的TMC进行最小二乘拟合,得到全图的GTMC,最后根据GTMC对图像全局进行图像增强处理。In the related art, the local brightness distribution information of each image block in the image is analyzed first to obtain the histogram of each image block, and then the equalization operation is performed on each histogram to obtain the color scale map of each image block Curve (Tone Mapping Curve, TMC), the role of TMC is to map the brightness of the input pixel to the output brightness to achieve the purpose of adjusting the image brightness distribution, such as image brightness enhancement, contrast adjustment and other processing often use TMC as an adjustment means . The least square fitting is performed on the TMC of all image blocks on the image to obtain the GTMC of the whole image, and finally the image is enhanced globally according to GTMC.
但是上述方法对所有图像块的亮度采用无差别调整,可能会导致图像局部噪声偏大、可控性差等问题。However, the above method adopts indifferent adjustment of the brightness of all image blocks, which may cause problems such as large local noise of the image and poor controllability.
发明内容Summary of the invention
本申请提供一种图像增强处理方法和装置,既可以达到精细调整的目的,又可以兼顾调整亮度分布和对比度分布,达到均衡的目的。The present application provides an image enhancement processing method and device, which can not only achieve the purpose of fine adjustment, but also adjust the brightness distribution and contrast distribution to achieve the purpose of balance.
第一方面,本申请提供一种图像增强处理方法,包括:获取待处理图像的直方图;将所述直方图划分成n个子直方图,n为正整数;计算所述n个子直方图中每个子直方图的映射曲线;对所述n个子直方图的映射曲线进行合成得到所述直方图的映射曲线;根据所述直方图的映射曲线对所述待处理图像进行增强处理。In a first aspect, the present application provides an image enhancement processing method, including: acquiring a histogram of an image to be processed; dividing the histogram into n sub-histograms, where n is a positive integer; calculating each of the n sub-histograms The mapping curve of each sub-histogram; synthesize the mapping curves of the n sub-histograms to obtain the mapping curve of the histogram; perform enhancement processing on the image to be processed according to the mapping curve of the histogram.
本申请将待处理图像的直方图划分为多个子直方图,针对每个子直方图分别得到对应的映射曲线,进而对这些映射曲线进行合成得到直方图的映射曲线,实现对待处理图像的增强处理,对各子直方图分开处理,既可以达到精细调整的目的,又可以兼顾图像整体分布,达到均衡的目的。This application divides the histogram of the image to be processed into multiple sub-histograms, and obtains corresponding mapping curves for each sub-histogram respectively, and then synthesizes these mapping curves to obtain the mapping curve of the histogram, so as to realize the enhancement processing of the image to be processed, Separate processing of the sub-histograms can not only achieve the purpose of fine adjustment, but also take into account the overall distribution of the image and achieve the purpose of balance.
在一种可能的实现方式中,所述计算所述n个子直方图中每个子直方图的映射曲线,包括:提取每个子直方图的多个特征;根据所述多个特征确定每个子直方图的映射曲线。需要说明的是,提取子直方图的特征还可以提取至少一个特征,对此不作具体限定。In a possible implementation manner, the calculating the mapping curve of each sub-histogram of the n sub-histograms includes: extracting multiple features of each sub-histogram; determining each sub-histogram according to the multiple features Mapping curve. It should be noted that at least one feature can also be extracted from the feature of the sub-histogram, which is not specifically limited.
在一种可能的实现方式中,所述多个特征包括子直方图的亮度均值、亮度标准差和像素百分比中的一个或多个,所述像素百分比为所述子直方图中包括的像素数量在所述直方图中包括的像素数量中的占比。In a possible implementation manner, the multiple features include one or more of a brightness average value, a brightness standard deviation, and a pixel percentage of a sub-histogram, and the pixel percentage is the number of pixels included in the sub-histogram The percentage of the number of pixels included in the histogram.
在一种可能的实现方式中,所述根据所述多个特征确定每个子直方图的映射曲线,包括:根据所述多个特征计算每个子直方图的增益曲线系数和均衡曲线权重;根据所述增益曲线系数和所述均衡曲线权重确定每个子直方图的映射曲线。In a possible implementation manner, the determining the mapping curve of each sub-histogram according to the multiple features includes: calculating the gain curve coefficient and the equalization curve weight of each sub-histogram according to the multiple features; The gain curve coefficient and the equalization curve weight determine the mapping curve of each sub-histogram.
本申请中得到子直方图的映射曲线的关键是增益曲线系数和均衡曲线权重的计算,可以使映射曲线的生成过程参数化,提高了产出效率和准确率。另外,对每个子直方图引入增益曲线系数和均衡曲线权重,可以兼顾调整每个子直方图的亮度分布和对比度分布,达到均衡的目的。The key to obtaining the mapping curve of the sub-histogram in this application is the calculation of the gain curve coefficient and the equalization curve weight, which can parameterize the generation process of the mapping curve and improve the output efficiency and accuracy. In addition, the gain curve coefficient and the equalization curve weight are introduced to each sub-histogram, and the brightness distribution and contrast distribution of each sub-histogram can be adjusted to achieve the purpose of equalization.
在一种可能的实现方式中,所述根据所述多个特征计算每个子直方图的增益曲线系数和均衡曲线权重,包括:将所述多个特征输入预先训练得到的第一直方图增强系数生成器得到所述增益曲线系数,所述第一直方图增强系数生成器用于计算所述增益曲线系数;将所述多个特征输入预先训练得到的第二直方图增强系数生成器得到所述均衡曲线权重,所述第二直方图增强系数生成器用于计算所述均衡曲线权重。In a possible implementation manner, the calculating the gain curve coefficient and the equalization curve weight of each sub-histogram according to the multiple features includes: inputting the multiple features into the first histogram obtained by pre-training to enhance The coefficient generator obtains the gain curve coefficients, and the first histogram enhancement coefficient generator is used to calculate the gain curve coefficients; the plurality of features are input into the second histogram enhancement coefficient generator obtained by pre-training to obtain the The equalization curve weight, and the second histogram enhancement coefficient generator is used to calculate the equalization curve weight.
在一种可能的实现方式中,所述根据所述多个特征计算每个子直方图的增益曲线系数和均衡曲线权重,包括:将所述多个特征和相邻子直方图的所述多个特征均输入预先训练得到的第一直方图增强系数生成器得到所述增益曲线系数,所述第一直方图增强系数生成器用于计算所述增益曲线系数;将所述多个特征和相邻子直方图的所述多个特征均输入预先训练得到的第二直方图增强系数生成器得到所述均衡曲线权重,所述第二直方图增强系数生成器用于计算所述均衡曲线权重。In a possible implementation manner, the calculating the gain curve coefficient and the equalization curve weight of each sub-histogram according to the multiple features includes: combining the multiple features with the multiple adjacent sub-histograms The features are all input to the first histogram enhancement coefficient generator obtained by pre-training to obtain the gain curve coefficient, and the first histogram enhancement coefficient generator is used to calculate the gain curve coefficient; The multiple features of the neighbor histogram are all input to a second histogram enhancement coefficient generator obtained by pre-training to obtain the equalization curve weight, and the second histogram enhancement coefficient generator is used to calculate the equalization curve weight.
在一种可能的实现方式中,所述第一直方图增强系数生成器和所述第二直方图增强系数生成器包括自适应神经模糊系统或神经网络。In a possible implementation manner, the first histogram enhancement coefficient generator and the second histogram enhancement coefficient generator include an adaptive neuro-fuzzy system or a neural network.
在一种可能的实现方式中,所述n个子直方图中每个子直方图为经过低通滤波处理后的直方图。In a possible implementation manner, each sub-histogram in the n sub-histograms is a histogram processed by low-pass filtering.
这样得到的子直方图在纵坐标上,从有数据到数据为0可以有一个平滑的过度,而不会导致断崖式的突变,以保证提取特征值的平滑变化,进而确保计算出来的映射曲线的平滑变化,当使用该映射曲线处理图像时保证图像的画面亮度的稳定性。The sub-histogram obtained in this way can have a smooth transition from the data to the data 0 on the ordinate, without causing a cliff-like mutation, so as to ensure the smooth change of the extracted feature value, and then to ensure the calculated mapping curve The smooth change of the image is used to ensure the stability of the image brightness when the mapping curve is used to process the image.
在一种可能的实现方式中,所述将所述直方图划分成n个子直方图之前,还包括:对所述直方图进行亮度变换处理;所述将所述直方图划分成n个子直方图,包括:将亮度变换后的直方图划分成n个子直方图。In a possible implementation manner, before dividing the histogram into n sub-histograms, the method further includes: performing brightness transformation processing on the histogram; and dividing the histogram into n sub-histograms , Including: dividing the histogram after the brightness transformation into n sub-histograms.
在一种可能的实现方式中,所述将所述直方图划分成n个子直方图之后,还包括:对所述n个子直方图中每个子直方图进行亮度变换处理。In a possible implementation manner, after dividing the histogram into n sub-histograms, the method further includes: performing brightness transformation processing on each sub-histogram in the n sub-histograms.
在一种可能的实现方式中,所述对所述n个子直方图的映射曲线进行合成得到所述直方图的映射曲线,包括:对所述n个子直方图的映射曲线进行拼接以得到所述直方图的映射曲线,在相邻两个子直方图的映射曲线的连接处的值取平均值、最大值或最小值,所述平均值、最大值或最小值是所述相邻两个子直方图的映射曲线在彼此的连接端的两个取值的平均值,最大值或最小值。In a possible implementation manner, the synthesizing the mapping curves of the n sub-histograms to obtain the mapping curve of the histogram includes: splicing the mapping curves of the n sub-histograms to obtain the The mapping curve of the histogram, the value at the junction of the mapping curves of two adjacent sub-histograms takes the average value, the maximum value or the minimum value, and the average value, the maximum value or the minimum value is the two adjacent sub-histograms The average, maximum or minimum of the two values of the mapping curve at the connection ends of each other.
以保证GTMC的单调性,进而使图像亮度保持原来的相对关系,不会出现反向。In order to ensure the monotonicity of GTMC, the image brightness maintains the original relative relationship, and there will be no reverse.
在一种可能的实现方式中,还包括:根据第一设定参数训练得到所述自适应神经模糊系统,所述第一设定参数包括输入特征隶属度函数参数、输出隶属度函数参数、规则函数。In a possible implementation manner, the method further includes: obtaining the adaptive neuro-fuzzy system by training according to a first set parameter, where the first set parameter includes input feature membership function parameters, output membership function parameters, rules function.
在一种可能的实现方式中,还包括:根据第二设定参数训练得到所述神经网络,所述 第二设定参数包括所述多个特征、隶属度函数计算节点、规则函数中不同组合设计对应输出值。In a possible implementation manner, the method further includes: obtaining the neural network by training according to a second set parameter, where the second set parameter includes different combinations of the multiple features, membership function calculation nodes, and rule functions Design the corresponding output value.
在一种可能的实现方式中,所述根据所述增益曲线系数和所述均衡曲线权重计算得到所述第一子直方图的映射曲线,包括:In a possible implementation manner, the calculation to obtain the mapping curve of the first sub-histogram according to the gain curve coefficient and the equalization curve weight includes:
根据公式(1)计算得到所述第一子直方图的映射曲线:The mapping curve of the first sub-histogram is calculated according to formula (1):
y i=α i×y i_gaini×y i_hist    (1) y ii ×y i_gaini ×y i_hist (1)
其中,y i表示所述第一子直方图的映射曲线,γ i表示所述增益曲线系数,β i表示所述均衡曲线权重,α i=1-β i,y i_gain表示所述第一子直方图的增益曲线,
Figure PCTCN2020080774-appb-000001
j∈[0,m],y i_hist表示所述第一子直方图的均衡曲线。
Wherein, y i represents the mapping curve of the first sub-histogram, γ i represents the gain curve coefficient, β i represents the weight of the equalization curve, α i =1-β i , y i_gain represents the first sub-histogram The gain curve of the histogram,
Figure PCTCN2020080774-appb-000001
j∈[0,m], y i_hist represents the equalization curve of the first sub-histogram.
第二方面,本申请提供一种图像增强处理装置,包括:获取模块,用于获取待处理图像的直方图;处理模块,用于将所述直方图划分成n个子直方图,n为正整数;计算所述n个子直方图中每个子直方图的映射曲线;对所述n个子直方图的映射曲线进行合成得到所述直方图的映射曲线;根据所述直方图的映射曲线对所述待处理图像进行增强处理。In a second aspect, the present application provides an image enhancement processing device, including: an acquisition module for acquiring a histogram of an image to be processed; a processing module for dividing the histogram into n sub-histograms, where n is a positive integer Calculate the mapping curve of each sub-histogram in the n sub-histograms; synthesize the mapping curves of the n sub-histograms to obtain the mapping curve of the histogram; compare the mapping curve of the histogram according to the mapping curve of the histogram Process the image for enhancement.
在一种可能的实现方式中,所述处理模块,具体用于提取每个子直方图的多个特征;根据所述多个特征确定每个子直方图的映射曲线。In a possible implementation manner, the processing module is specifically configured to extract multiple features of each sub-histogram; and determine the mapping curve of each sub-histogram according to the multiple features.
在一种可能的实现方式中,所述多个特征包括子直方图的亮度均值、亮度标准差和像素百分比中的一个或多个,所述像素百分比为所述子直方图中包括的像素数量在所述直方图中包括的像素数量中的占比。In a possible implementation manner, the multiple features include one or more of a brightness average value, a brightness standard deviation, and a pixel percentage of a sub-histogram, and the pixel percentage is the number of pixels included in the sub-histogram The percentage of the number of pixels included in the histogram.
在一种可能的实现方式中,所述处理模块,具体用于根据所述多个特征计算每个子直方图的增益曲线系数和均衡曲线权重;根据所述增益曲线系数和所述均衡曲线权重确定每个子直方图的映射曲线。In a possible implementation manner, the processing module is specifically configured to calculate the gain curve coefficient and the equalization curve weight of each sub-histogram according to the multiple characteristics; determine according to the gain curve coefficient and the equalization curve weight The mapping curve of each sub-histogram.
在一种可能的实现方式中,所述处理模块,具体用于将所述多个特征输入预先训练得到的第一直方图增强系数生成器得到所述增益曲线系数,所述第一直方图增强系数生成器用于计算所述增益曲线系数;将所述多个特征输入预先训练得到的第二直方图增强系数生成器得到所述均衡曲线权重,所述第二直方图增强系数生成器用于计算所述均衡曲线权重。In a possible implementation manner, the processing module is specifically configured to input the multiple features into the first histogram enhancement coefficient generator obtained by pre-training to obtain the gain curve coefficients, and the first histogram The graph enhancement coefficient generator is used to calculate the gain curve coefficients; the second histogram enhancement coefficient generator obtained by pre-training the multiple features is input to obtain the equalization curve weight, and the second histogram enhancement coefficient generator is used for Calculate the weight of the equilibrium curve.
在一种可能的实现方式中,所述处理模块,具体用于将所述多个特征和相邻子直方图的所述多个特征均输入预先训练得到的第一直方图增强系数生成器得到所述增益曲线系数,所述第一直方图增强系数生成器用于计算所述增益曲线系数;将所述多个特征和相邻子直方图的所述多个特征均输入预先训练得到的第二直方图增强系数生成器得到所述均衡曲线权重,所述第二直方图增强系数生成器用于计算所述均衡曲线权重。In a possible implementation manner, the processing module is specifically configured to input the multiple features and the multiple features of the neighboring sub-histograms into the first histogram enhancement coefficient generator obtained by pre-training The gain curve coefficient is obtained, and the first histogram enhancement coefficient generator is used to calculate the gain curve coefficient; and the multiple features and the multiple features of the adjacent sub-histograms are input into pre-trained The second histogram enhancement coefficient generator obtains the equalization curve weight, and the second histogram enhancement coefficient generator is used to calculate the equalization curve weight.
在一种可能的实现方式中,所述第一直方图增强系数生成器和所述第二直方图增强系数生成器包括自适应神经模糊系统或神经网络。In a possible implementation manner, the first histogram enhancement coefficient generator and the second histogram enhancement coefficient generator include an adaptive neuro-fuzzy system or a neural network.
在一种可能的实现方式中,所述n个子直方图中每个子直方图为经过低通滤波处理后的直方图。In a possible implementation manner, each sub-histogram in the n sub-histograms is a histogram processed by low-pass filtering.
在一种可能的实现方式中,所述处理模块,还用于对所述直方图进行亮度变换处理;将亮度变换后的直方图划分成n个子直方图。In a possible implementation manner, the processing module is further configured to perform brightness conversion processing on the histogram; divide the histogram after the brightness conversion into n sub-histograms.
在一种可能的实现方式中,所述处理模块,还用于对所述n个子直方图中每个子直方图进行亮度变换处理。In a possible implementation manner, the processing module is further configured to perform brightness transformation processing on each sub-histogram in the n sub-histograms.
在一种可能的实现方式中,所述处理模块,具体用于对所述n个子直方图的映射曲线进行拼接以得到所述直方图的映射曲线,在相邻两个子直方图的映射曲线的连接处的值取平均值、最大值或最小值,所述平均值、最大值或最小值是所述相邻两个子直方图的映射曲线在彼此的连接端的两个取值的平均值,最大值或最小值。In a possible implementation manner, the processing module is specifically configured to splice the mapping curves of the n sub-histograms to obtain the mapping curve of the histogram, and the mapping curve of the two adjacent sub-histograms is The value at the connection takes the average value, maximum value or minimum value, and the average value, maximum value or minimum value is the average value of the two values of the mapping curves of the two adjacent sub-histograms at the connection ends of each other, and the maximum value Value or minimum value.
在一种可能的实现方式中,所述处理模块,还用于根据第一设定参数训练得到所述自适应神经模糊系统,所述第一设定参数包括输入特征隶属度函数参数、输出隶属度函数参数、规则函数。In a possible implementation manner, the processing module is further configured to train the adaptive neuro-fuzzy system according to a first set parameter, and the first set parameter includes input feature membership function parameters, output membership Degree function parameters, rule functions.
在一种可能的实现方式中,所述处理模块,还用于根据第二设定参数训练得到所述神经网络,所述第二设定参数包括所述多个特征、隶属度函数计算节点、规则函数中不同组合设计对应输出值。In a possible implementation, the processing module is further configured to train the neural network according to a second set parameter, where the second set parameter includes the multiple features, membership function calculation nodes, Different combination designs in the rule function correspond to output values.
在一种可能的实现方式中,所述处理模块,具体用于根据公式(1)计算得到所述第一子直方图的映射曲线:In a possible implementation manner, the processing module is specifically configured to calculate the mapping curve of the first sub-histogram according to formula (1):
y i=α i×y i_gaini×y i_hist    (1) y ii ×y i_gaini ×y i_hist (1)
其中,y i表示所述第一子直方图的映射曲线,γ i表示所述增益曲线系数,β i表示所述均衡曲线权重,α i=1-β i,y i_gain表示所述第一子直方图的增益曲线,
Figure PCTCN2020080774-appb-000002
j∈[0,m],y i_hist表示所述第一子直方图的均衡曲线。
Wherein, y i represents the mapping curve of the first sub-histogram, γ i represents the gain curve coefficient, β i represents the weight of the equalization curve, α i =1-β i , y i_gain represents the first sub-histogram The gain curve of the histogram,
Figure PCTCN2020080774-appb-000002
j∈[0,m], y i_hist represents the equalization curve of the first sub-histogram.
第三方面,本申请提供一种图像增强处理装置,包括:一个或多个处理器;存储器,用于存储一个或多个程序;当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如上述第一方面中任一所述的方法。In a third aspect, the present application provides an image enhancement processing device, including: one or more processors; a memory for storing one or more programs; when the one or more programs are processed by the one or more The processor executes, so that the one or more processors implement the method according to any one of the above-mentioned first aspects.
第四方面,本申请提供一种计算机可读存储介质,所述计算机可读存储介质存储有指令,当所述指令在计算机上运行时,用于执行上述第一方面中任一项所述的方法。In a fourth aspect, the present application provides a computer-readable storage medium that stores instructions, and when the instructions are run on a computer, they are used to execute any of the above-mentioned instructions in the first aspect. method.
附图说明Description of the drawings
图1示例性的示出了一种终端设备100的结构示意图;Fig. 1 exemplarily shows a schematic structural diagram of a terminal device 100;
图2示出了图像获取装置的一个示例性的结构示意图;Fig. 2 shows an exemplary structural schematic diagram of the image acquisition device;
图3为本申请实施例提供的图像增强处理方法实施例的流程图;FIG. 3 is a flowchart of an embodiment of an image enhancement processing method provided by an embodiment of the application;
图4示出了gamma曲线的一个示例性的示意图;Figure 4 shows an exemplary schematic diagram of the gamma curve;
图5示出了滤波器的一个示例性的系数示意图;Fig. 5 shows an exemplary coefficient diagram of the filter;
图6为本申请图像增强处理装置实施例的结构示意图。FIG. 6 is a schematic structural diagram of an embodiment of an image enhancement processing apparatus of this application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请中的附图,对本申请中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be described clearly and completely in conjunction with the accompanying drawings in this application. Obviously, the described embodiments are part of the embodiments of this application. , Not all examples. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
本申请的说明书实施例和权利要求书及附图中的术语“第一”、“第二”等仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元。方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", etc. in the specification embodiments, claims, and drawings of this application are only used for the purpose of distinguishing description, and cannot be understood as indicating or implying relative importance, nor can it be understood as indicating Or imply the order. In addition, the terms "including" and "having" and any variations of them are intended to cover non-exclusive inclusions, for example, including a series of steps or units. The method, system, product, or device need not be limited to those clearly listed steps or units, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products, or devices.
应当理解,在本申请中,“至少一个(项)”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:只存在A,只存在B以及同时存在A和B三种情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b或c中的至少一项(个),可以表示:a,b,c,“a和b”,“a和c”,“b和c”,或“a和b和c”,其中a,b,c可以是单个,也可以是多个。It should be understood that in this application, "at least one (item)" refers to one or more, and "multiple" refers to two or more. "And/or" is used to describe the association relationship of associated objects, indicating that there can be three types of relationships, for example, "A and/or B" can mean: only A, only B, and both A and B , Where A and B can be singular or plural. The character "/" generally indicates that the associated objects before and after are in an "or" relationship. "The following at least one item (a)" or similar expressions refers to any combination of these items, including any combination of a single item (a) or a plurality of items (a). For example, at least one of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c" ", where a, b, and c can be single or multiple.
本申请的终端设备又可称之为用户设备(user equipment,UE),可以部署在陆地上,包括室内或室外、手持或车载;也可以部署在水面上(如轮船等);还可以部署在空中(例如飞机、气球和卫星上等)。终端设备可以是终端设备100(mobile phone)、平板电脑(pad)、带无线收发功能的电脑、虚拟现实(virtual reality,VR)设备、增强现实(augmented reality,AR)设备、监控设备、智能大屏、智能电视、远程医疗(remote medical)中的无线设备或智慧家庭(smart home)中的无线设备等,本申请对此不作限定。The terminal equipment of this application can also be called user equipment (UE), which can be deployed on land, including indoor or outdoor, handheld or vehicle-mounted; it can also be deployed on the water (such as ships, etc.); it can also be deployed on In the air (for example, airplanes, balloons, satellites, etc.). The terminal device can be a terminal device 100 (mobile phone), a tablet computer (pad), a computer with wireless transceiver function, a virtual reality (VR) device, an augmented reality (AR) device, a monitoring device, and a smart phone. This application is not limited to screens, smart TVs, wireless devices in remote medical (remote medical), or wireless devices in smart home (smart home).
图1示例性的示出了一种终端设备100的结构示意图。终端设备100可以包括处理器110,外部存储器接口120,内部存储器121,USB接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块151,无线通信模块152,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及SIM卡接口195等。其中传感器模块180可以包括陀螺仪传感器180A,加速度传感器180B,接近光传感器180G、指纹传感器180H,触摸传感器180K、图像传感器180N(当然,终端设备100还可以包括其它传感器,比如温度传感器,压力传感器、距离传感器、磁传感器、环境光传感器、气压传感器、骨传导传感器等,图中未示出)。Fig. 1 exemplarily shows a schematic structural diagram of a terminal device 100. The terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a USB interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 151, and a wireless communication module 152 , Audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone interface 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194, SIM card interface 195 and so on. The sensor module 180 may include a gyroscope sensor 180A, an acceleration sensor 180B, a proximity light sensor 180G, a fingerprint sensor 180H, a touch sensor 180K, and an image sensor 180N (Of course, the terminal device 100 may also include other sensors, such as temperature sensors, pressure sensors, Distance sensors, magnetic sensors, ambient light sensors, air pressure sensors, bone conduction sensors, etc. (not shown in the figure).
可以理解的是,本申请实施例示意的结构并不构成对终端设备100的具体限定。在本申请另一些实施例中,终端设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or arrange different components. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。其中,控制器可以是终端设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Among them, the different processing units may be independent devices or integrated in one or more processors. The controller may be the nerve center and command center of the terminal device 100. The controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching instructions and executing instructions.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 to store instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can store instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Repeated accesses are avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.
当处理器110集成不同的器件,比如集成CPU和GPU时,CPU和GPU可以配合执行本申请实施例提供的方法,比如该方法中的部分算法由CPU执行,另一部分算法由GPU执行,以得到较快的处理效率。When the processor 110 integrates different devices, such as integrated CPU and GPU, the CPU and GPU can cooperate to execute the method provided in the embodiment of the present application. For example, part of the algorithm in the method is executed by the CPU, and another part of the algorithm is executed by the GPU to obtain Faster processing efficiency.
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,终端设备100可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, videos, and the like. The display screen 194 includes a display panel. The display panel can use liquid crystal display (LCD), organic light-emitting diode (OLED), active matrix organic light-emitting diode or active-matrix organic light-emitting diode (active-matrix organic light-emitting diode). emitting diode, AMOLED, flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal device 100 may include one or N display screens 194, and N is a positive integer greater than one.
摄像头193(前置摄像头或者后置摄像头,或者一个摄像头既可作为前置摄像头,也可作为后置摄像头)用于捕获静态图像或视频。通常,摄像头193可以包括感光元件比如镜头组和图像传感器,其中,镜头组包括多个透镜(凸透镜或凹透镜),用于采集待拍摄物体反射的光信号,并将采集的光信号传递给图像传感器。图像传感器根据所述光信号生成待拍摄物体的原始图像。The camera 193 (a front camera or a rear camera, or a camera can be used as a front camera or a rear camera) is used to capture still images or videos. Generally, the camera 193 may include photosensitive elements such as a lens group and an image sensor, where the lens group includes a plurality of lenses (convex lens or concave lens) for collecting light signals reflected by the object to be photographed and transmitting the collected light signals to the image sensor . The image sensor generates an original image of the object to be photographed according to the light signal.
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行终端设备100的各种功能应用以及信号处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,应用程序(比如相机应用,微信应用等)的代码等。存储数据区可存储终端设备100使用过程中所创建的数据(比如相机应用采集的图像、视频等)等。The internal memory 121 may be used to store computer executable program code, where the executable program code includes instructions. The processor 110 executes various functional applications and signal processing of the terminal device 100 by running instructions stored in the internal memory 121. The internal memory 121 may include a storage program area and a storage data area. Among them, the storage program area can store operating system, application program (such as camera application, WeChat application, etc.) codes and so on. The storage data area can store data created during the use of the terminal device 100 (such as images and videos collected by a camera application) and the like.
此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.
当然,本申请实施例提供的方法的代码还可以存储在外部存储器中。这种情况下,处理器110可以通过外部存储器接口120运行存储在外部存储器中的代码。Of course, the code of the method provided in the embodiments of the present application may also be stored in an external memory. In this case, the processor 110 may run the code stored in the external memory through the external memory interface 120.
下面介绍传感器模块180的功能。The function of the sensor module 180 is described below.
陀螺仪传感器180A,可以用于确定终端设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180A确定终端设备100围绕三个轴(即,x,y和z轴)的角速度。即陀螺仪传感器180A可以用于检测终端设备100当前的运动状态,比如抖动还是静止。The gyroscope sensor 180A may be used to determine the movement posture of the terminal device 100. In some embodiments, the angular velocity of the terminal device 100 around three axes (ie, x, y, and z axes) can be determined by the gyro sensor 180A. That is, the gyro sensor 180A can be used to detect the current motion state of the terminal device 100, such as shaking or static.
加速度传感器180B可检测终端设备100在各个方向上(一般为三轴)加速度的大小。即加速度传感器180B可以用于检测终端设备100当前的运动状态,比如抖动还是静止。The acceleration sensor 180B can detect the magnitude of the acceleration of the terminal device 100 in various directions (generally three axes). That is, the acceleration sensor 180B can be used to detect the current motion state of the terminal device 100, such as shaking or static.
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。终端设备100通过发光二极管向外发射红外光。终端设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定终端设备100附近有物体。当检测到不充分的反射光时,终端设备100可以确定终端设备100附近没有物体。The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector such as a photodiode. The light emitting diode may be an infrared light emitting diode. The terminal device 100 emits infrared light to the outside through the light emitting diode. The terminal device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the terminal device 100. When insufficient reflected light is detected, the terminal device 100 can determine that there is no object near the terminal device 100.
陀螺仪传感器180A(或加速度传感器180B)可以将检测到的运动状态信息(比如角速度)发送给处理器110。处理器110基于运动状态信息确定当前是手持状态还是脚架状态(比如,角速度不为0时,说明终端设备100处于手持状态)。The gyroscope sensor 180A (or the acceleration sensor 180B) may send the detected motion state information (such as angular velocity) to the processor 110. The processor 110 determines whether it is currently in the hand-held state or the tripod state based on the motion state information (for example, when the angular velocity is not 0, it means that the terminal device 100 is in the hand-held state).
指纹传感器180H用于采集指纹。终端设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180H is used to collect fingerprints. The terminal device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photographs, fingerprint answering calls, and so on.
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于终端设备100的表面,与显示屏194所处的位置不同。 Touch sensor 180K, also called "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch screen is composed of the touch sensor 180K and the display screen 194, which is also called a “touch screen”. The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. The visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the terminal device 100, which is different from the position of the display screen 194.
示例性的,终端设备100的显示屏194显示主界面,主界面中包括多个应用(比如相机应用、微信应用等)的图标。用户通过触摸传感器180K点击主界面中相机应用的图标,触发处理器110启动相机应用,打开摄像头193。显示屏194显示相机应用的界面,例如取景界面。Exemplarily, the display screen 194 of the terminal device 100 displays a main interface, and the main interface includes icons of multiple applications (such as a camera application, a WeChat application, etc.). The user clicks the icon of the camera application in the main interface through the touch sensor 180K, triggers the processor 110 to start the camera application, and turns on the camera 193. The display screen 194 displays an interface of the camera application, such as a viewfinder interface.
图像传感器180N利用光电器件的光电转换功能,将感光面上的光信号转换为与光信号成相应比例关系的电信号。其可以根据光信号生成待拍摄物体的原始图像数据(RAW格式图像)。The image sensor 180N uses the photoelectric conversion function of the photoelectric device to convert the light signal on the photosensitive surface into an electrical signal proportional to the light signal. It can generate raw image data (RAW format image) of the object to be photographed based on the light signal.
终端设备100的无线通信功能可以通过天线1,天线2,移动通信模块151,无线通信模块152,调制解调处理器以及基带处理器等实现。The wireless communication function of the terminal device 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 151, the wireless communication module 152, the modem processor, and the baseband processor.
天线1和天线2用于发射和接收电磁波信号。终端设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the terminal device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna can be used in combination with a tuning switch.
移动通信模块151可以提供应用在终端设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块151可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块151可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块151还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块151的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块151的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 151 can provide a wireless communication solution including 2G/3G/4G/5G and the like applied to the terminal device 100. The mobile communication module 151 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), and the like. The mobile communication module 151 can receive electromagnetic waves by the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 151 can also amplify the signal modulated by the modem processor, and convert it into electromagnetic wave radiation via the antenna 1. In some embodiments, at least part of the functional modules of the mobile communication module 151 may be provided in the processor 110. In some embodiments, at least part of the functional modules of the mobile communication module 151 and at least part of the modules of the processor 110 may be provided in the same device.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块151或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be provided in the same device as the mobile communication module 151 or other functional modules.
无线通信模块152可以提供应用在终端设备100上的包括无线局域网(wireless local  area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块152可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块152经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块152还可以从处理器110接收待发送的信号,对其进行调频、放大,经天线2转为电磁波辐射出去。The wireless communication module 152 can provide applications on the terminal device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), and global navigation satellites. System (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 152 may be one or more devices integrating at least one communication processing module. The wireless communication module 152 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 152 can also receive the signal to be sent from the processor 110, perform frequency modulation and amplification, and convert it into electromagnetic waves to radiate through the antenna 2.
在一些实施例中,终端设备100的天线1和移动通信模块151耦合,天线2和无线通信模块152耦合,使得终端设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。In some embodiments, the antenna 1 of the terminal device 100 is coupled with the mobile communication module 151, and the antenna 2 is coupled with the wireless communication module 152, so that the terminal device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code division multiple access (wideband code division multiple access, WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite-based augmentation systems (SBAS).
另外,终端设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。终端设备100可以接收按键190输入,产生与终端设备100的用户设置以及功能控制有关的键信号输入。终端设备100可以利用马达191产生振动提示(比如来电振动提示)。终端设备100中的指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。终端设备100中的SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和终端设备100的接触和分离。In addition, the terminal device 100 may implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. For example, music playback, recording, etc. The terminal device 100 may receive a key 190 input, and generate a key signal input related to user settings and function control of the terminal device 100. The terminal device 100 may use the motor 191 to generate a vibration notification (such as a vibration notification of an incoming call). The indicator 192 in the terminal device 100 may be an indicator light, which may be used to indicate the charging status, power change, or to indicate messages, missed calls, notifications, and so on. The SIM card interface 195 in the terminal device 100 is used to connect to a SIM card. The SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the terminal device 100.
应理解,在实际应用中,终端设备100可以包括比图1所示的更多或更少的部件,本申请实施例不作限定。It should be understood that, in actual applications, the terminal device 100 may include more or less components than those shown in FIG. 1, which is not limited in the embodiment of the present application.
图2示出了图像获取装置的一个示例性的结构示意图,如图2所示,该图像获取装置包括镜头201、图像传感器202和图像信号处理器(image signal processor,ISP)203组成。其中,镜头201用于捕获静态图像或视频,采集待拍摄物体反射的光信号,并将采集的光信号传递给图像传感器。图像传感器202根据所述光信号生成待拍摄物体的原始图像数据(RAW格式图像)。ISP 203用于将RAW格式图像处理为适应人眼观察或显示器显示的图像,并在此过程中对可见光曝光参数和/或红外补光灯的光强进行调整直到满足自动曝光(automatic exposure,AE)算法的收敛条件。本实施例中的镜头201可以是图1所示终端设备中的摄像头193,图像传感器202可以是图1所示终端设备中的传感器模块180中的图像传感器180N,ISP 203可以是图1所示终端设备中的处理器110。FIG. 2 shows an exemplary structural diagram of an image acquisition device. As shown in FIG. 2, the image acquisition device includes a lens 201, an image sensor 202, and an image signal processor (ISP) 203. The lens 201 is used to capture still images or videos, collect light signals reflected by objects to be photographed, and transmit the collected light signals to the image sensor. The image sensor 202 generates raw image data (RAW format image) of the object to be photographed according to the light signal. ISP 203 is used to process the RAW format image into an image suitable for human observation or display, and in this process, it adjusts the visible light exposure parameters and/or the intensity of the infrared fill light until the automatic exposure (AE) is satisfied. ) The convergence condition of the algorithm. The lens 201 in this embodiment may be the camera 193 in the terminal device shown in FIG. 1, the image sensor 202 may be the image sensor 180N in the sensor module 180 in the terminal device shown in FIG. 1, and the ISP 203 may be as shown in FIG. The processor 110 in the terminal device.
可选的,图像获取装置可以采用单镜头加单图像传感器,或者双镜头加双图像传感器,或者单镜头加分光片和双图像传感器的结构,其中单镜头的结构可以节约成本,而单图像传感器的结构可以简化摄像头的结构。本申请对此不做具体限定。Optionally, the image acquisition device may adopt a single lens plus a single image sensor, or a dual lens plus a dual image sensor, or a single lens plus a beam splitter and a dual image sensor structure. The single lens structure can save cost, while the single image The structure of the sensor can simplify the structure of the camera. This application does not specifically limit this.
图3为本申请实施例提供的图像增强处理方法实施例的流程图,如图3所示,本实施例的方法可以由上述终端设备、图像获取装置或处理器执行。该图像增强处理方法可以包括:FIG. 3 is a flowchart of an embodiment of an image enhancement processing method provided by an embodiment of the application. As shown in FIG. 3, the method in this embodiment may be executed by the above-mentioned terminal device, image acquisition device, or processor. The image enhancement processing method may include:
步骤301、获取待处理图像的直方图。Step 301: Obtain a histogram of the image to be processed.
直方图是一种亮度统计图,其横坐标为待处理图像中的像素的亮度值,纵坐标为亮度值所对应的像素个数(表示待处理图像中是某个亮度值的像素共有多少个)。需要说明的是,直方图中的亮度值可以是按照某一粒度进行采样得到的亮度值,例如,待处理图像的亮度范围为0-255,若在每个整数值取样,则直方图的横坐标包括256个坐标值,即0、1、…、254、255;若每间隔一个整数值取样,则直方图的横坐标包括128个坐标值,即0、2、…、252、254;若每间隔0.5个整数值取样,则直方图的横坐标包括512个坐标值,即0、0.5、…、254.5、255。对此本申请不做具体限定。直方图中的像素个数也可以按照某一粒度进行采样获得,例如,待处理图像的像素阵列为400×600,若按每个像素点采样,则直方图中的所有像素个数的总和为400×600;若按照每隔一个像素点采样,则直方图中的所有像素个数的总和为400×600的一半。对此本申请也不做具体限定。The histogram is a kind of brightness statistical graph. Its abscissa is the brightness value of the pixels in the image to be processed, and the ordinate is the number of pixels corresponding to the brightness value (representing how many pixels in the image to be processed are of a certain brightness value) ). It should be noted that the brightness value in the histogram can be the brightness value obtained by sampling according to a certain granularity. For example, the brightness range of the image to be processed is 0-255. If sampling at each integer value, the horizontal of the histogram The coordinates include 256 coordinate values, namely 0, 1, ..., 254, 255; if an integer value is sampled every interval, the abscissa of the histogram includes 128 coordinate values, namely 0, 2, ..., 252, 254; if Every 0.5 integer values are sampled, the abscissa of the histogram includes 512 coordinate values, namely 0, 0.5, ..., 254.5, 255. There is no specific limitation on this application. The number of pixels in the histogram can also be sampled at a certain granularity. For example, the pixel array of the image to be processed is 400×600. If sampling is done for each pixel, the sum of all the pixels in the histogram is 400×600; if sampling every other pixel, the sum of all the pixels in the histogram is half of 400×600. This application is not specifically limited.
步骤302、将直方图划分成n个子直方图。Step 302: Divide the histogram into n sub-histograms.
n为正整数。本申请对直方图的划分是基于直方图的横坐标,为了保证子直方图之间过渡平滑,相邻两个子直方图可以有重叠,也可以不重叠。例如,直方图的横坐标包括256个坐标值0-255,按照每个直方图包括64个坐标值,可以将该直方图分为相互不重叠的4个子直方图,分别对应横坐标的范围是[0,63]、[64,127]、[128,191]和[192,255]。又例如,直方图的横坐标包括256个坐标值0-255,按照每个直方图包括70个坐标值,可以将该直方图分为相邻两个子直方图会重叠的4个子直方图,分别对应横坐标的范围是[0,69]、[61,130]、[125,194]和[186,255]。又例如,直方图的横坐标包括256个坐标值0-255,可以将该直方图分为相互不重叠的4个子直方图,分别对应横坐标的范围是[0,69]、[70,130]、[131,191]和[192,255],这4个子直方图分别包括的坐标值数量并不完全相等。需要说明的是,对待处理图像的直方图的划分可以采用多种规则实现,例如,等长度/不等长度划分、可重叠划分、不可重叠划分等等,对此本申请不做具体限定。n is a positive integer. The division of the histogram in this application is based on the abscissa of the histogram. To ensure smooth transition between sub-histograms, two adjacent sub-histograms may or may not overlap. For example, the abscissa of the histogram includes 256 coordinate values 0-255, and each histogram includes 64 coordinate values. The histogram can be divided into 4 sub-histograms that do not overlap each other, and the range of the corresponding abscissa is [0,63], [64,127], [128,191] and [192,255]. For another example, the abscissa of the histogram includes 256 coordinate values 0-255, and each histogram includes 70 coordinate values. The histogram can be divided into 4 sub-histograms where two adjacent sub-histograms will overlap, respectively. The corresponding abscissa ranges are [0,69], [61,130], [125,194] and [186,255]. For another example, the abscissa of the histogram includes 256 coordinate values 0-255. The histogram can be divided into 4 sub-histograms that do not overlap each other. The ranges of the corresponding abscissas are [0,69], [70,130], [131,191] and [192,255], the number of coordinate values included in the four sub-histograms are not completely equal. It should be noted that the division of the histogram of the image to be processed can be implemented using multiple rules, such as equal length/unequal length division, overlapping division, non-overlapping division, etc., which are not specifically limited in this application.
由于ISP中有很多与亮度相关的处理模块会对图像的亮度产生较大影响,其中最主要影响亮度的是伽马(gamma)曲线,图4示出了gamma曲线的一个示例性的示意图,如图4所示,横坐标表示原始亮度值,纵坐标表示映射亮度值,gamma曲线用于表示原始亮度值和映射亮度值之间的对应关系。因此为了在后续步骤提取到更加准确的图像特征,可以对直方图进行亮度变换处理,该亮度变换处理可以包括gamma变换或其他亮度变换方法,本申请对此不作具体限定。Since there are many brightness-related processing modules in the ISP that will have a greater impact on the brightness of the image, the most important impact on the brightness is the gamma curve. Figure 4 shows an exemplary schematic diagram of the gamma curve, such as As shown in FIG. 4, the abscissa represents the original brightness value, the ordinate represents the mapped brightness value, and the gamma curve is used to represent the correspondence between the original brightness value and the mapped brightness value. Therefore, in order to extract more accurate image features in subsequent steps, the histogram may be subjected to brightness conversion processing, which may include gamma conversion or other brightness conversion methods, which is not specifically limited in this application.
在一种可能的实现方式中,可以先对待处理图像的直方图进行上述亮度变换处理,然后再依据亮度变换后的直方图的横坐标将亮度变换后的直方图划分成n个子直方图。In a possible implementation manner, the above-mentioned brightness conversion process may be performed on the histogram of the image to be processed first, and then the histogram after the brightness conversion is divided into n sub-histograms according to the abscissa of the histogram after the brightness conversion.
在一种可能的实现方式中,也可以在依据直方图的横坐标将直方图划分成n个子直方图之后,再对每个子直方图分别进行上述亮度变换处理。In a possible implementation manner, after the histogram is divided into n sub-histograms according to the abscissa of the histogram, the above-mentioned brightness transformation processing is performed on each sub-histogram separately.
另外,本申请将待处理图像的直方图划分成n个子直方图后,可以对每个子直方图动态范围进行扩展。如上所述,每个子直方图的横坐标的范围是待处理图像的直方图的横坐标的范围的子集,可以将每个子直方图的横坐标的范围扩展至待处理图像的直方图的横坐 标的范围,但在扩展范围内纵坐标的值为0。例如,横坐标的范围是[70,130]的子直方图,扩展后其横坐标的范围是[0,255],但是在除[70,130]外的横坐标所对应的纵坐标值均为0,表示该子直方图在这些亮度值上是没有对应的像素的。In addition, after the application divides the histogram of the image to be processed into n sub-histograms, the dynamic range of each sub-histogram can be expanded. As described above, the range of the abscissa of each sub-histogram is a subset of the range of the abscissa of the histogram of the image to be processed, and the range of the abscissa of each sub-histogram can be extended to the abscissa of the histogram of the image to be processed. The range of coordinates, but the value of the ordinate in the extended range is 0. For example, the range of the abscissa is the sub-histogram of [70,130], and the range of the abscissa after expansion is [0,255], but the ordinates corresponding to the abscissas except [70,130] are all 0, indicating that The histogram has no corresponding pixels in these brightness values.
可选的,本申请还可以对每个子直方图进行增强处理,该增强处理可以包括均衡化处理(将整个直方图在横坐标上按比例扩大或缩小间距)、左移处理(整个直方图向左移动x+个坐标单位)或右移处理(整个直方图向右移动x-个坐标单位)等。具体采用哪种方法对某一个子直方图进行增强处理,可以根据该子直方图的亮度分布,或者根据该子直方图的亮度分布以及与该子直方图相邻的子直方图的亮度分布来确定。本申请对此不作具体限定。Optionally, the present application can also perform enhancement processing on each sub-histogram, and the enhancement processing can include equalization processing (enlarge or reduce the spacing of the entire histogram proportionally on the abscissa), left shift processing (the entire histogram is Left move x + coordinate units) or right shift processing (the entire histogram moves to the right x- coordinate units), etc. The specific method used to enhance a certain sub-histogram can be based on the brightness distribution of the sub-histogram, or according to the brightness distribution of the sub-histogram and the brightness distribution of the sub-histogram adjacent to the sub-histogram. Sure. This application does not specifically limit this.
步骤303、计算n个子直方图中每个子直方图的映射曲线。Step 303: Calculate the mapping curve of each sub-histogram in the n sub-histograms.
第一子直方图为n个子直方图中的任意一个。以下以第一子直方图为例对步骤303进行说明。The first sub-histogram is any one of the n sub-histograms. The step 303 is described below by taking the first sub-histogram as an example.
可选的,本申请可以对第一子直方图进行低通滤波处理,例如采用滤波系数均值为0、方差为10的高斯滤波器。图5示出了滤波器的一个示例性的系数示意图,如图5所示,横坐标表示子直方图的亮度,纵坐标表示对应亮度的权重。例如,若设计子直方图包括16个坐标值([16,32]),从左右相邻子直方图各取一半坐标值([8,16]和[32,40]),加上本子直方图的全部坐标值组成包含32个坐标值([8,40])的子直方图,本子直方图内的权重可以设置为1,即横坐标[16,32]对应的纵坐标为1,相邻子直方图内的权重呈高斯变化,越远离本子直方图,权重越小,即横坐标[8,16]中横坐标越小权重越小,横坐标[32,40]中横坐标越大权重越小。这样得到的子直方图在纵坐标上,从有数据到数据为0可以有一个平滑的过度,而不会导致断崖式的突变,以保证提取特征值的平滑变化,进而确保计算出来的映射曲线的平滑变化,当使用该映射曲线处理图像时保证图像的画面亮度的稳定性。Optionally, the present application may perform low-pass filtering processing on the first sub-histogram, for example, a Gaussian filter with a mean value of 0 filter coefficients and a variance of 10 may be used. Fig. 5 shows an exemplary coefficient diagram of the filter. As shown in Fig. 5, the abscissa represents the brightness of the sub-histogram, and the ordinate represents the weight of the corresponding brightness. For example, if the design sub-histogram includes 16 coordinate values ([16,32]), half of the coordinate values ([8,16] and [32,40]) are taken from the left and right adjacent sub-histograms, and the sub-histogram is added All the coordinate values of the graph compose a sub-histogram containing 32 coordinate values ([8,40]). The weight in this sub-histogram can be set to 1, that is, the horizontal coordinate [16,32] corresponds to the vertical coordinate 1, which corresponds to The weight in the neighbor histogram changes Gaussian. The farther away from the histogram, the smaller the weight, that is, the smaller the abscissa in the abscissa [8,16], the smaller the weight, and the larger the abscissa in the abscissa [32,40]. The smaller the weight. The sub-histogram obtained in this way can have a smooth transition from the data to the data 0 on the ordinate, without causing a cliff-like mutation, so as to ensure the smooth change of the extracted feature value, and then to ensure the calculated mapping curve The smooth change of the image is used to ensure the stability of the image brightness when the mapping curve is used to process the image.
本申请先提取第一子直方图的多个特征;根据多个特征计算得到第一子直方图的增益曲线系数和均衡曲线权重;根据增益曲线系数和均衡曲线权重计算得到第一子直方图的映射曲线。This application first extracts multiple features of the first sub-histogram; calculates the gain curve coefficients and equalization curve weights of the first sub-histogram based on the multiple features; calculates the gain curve coefficients and equalization curve weights of the first sub-histogram based on the gain curve coefficients and the equalization curve weights Map the curve.
上述第一子直方图的多个特征可以包括且不限于灰度均值、方差等特征。优选第一子直方图的亮度均值、亮度标准差和像素百分比。The multiple features of the above-mentioned first sub-histogram may include, but are not limited to, features such as gray-level mean value and variance. Preferably, the brightness average value, the brightness standard deviation and the pixel percentage of the first sub-histogram.
其中,亮度均值是指第一子直方图中包括的所有亮度值的加权平均值,其计算公式可以是
Figure PCTCN2020080774-appb-000003
r表示亮度均值,x i表示第i个亮度值,a i表示第i个亮度值的权重,N表示第一子直方图包括的亮度值的个数。各个亮度值的权重是根据该亮度值对应的纵坐标值确定的,纵坐标值越高,权重值越大。如果是对每个子直方图的动态范围做过扩展,那么在对应纵坐标值为0的亮度值上,其权重值可以设为0。
Among them, the brightness average refers to the weighted average of all the brightness values included in the first sub-histogram, and the calculation formula can be
Figure PCTCN2020080774-appb-000003
r represents the average brightness value, x i represents the i-th brightness value, a i represents the weight of the i-th brightness value, and N represents the number of brightness values included in the first sub-histogram. The weight of each brightness value is determined according to the ordinate value corresponding to the brightness value. The higher the ordinate value, the greater the weight value. If the dynamic range of each sub-histogram has been extended, the weight value can be set to 0 for the brightness value corresponding to the ordinate value of 0.
亮度标准差是指第一子直方图中包括的所有亮度值和亮度均值的均方差,其计算公式可以是
Figure PCTCN2020080774-appb-000004
δ(r)表示亮度标准差。
The brightness standard deviation refers to the mean square deviation of all the brightness values and the brightness average included in the first sub-histogram, and the calculation formula can be
Figure PCTCN2020080774-appb-000004
δ(r) represents the standard deviation of brightness.
像素百分比是指第一子直方图中包括的像素数量在待处理图像的直方图中包括的像素数量中的占比,其计算公式可以是
Figure PCTCN2020080774-appb-000005
其中,p表示像素百分比,m表示第一子直方图中包括的像素数量,M表示待处理图像的直方图中包括的像素数量。
Pixel percentage refers to the proportion of the number of pixels included in the first sub-histogram in the number of pixels included in the histogram of the image to be processed, and its calculation formula can be
Figure PCTCN2020080774-appb-000005
Among them, p represents the percentage of pixels, m represents the number of pixels included in the first sub-histogram, and M represents the number of pixels included in the histogram of the image to be processed.
如上所述,在划分待处理图像的直方图时,子直方图之间可能存在重叠,也可能没有重叠。针对没有重叠的情况,在计算上述特征值时,公式中的参数的取值范围通常就被限制在在第一子直方图的横坐标的范围内,例如,第一子直方图的横坐标的范围为[0,63],那么求亮度均值和亮度标准差时,x i的取值范围就在[0,63],具体即0、1、…、62、63,而统计m时就在0、1、…、62、63这些横坐标对应的纵坐标上取值。可选的,该情况下,公式中的参数的取值范围也可以超出第一子直方图的横坐标的范围,例如,x i的取值范围就在[0,65],具体即0、1、…、64、65,统计m时就在0、1、…、64、65这些横坐标对应的纵坐标上取值。或者公式中的参数的取值范围小于第一子直方图的横坐标的范围,例如,x i的取值范围就在[0,60],具体即0、1、…、59、60,统计m时就在0、1、…、59、60这些横坐标对应的纵坐标上取值。而针对存在重叠的情况,在计算上述特征值时,公式中的参数的取值范围可以只取第一子直方图的横坐标的范围中没有重叠的子集,例如,第一子直方图的横坐标的范围为[0,69],其中[61,69]和相邻的子直方图重叠,那么求亮度均值和亮度标准差时,x i的取值范围就在[0,60],具体即0、1、…、59、60,而统计m时就在0、1、…、59、60这些横坐标对应的纵坐标上取值。可选的,该情况下,公式中的参数的取值范围也可以既取第一子直方图的横坐标的范围中没有重叠的子集,也可以取第一子直方图的横坐标的范围中有重叠的子集,例如,x i的取值范围就在[0,69],具体即0、1、…、68、69,而统计m时就在0、1、…、68、69这些横坐标对应的纵坐标上取值。可选的,该情况下,公式中的参数的取值范围也可以既取第一子直方图的横坐标的范围中没有重叠的子集,也可以取第一子直方图的横坐标的范围中有重叠的子集的子集,例如,x i的取值范围就在[0,69],具体即0、1、…、64、65,而统计m时就在0、1、…、64、65这些横坐标对应的纵坐标上取值。 As mentioned above, when dividing the histogram of the image to be processed, there may or may not be overlap between the sub-histograms. In the case of no overlap, when calculating the above eigenvalues, the value range of the parameters in the formula is usually limited to the range of the abscissa of the first sub-histogram, for example, the abscissa of the first sub-histogram The range is [0,63], then when calculating the brightness mean and the brightness standard deviation, the value range of x i is in [0,63], specifically 0, 1, ..., 62, 63, and when counting m, it is in 0, 1,..., 62, 63, these abscissas correspond to the ordinates. Optionally, in this case, the value range of the parameter in the formula may also exceed the range of the abscissa of the first sub-histogram. For example, the value range of x i is in [0,65], specifically 0, 1,..., 64, 65, when counting m, take the value on the ordinate corresponding to the abscissas of 0, 1,..., 64, 65. Or the value range of the parameter in the formula is smaller than the range of the abscissa of the first sub-histogram. For example, the value range of x i is [0,60], specifically 0, 1,..., 59, 60, statistics In the case of m, take the value on the ordinate corresponding to the abscissas of 0, 1, ..., 59, and 60. In the case of overlap, when calculating the above eigenvalues, the value range of the parameter in the formula can only take a subset of the abscissa of the first sub-histogram that does not overlap, for example, the first sub-histogram The range of the abscissa is [0,69], where [61,69] overlaps with the adjacent sub-histogram, then when calculating the brightness mean and the brightness standard deviation, the value range of x i is in [0,60], Specifically, they are 0, 1,..., 59, 60, and when counting m, take values on the ordinates corresponding to the abscissas of 0, 1,..., 59, and 60. Optionally, in this case, the value range of the parameter in the formula can also be a subset that does not overlap in the range of the abscissa of the first sub-histogram, or the range of the abscissa of the first sub-histogram. There are overlapping subsets in, for example, the value range of x i is in [0,69], specifically 0, 1,..., 68, 69, and m is in the range of 0, 1,..., 68, 69 These abscissas correspond to values on the ordinates. Optionally, in this case, the value range of the parameter in the formula can also be a subset that does not overlap in the range of the abscissa of the first sub-histogram, or the range of the abscissa of the first sub-histogram. For example, the value range of x i is in [0,69], specifically 0, 1,..., 64, 65, and m is in the range of 0, 1,..., 64 and 65 are taken on the ordinate corresponding to these abscissas.
需要说明的是,本申请在提取子直方图的特征值时,对于公式中的参数的取值范围可以只取对应的子直方图的横坐标的范围内的所有或部分值,也可以取对应的子直方图的横坐标的范围外扩展部分的值,可以只取对应的子直方图的横坐标的范围内没有重叠的子集,也可以取对应的子直方图的横坐标的范围内没有重叠的子集和有重叠的子集的全部或部分。本申请对此不作具体限定。It should be noted that when extracting the feature value of the sub-histogram in this application, the value range of the parameter in the formula can only take all or part of the value within the range of the abscissa of the corresponding sub-histogram, or it can take the corresponding The value of the extended part outside the range of the abscissa of the sub-histogram can only take the subset of the corresponding sub-histogram that does not overlap within the range of the abscissa, or it can also take the corresponding sub-histogram that does not have the range of the abscissa All or part of overlapping subsets and overlapping subsets. This application does not specifically limit this.
本申请根据上述多个特征计算得到第一子直方图的增益曲线系数和均衡曲线权重可以包括:将多个特征输入预先训练得到的第一直方图增强系数生成器得到增益曲线系数,第一直方图增强系数生成器用于计算增益曲线系数;将多个特征输入预先训练得到的第二直方图增强系数生成器得到均衡曲线权重,第二直方图增强系数生成器用于计算均衡曲线权重。This application calculates the gain curve coefficients and equalization curve weights of the first sub-histogram according to the above multiple features may include: inputting multiple features into the first histogram enhancement coefficient generator obtained by pre-training to obtain the gain curve coefficients, first The histogram enhancement coefficient generator is used to calculate the gain curve coefficients; the second histogram enhancement coefficient generator obtained by pre-training multiple features is input to obtain the equalization curve weight, and the second histogram enhancement coefficient generator is used to calculate the equalization curve weight.
第一直方图增强系数生成器和第二直方图增强系数生成器包括自适应神经模糊系统(Adaptive Network-based Fuzzy Inference System,ANFIS)或神经网络。第一直方图增强系数生成器用于输出增益曲线系数,第二直方图增强系数生成器用于输出均衡曲线权重。The first histogram enhancement coefficient generator and the second histogram enhancement coefficient generator include an Adaptive Network-based Fuzzy Inference System (ANFIS) or a neural network. The first histogram enhancement coefficient generator is used to output gain curve coefficients, and the second histogram enhancement coefficient generator is used to output equalization curve weights.
以下以ANFIS为例,对增益曲线系数的输出过程进行说明。标准ANFIS包括输入层、隶属度层、规则层和解模糊层。The following takes ANFIS as an example to illustrate the output process of gain curve coefficients. The standard ANFIS includes an input layer, a membership layer, a rule layer and a defuzzification layer.
(1)输入层接收第一子直方图的多个特征,该多个特征例如可以是上述第一子直方图的亮度均值、亮度标准差和像素百分比。需要说明的是多个特征并不限于前述三个,还可以包括其他特征,对此不作具体限定。(1) The input layer receives multiple features of the first sub-histogram, and the multiple features may be, for example, the brightness average, the brightness standard deviation, and the pixel percentage of the first sub-histogram. It should be noted that the multiple features are not limited to the aforementioned three, and may also include other features, which are not specifically limited.
(2)隶属度层针对每个特征有多档隶属度函数。根据隶属度函数计算每个特征值在对应档位的隶属度。隶属度函数可以是三角形、梯形、高斯型等,每个档位之间的隶属度函数可以有重叠的部分,以保证平滑过渡。每个特征值的隶属度函数不同,根据需要可以设计的档位数量不同。例如,设计的隶属度函数为梯形,有三个档位,范围1-8为低档位,12-18为中档位,22-30为高档位,8-12为低档位和中档位梯形斜边的交叠区域,18-22为中档位和高档位梯形斜边的交叠区域。如果特征值为亮度均值,输入5,则计算出三个档位的隶属度为1,0,0,输入10,则计算出三个档位的隶属度为0.5,0.5,0。(2) The membership level has multiple membership functions for each feature. Calculate the membership degree of each characteristic value in the corresponding gear according to the membership function. The membership function can be triangular, trapezoidal, Gaussian, etc. The membership function between each gear can have overlapping parts to ensure a smooth transition. The membership function of each eigenvalue is different, and the number of gears that can be designed is different according to needs. For example, the designed membership function is trapezoidal with three gears, ranging from 1 to 8 for low gears, 12-18 for middle gears, 22-30 for high gears, 8-12 for low gears and middle gears trapezoidal oblique The overlapping area of the side, 18-22 is the overlapping area of the trapezoidal hypotenuse of the middle gear and the high gear. If the characteristic value is the mean value of brightness, enter 5, then the membership degrees of the three gears are calculated to be 1,0,0, and enter 10, then the membership degrees of the three gears are calculated to be 0.5, 0.5, 0.
(3)规则层采用模糊推理系统(Fuzzy Inference System,FIS)标准规则方式,涵盖输入至隶属函数的所有可能出现的组合方式。不同特征值的不同档位有多种组合方式,规则层设计特征值的组合方式、根据隶属度计算组合权重、并设计组合的对应的系统输出系数的值。(3) The rule layer adopts the fuzzy inference system (Fuzzy Inference System, FIS) standard rule method, covering all possible combinations of input to the membership function. There are many combinations for different gears of different eigenvalues. The rule layer designs the combination of eigenvalues, calculates the combination weight according to the degree of membership, and designs the value of the corresponding system output coefficient of the combination.
(4)解模糊层采用标准FIS的实现方式,包括且不限于最大隶属度法、重心法、加权平均法等。解模糊层根据权重计算结果以及规则层的设计方案,计算出系统需要输出的增益曲线系数。增益曲线系数的计算公式可以是
Figure PCTCN2020080774-appb-000006
其中,γ i表示第i个子直方图的增益曲线系数,b j(j=1,2,…,k)表示规则层输出的第i个子直方图的组合的权重,γ j表示规则层设计的对应组合系统所需输出系数(增益曲线系数)的第j个档位值。
(4) The defuzzification layer adopts standard FIS implementation methods, including but not limited to the maximum membership method, the center of gravity method, and the weighted average method. The defuzzification layer calculates the gain curve coefficient that the system needs to output according to the calculation result of the weight and the design scheme of the rule layer. The calculation formula of the gain curve coefficient can be
Figure PCTCN2020080774-appb-000006
Among them, γ i represents the gain curve coefficient of the i-th sub-histogram, b j (j = 1, 2, ..., k) represents the weight of the combination of the i-th sub-histogram output by the rule layer, and γ j represents the design of the rule layer Corresponding to the j-th gear value of the required output coefficient (gain curve coefficient) of the combined system.
以下同样以ANFIS为例,对均衡曲线权重的输出过程进行说明。The following also takes ANFIS as an example to describe the output process of the equalization curve weight.
(1)输入层接收第一子直方图的多个特征,该多个特征例如可以是上述第一子直方图的亮度均值、亮度标准差和像素百分比。需要说明的是多个特征并不限于前述三个,还可以包括其他特征,对此不作具体限定。(1) The input layer receives multiple features of the first sub-histogram, and the multiple features may be, for example, the brightness average, the brightness standard deviation, and the pixel percentage of the first sub-histogram. It should be noted that the multiple features are not limited to the aforementioned three, and may also include other features, which are not specifically limited.
(2)隶属度层针对每个特征有多档隶属度函数。根据隶属度函数计算每个特征值在对应档位的隶属度。隶属度函数可以是三角形、梯形、高斯型等,每个档位之间的隶属度函数可以有重叠的部分,以保证平滑过渡。每个特征值的隶属度函数不同,根据需要可以设计的档位数量不同。例如,设计的隶属度函数为梯形,有三个档位,范围1-8为低档位,12-18为中档位,22-30为高档位,8-12为低档位和中档位梯形斜边的交叠区域,18-22为中档位和高档位梯形斜边的交叠区域。如果特征值为亮度均值,输入5,则计算出三个档位的隶属度为1,0,0,输入10,则计算出三个档位的隶属度为0.5,0.5,0。(2) The membership level has multiple membership functions for each feature. Calculate the membership degree of each characteristic value in the corresponding gear according to the membership function. The membership function can be triangular, trapezoidal, Gaussian, etc. The membership function between each gear can have overlapping parts to ensure a smooth transition. The membership function of each eigenvalue is different, and the number of gears that can be designed is different according to needs. For example, the designed membership function is trapezoidal with three gears, ranging from 1 to 8 for low gears, 12-18 for middle gears, 22-30 for high gears, 8-12 for low gears and middle gears trapezoidal oblique The overlapping area of the side, 18-22 is the overlapping area of the trapezoidal hypotenuse of the middle gear and the high gear. If the characteristic value is the mean value of brightness, enter 5, then the membership degrees of the three gears are calculated to be 1,0,0, and enter 10, then the membership degrees of the three gears are calculated to be 0.5, 0.5, 0.
(3)规则层采用模糊推理系统(Fuzzy Inference System,FIS)标准规则方式,涵盖输入至隶属函数的所有可能出现的组合方式。计算均衡曲线权重与上述计算增益曲线系数不同之处就在规则层,包括隶属度层隶属度函数的设计、特征值的组合方式、组合权重的计算方式以及组合对应系统输出系数的值均有区别。(3) The rule layer adopts the fuzzy inference system (Fuzzy Inference System, FIS) standard rule method, covering all possible combinations of input to the membership function. The difference between the calculation of the equalization curve weight and the above calculation of the gain curve coefficient lies in the rule layer, including the design of the membership function of the membership layer, the combination of eigenvalues, the calculation of the combination weight, and the value of the system output coefficient corresponding to the combination. .
(4)解模糊层采用标准FIS的实现方式,包括且不限于最大隶属度法、重心法、加权平均法等。解模糊层根据权重计算结果以及规则层的设计方案,计算出系统需要输出的增益曲线系数。均衡曲线权重的计算公式可以是
Figure PCTCN2020080774-appb-000007
其中,β i表示第i个子直方图的均衡曲线权重,c j(j=1,2,…,l)表示规则层输出的第i个子直方图的组合的权重,β j表示规则层设计的对应组合系统所需输出系数(均衡曲线权重)的第j个档位值。
(4) The defuzzification layer adopts standard FIS implementation methods, including but not limited to the maximum membership method, the center of gravity method, and the weighted average method. The defuzzification layer calculates the gain curve coefficient that the system needs to output according to the calculation result of the weight and the design scheme of the rule layer. The formula for calculating the weight of the equilibrium curve can be
Figure PCTCN2020080774-appb-000007
Among them, β i represents the weight of the equalization curve of the i-th sub-histogram, c j (j = 1, 2,..., l) represents the weight of the combination of the i-th sub-histogram output by the rule layer, and β j represents the design of the rule layer Corresponding to the j-th gear value of the required output coefficient (equalization curve weight) of the combined system.
上述第一直方图增强系数生成器和第二直方图增强系数生成器均受一系列参数控制 其输入和输出特性。针对ANFIS,该一系列参数可以包括输入特征隶属度函数参数、输出隶属度函数参数、规则函数等。针对神经网络,该一系列参数可以包括多个特征、隶属度函数计算节点、规则函数中不同组合设计对应输出值。这些参数的生成过程包括:a)采集图像数据训练集1,包括数据集构建,终端设备拍摄包含不同天气、不同光照等条件下的自然场景等,初始化上述参数,选取典型场景观察其子直方图的分布特征,初步设计隶属度函数,第一增强系数规则层各组合值初始化为1,第二增强系数规则层个组合值初始化为一个较小的值,例如5;得到参数集1,包括每个子直方图隶属度函数、生成器输出系数在规则层不同组合设计的值等;b)在训练集1和参数集1上使用初始直方图增强系数生成器生成系数集1,包括第一直方图增强系数生成器输出的增益曲线系数和第二直方图增强系数生成器输出的均衡曲线权重;c)使用系数集1生成GTMC曲线集1,将GTMC曲线集1施加到训练集1上,得到输出集1,并观察效果;d)根据输出集1的亮度和对比度的效果,修正系数集1,得到系数标签集1;e)根据训练集1和系数标签集1对ANFIS进行参数训练,可采用且不限于梯度下降法、遗传算法等通用训练方法;使用训练后的参数集2生成系数集2;f)将参数集2和系数集2替换参数集1和系数集1,重复b~e步骤,直到图像效果达到目标为止,得到训练好的直方图增强系数生成器。可见,利用ANFIS或神经网络等作为增益曲线系数和均衡曲线权重的直方图增强系数生成器,一方面,直方图增强系数生成器自身通过生成—检验—修正—训练—修正—训练的方式可以优化其控制参数,其控制参数可以针对不同场景下的直方图分布的特性进行局部调整,即使在训练好的直方图增强系数生成器上修改某个场景下的例如隶属度函数或规则等控制参数,也不会影响其他场景生成曲线的策略。另一方面,通过直方图增强系数生成器得到的增益曲线系数和均衡曲线权重更符合图像的亮度增强需求,有助于提高图像处理效率。Both the first histogram enhancement coefficient generator and the second histogram enhancement coefficient generator are controlled by a series of parameters to control their input and output characteristics. For ANFIS, the series of parameters can include input feature membership function parameters, output membership function parameters, rule functions, and so on. For neural networks, the series of parameters can include multiple features, membership function calculation nodes, and rule functions to design corresponding output values for different combinations. The generation process of these parameters includes: a) Collect image data training set 1, including data set construction, terminal equipment shooting natural scenes under different weather, different lighting conditions, etc., initialize the above parameters, and select typical scenes to observe its sub-histograms The membership function is initially designed. The combined values of the first enhanced coefficient rule layer are initialized to 1, and the combined values of the second enhanced coefficient rule layer are initialized to a smaller value, such as 5; the parameter set 1 is obtained, including each Sub-histogram membership functions, generator output coefficients in different combinations of design values in the rule layer, etc.; b) Use the initial histogram enhancement coefficient generator on training set 1 and parameter set 1 to generate coefficient set 1, including the first straight The gain curve coefficient output by the graph enhancement coefficient generator and the equalization curve weight output by the second histogram enhancement coefficient generator; c) Use coefficient set 1 to generate GTMC curve set 1, and apply GTMC curve set 1 to training set 1, and get Output set 1, and observe the effect; d) According to the brightness and contrast effect of output set 1, correct coefficient set 1 to obtain coefficient label set 1. e) Perform parameter training on ANFIS according to training set 1 and coefficient label set 1. Use and are not limited to general training methods such as gradient descent method and genetic algorithm; use the trained parameter set 2 to generate coefficient set 2; f) replace parameter set 2 and coefficient set 2 with parameter set 1 and coefficient set 1, and repeat b~e Step, until the image effect reaches the target, a trained histogram enhancement coefficient generator is obtained. It can be seen that using ANFIS or neural network as a histogram enhancement coefficient generator for gain curve coefficients and equalization curve weights, on the one hand, the histogram enhancement coefficient generator itself can be optimized by the method of generation-inspection-correction-training-correction-training Its control parameters can be adjusted locally according to the characteristics of histogram distribution in different scenarios, even if the trained histogram enhancement coefficient generator is used to modify control parameters such as membership functions or rules in a certain scenario, It will not affect the strategy of generating curves in other scenes. On the other hand, the gain curve coefficients and equalization curve weights obtained by the histogram enhancement coefficient generator are more in line with the brightness enhancement requirements of the image, and help to improve the image processing efficiency.
可选的,本申请可以在计算增益曲线系数和均衡曲线权重时,将多个特征和相邻子直方图的多个特征均输入预先训练得到的第一直方图增强系数生成器或第二直方图增强系数生成器,这样输出的数据由于参考了相邻子直方图的亮度分布,在场景变化的时候,可以实现亮度的平缓过渡。Optionally, this application may input multiple features and multiple features of adjacent sub-histograms into the pre-trained first histogram enhancement coefficient generator or the second histogram enhancement coefficient generator when calculating the gain curve coefficients and the equalization curve weights. The histogram enhancement coefficient generator, since the output data in this way refers to the brightness distribution of the adjacent sub-histograms, a smooth transition of brightness can be achieved when the scene changes.
在得到增益曲线系数和均衡曲线权重后,本申请可以根据增益曲线系数和均衡曲线权重计算得到第一子直方图的映射曲线。根据公式(1)计算得到第i个子直方图的映射曲线:After the gain curve coefficient and the equalization curve weight are obtained, the present application can calculate the mapping curve of the first sub-histogram according to the gain curve coefficient and the equalization curve weight. According to formula (1), the mapping curve of the i-th sub-histogram is calculated:
y i=α i×y i_gaini×y i_hist   (1) y ii ×y i_gaini ×y i_hist (1)
其中,y i表示第i个子直方图的映射曲线,β i表示第i个子直方图的均衡曲线权重,α i=1-β i,y i_gain表示第i个子直方图的增益曲线,是用于调节图像亮度的曲线,
Figure PCTCN2020080774-appb-000008
j∈[0,m],γ i表示第i个子直方图的增益曲线系数,pow(j,γ i)=j∧γ i,L表示图像的最大灰阶值,y i_hist表示第i个子直方图的均衡曲线,是用于调节图像对比度的曲线。
Among them, y i represents the mapping curve of the i-th sub-histogram, β i represents the weight of the equalization curve of the i-th sub-histogram, α i = 1-β i , and y i_gain represents the gain curve of the i-th sub-histogram, which is used for Adjust the curve of image brightness,
Figure PCTCN2020080774-appb-000008
j∈[0,m], γ i represents the gain curve coefficient of the i-th sub-histogram, pow(j, γ i )=j∧γ i , L represents the maximum grayscale value of the image, and y i_hist represents the i-th sub-histogram The equalization curve in the figure is a curve used to adjust the contrast of the image.
由此可见,本申请中得到子直方图的映射曲线的关键是增益曲线系数和均衡曲线权重的计算,可以使映射曲线的生成过程参数化,提高了产出效率和准确率。另外,对每个子直方图引入增益曲线系数和均衡曲线权重,可以兼顾调整每个子直方图的亮度分布和对比度分布,达到均衡的目的。It can be seen that the key to obtaining the mapping curve of the sub-histogram in this application is the calculation of the gain curve coefficient and the equalization curve weight, which can parameterize the generation process of the mapping curve and improve the output efficiency and accuracy. In addition, the gain curve coefficient and the equalization curve weight are introduced to each sub-histogram, and the brightness distribution and contrast distribution of each sub-histogram can be adjusted to achieve the purpose of equalization.
步骤304、对n个子直方图的映射曲线进行合成得到直方图的映射曲线。Step 304: Synthesize the mapping curves of the n sub-histograms to obtain the mapping curve of the histogram.
本申请可以对n个子直方图的映射曲线进行拼接得到一条完整的GTMC,即为待处理图像的直方图的映射曲线。拼接的原则可以包括:在扩展范围(上述对子直方图的横坐标扩展至待处理图像的整个横坐标范围内,扩展范围是指除该子直方图扩展前的横坐标范围外的其他横坐标范围)内计算出的映射曲线只在本子直方图内生效,在相邻两个子直方图的拼接处可取均值、较大值或较小值,以此来保证GTMC的单调性,进而使图像亮度保持原来的相对关系,不会出现反向。In this application, the mapping curves of n sub-histograms can be spliced to obtain a complete GTMC, that is, the mapping curve of the histogram of the image to be processed. The principle of splicing can include: in the extended range (the abscissa of the aforementioned pair of histograms extends to the entire abscissa range of the image to be processed, and the extended range refers to other abscissas except the abscissa range of the sub-histogram before expansion The mapping curve calculated in the range) is only valid in the sub-histogram, and the mean, larger or smaller value can be taken at the splicing of two adjacent sub-histograms to ensure the monotonicity of GTMC and thereby make the image brightness Maintain the original relative relationship, and there will be no reverse.
如果相邻两个子直方图没有重叠,则在拼接处,可以采用端点中值连接法(即相邻两个子直方图的映射曲线的端点的纵坐标求平均值),端点最大值连接法(即相邻两个子直方图的映射曲线的端点的纵坐标取较大者),端点最小值连接法(即相邻两个子直方图的映射曲线的端点的纵坐标取较小者)等将两个子直方图的映射曲线拼接。如果相邻两个子直方图有重叠,则在重叠部分,只取其中一个子直方图的映射曲线。If two adjacent sub-histograms do not overlap, the endpoint median connection method (that is, the ordinates of the endpoints of the mapping curves of the two adjacent sub-histograms are averaged), and the endpoint maximum connection method (ie The ordinate of the endpoints of the mapping curves of two adjacent sub-histograms is the larger one), the endpoint minimum connection method (that is, the ordinates of the endpoints of the mapping curves of two adjacent sub-histograms are the smaller), etc. The mapping curve splicing of the histogram. If two adjacent sub-histograms overlap, in the overlapping part, only the mapping curve of one of the sub-histograms is taken.
示例一,直方图的横坐标包括256个坐标值0-255,将该直方图分为相互不重叠的4个子直方图,子直方图1的横坐标的范围是[0,63],子直方图2的横坐标的范围是[64,127],子直方图3的横坐标的范围是[128,191],子直方图3的横坐标的范围是[192,255]。提取特征时,公式中的参数的取值范围通常就被限制在在子直方图的横坐标的范围内,即子直方图1的x i的取值范围就在[0,63],具体即0、1、…、62、63,而统计m时就在0、1、…、62、63这些横坐标对应的纵坐标上取值;子直方图2的x i的取值范围就在[64,127],具体即64、65、…、126、127,而统计m时就在64、65、…、126、127这些横坐标对应的纵坐标上取值;子直方图3的x i的取值范围就在[128,191],具体即128、129、…、190、191,而统计m时就在128、129、…、190、191这些横坐标对应的纵坐标上取值;子直方图3的x i的取值范围就在[192,255],具体即192、193、…、254、255,而统计m时就在192、193、…、254、255这些横坐标对应的纵坐标上取值。可见该实施例中子直方图的横坐标范围和提取特征时的参数取值范围是一一对应且完全一致的。 Example 1: The abscissa of the histogram includes 256 coordinate values 0-255. The histogram is divided into 4 sub-histograms that do not overlap each other. The range of the abscissa of the sub-histogram 1 is [0,63], the sub-histogram The range of the abscissa of Fig. 2 is [64,127], the range of the abscissa of the sub-histogram 3 is [128,191], and the range of the abscissa of the sub-histogram 3 is [192,255]. When extracting features, the value range of the parameters in the formula is usually limited to the range of the abscissa of the sub-histogram, that is, the value range of x i in sub-histogram 1 is in [0,63], specifically 0, 1,..., 62, 63, and when counting m, the value is taken on the ordinate corresponding to the abscissas of 0, 1,..., 62, 63; the value range of x i in sub-histogram 2 is in [ 64, 127], specifically 64, 65,..., 126, 127, and when counting m, take the value on the ordinate corresponding to these abscissas of 64, 65,..., 126, 127; the value of x i in sub-histogram 3 The value range is [128,191], which is 128, 129,..., 190, 191, and when counting m, the value is taken on the ordinate corresponding to the abscissas of 128, 129,..., 190, 191; sub-histogram 3 The value range of x i is [192,255], specifically 192, 193,...254, 255, and when counting m, the value is taken on the ordinate corresponding to the abscissas of 192, 193,..., 254, 255. . It can be seen that in this embodiment, the abscissa range of the sub-histogram and the parameter value range when extracting features are in one-to-one correspondence and are completely consistent.
在拼接时,子直方图1的映射曲线和子直方图2的映射曲线首尾拼接,子直方图2的映射曲线和子直方图3的映射曲线首尾拼接,子直方图3的映射曲线和子直方图3的映射曲线首尾拼接。拼接处采用端点中值连接法,即取横坐标为63和64分别对应的纵坐标计算得到平均值1,将平均值1作为子直方图1的映射曲线和子直方图2的映射曲线的首尾过渡值;取横坐标为127和128分别对应的纵坐标计算得到平均值2,将平均值2作为子直方图2的映射曲线和子直方图3的映射曲线的首尾过渡值;取横坐标为191和192分别对应的纵坐标计算得到平均值3,将平均值3作为子直方图3的映射曲线和子直方图3的映射曲线的首尾过渡值。When splicing, the mapping curve of sub-histogram 1 and the mapping curve of sub-histogram 2 are spliced end to end, the mapping curve of sub-histogram 2 and the mapping curve of sub-histogram 3 are spliced end-to-end, and the mapping curve of sub-histogram 3 and sub-histogram 3 are spliced. The mapping curve is spliced end to end. The splicing place adopts the endpoint median connection method, that is, the average value 1 is calculated by taking the ordinate corresponding to 63 and 64 on the abscissa, and the average value 1 is used as the first and last transition of the mapping curve of sub-histogram 1 and the mapping curve of sub-histogram 2. Value; take the abscissa as 127 and 128 respectively and the ordinate corresponding to the average value 2 is calculated, and the average value 2 is used as the first and last transition value of the mapping curve of sub-histogram 2 and the mapping curve of sub-histogram 3; take the abscissa as 191 and The ordinate corresponding to 192 is calculated to obtain the average value 3, and the average value 3 is used as the first and last transition value of the mapping curve of the sub-histogram 3 and the mapping curve of the sub-histogram 3.
示例二,直方图的横坐标包括256个坐标值0-255,将该直方图分为相邻有重叠的4个子直方图,子直方图1的横坐标的范围是[0,69],子直方图2的横坐标的范围是[61,130],子直方图3的横坐标的范围是[125,194],子直方图3的横坐标的范围是[186,255]。提取特征时,公式中的参数的取值范围可以只取子直方图的横坐标的范围中没有重叠的子集,即子直方图1的x i的取值范围就在[0,60],具体即0、1、…、59、60,而统计m时就在0、1、…、59、60这些横坐标对应的纵坐标上取值;子直方图2的x i的取值范围就在[70,124],具体即70、71、…、123、124,而统计m时就在70、71、…、123、124这些横坐标对应的纵 坐标上取值;子直方图3的x i的取值范围就在[131,185],具体即131、132、…、184、185,而统计m时就在131、132、…、184、185这些横坐标对应的纵坐标上取值;子直方图3的x i的取值范围就在[195,255],具体即195、196、…、254、255,而统计m时就在195、196、…、254、255这些横坐标对应的纵坐标上取值。可见该实施例中提取特征时的参数取值范围是对应的子直方图的横坐标范围的子集。 Example 2: The abscissa of the histogram includes 256 coordinate values 0-255. The histogram is divided into 4 overlapping sub-histograms. The range of the abscissa of sub-histogram 1 is [0,69]. The range of the abscissa of the histogram 2 is [61,130], the range of the abscissa of the sub-histogram 3 is [125,194], and the range of the abscissa of the sub-histogram 3 is [186,255]. When extracting features, the value range of the parameters in the formula can only take a subset of the sub-histogram's abscissa that does not overlap, that is, the value range of x i in sub-histogram 1 is in [0,60], Specifically, it is 0, 1,..., 59, 60, and when counting m, the value is taken on the ordinate corresponding to the abscissas of 0, 1,..., 59, 60; the value range of x i in the sub-histogram 2 is In [70,124], specifically 70, 71, ..., 123, 124, and when counting m, take the value on the ordinate corresponding to these abscissas of 70, 71, ..., 123, 124; sub-histogram 3 x i The value range of is in [131,185], specifically 131, 132, ..., 184, 185, and when statistical m is taken, the value is taken on the ordinate corresponding to the abscissa of 131, 132, ..., 184, 185; sub-histogram The value range of x i in Fig. 3 is [195,255], specifically 195, 196,...254, 255, and when counting m, it is on the ordinate corresponding to the abscissas of 195, 196,..., 254, 255. Value. It can be seen that the parameter value range when extracting features in this embodiment is a subset of the abscissa range of the corresponding sub-histogram.
在拼接时,相邻两个子直方图的重叠部分,只取其中靠右的子直方图的重叠部分的映射曲线,即子直方图1中取对应于横坐标[0,61]的映射曲线,子直方图2中取对应于[61,125]的映射曲线,子直方图3中取对应于[125,186]的映射曲线,子直方图3中取对应于[186,255]的映射曲线,将这四条映射曲线依顺序首尾拼接。When splicing, the overlapping part of two adjacent sub-histograms, only the mapping curve of the overlapping part of the right sub-histogram is taken, that is, the mapping curve corresponding to the abscissa [0,61] is taken in the sub-histogram 1, Take the mapping curve corresponding to [61,125] in sub-histogram 2, take the mapping curve corresponding to [125,186] in sub-histogram 3, take the mapping curve corresponding to [186,255] in sub-histogram 3, and divide these four mapping curves Splice end to end in order.
示例三,直方图的横坐标包括256个坐标值0-255,将该直方图分为相邻有重叠的4个子直方图,子直方图1的横坐标的范围是[0,69],子直方图2的横坐标的范围是[61,130],子直方图3的横坐标的范围是[125,194],子直方图3的横坐标的范围是[186,255]。提取特征时,公式中的参数的取值范围可以同时取子直方图的横坐标的范围中没有重叠的子集和子直方图的横坐标的范围中有重叠的子集的子集,即子直方图1的x i的取值范围就在[0,64],具体即0、1、…、63、64,而统计m时就在0、1、…、63、64这些横坐标对应的纵坐标上取值;子直方图2的x i的取值范围就在[65,127],具体即65、66、…、126、127,而统计m时就在65、66、…、126、127这些横坐标对应的纵坐标上取值;子直方图3的x i的取值范围就在[128,189],具体即128、129、…、188、189,而统计m时就在128、129、…、188、189这些横坐标对应的纵坐标上取值;子直方图3的x i的取值范围就在[190,255],具体即190、191、…、254、255,而统计m时就在190、191、…、254、255这些横坐标对应的纵坐标上取值。可见该实施例中提取特征时的参数取值范围是对应的子直方图的横坐标范围的子集。 Example 3: The abscissa of the histogram includes 256 coordinate values 0-255. The histogram is divided into 4 overlapping sub-histograms. The range of the abscissa of sub-histogram 1 is [0,69]. The range of the abscissa of the histogram 2 is [61,130], the range of the abscissa of the sub-histogram 3 is [125,194], and the range of the abscissa of the sub-histogram 3 is [186,255]. When extracting features, the value range of the parameters in the formula can also take the subsets that do not overlap in the abscissa of the sub-histogram and the subsets that have overlap in the abscissa of the sub-histogram, that is, the sub-histogram. The value range of x i in Figure 1 is in [0,64], specifically 0, 1, ..., 63, 64, and when counting m, it is in the vertical direction corresponding to the abscissas of 0, 1, ..., 63, and 64. Take the value on the coordinates; the value range of x i in the sub-histogram 2 is [65,127], specifically 65, 66,...,126,127, and when statistical m is 65,66,...,126,127 these Take the value on the ordinate corresponding to the abscissa; the value range of x i in the sub-histogram 3 is [128,189], specifically 128, 129,...,188,189, and when the statistical m is calculated, it is at 128,129,... , 188, 189 these abscissas correspond to the ordinates; the value range of x i in the sub-histogram 3 is in [190,255], specifically 190, 191,...,254, 255, and when counting m, it is at 190, 191, ..., 254, 255 these abscissas correspond to the ordinates. It can be seen that the parameter value range when extracting features in this embodiment is a subset of the abscissa range of the corresponding sub-histogram.
在拼接时,相邻两个子直方图的重叠部分,只取其中靠左的子直方图的重叠部分的映射曲线,即子直方图1中取对应于横坐标[0,69]的映射曲线,子直方图2中取对应于横坐标[69,130]的映射曲线,子直方图3中取对应于横坐标[130,194]的映射曲线,子直方图3中取对应于横坐标[194,255]的映射曲线,将这四条映射曲线依顺序首尾拼接。When splicing, the overlapping part of two adjacent sub-histograms, only the mapping curve of the overlapping part of the left sub-histogram is taken, that is, the sub-histogram 1 takes the mapping curve corresponding to the abscissa [0,69], Take the mapping curve corresponding to the abscissa [69,130] in the sub-histogram 2, take the mapping curve corresponding to the abscissa [130,194] in the sub-histogram 3, and take the mapping curve corresponding to the abscissa [194,255] in the sub-histogram 3 , The four mapping curves are spliced end to end in sequence.
需要说明的是,上述合成映射曲线时,在相邻两个子直方图的映射曲线的拼接处采用了端点中值连接法,除此以外,本申请还可以采用端点最大值连接法、端点最小值连接法等,对此不作具体限定。It should be noted that when the above-mentioned mapping curve is synthesized, the endpoint median connection method is used at the splicing of the mapping curves of two adjacent sub-histograms. In addition, the application can also adopt the endpoint maximum connection method and endpoint minimum value. The connection method, etc., is not specifically limited.
步骤305、根据直方图的映射曲线对待处理图像进行增强处理。Step 305: Perform enhancement processing on the image to be processed according to the mapping curve of the histogram.
上述步骤302中,在对待处理图像的直方图划分之前或者之后,对直方图进行了亮度变换处理,例如gamma变换,因此在步骤304中得到的待处理图像的直方图的映射曲线是根据经过亮度变换处理过的直方图计算得到的。需要对待处理图像的直方图的映射曲线逆变换处理,例如反Gamma曲线映射,得到最终的映射曲线。再将该最终的映射曲线作用于待处理图像的像素,即逐像素根据计算出来的映射曲线对像素的亮度进行映射,得到增强后的图像。In the above step 302, before or after the histogram of the image to be processed is divided, the histogram is subjected to brightness transformation processing, such as gamma transformation, so the mapping curve of the histogram of the image to be processed obtained in step 304 is based on the brightness Calculated by transforming the processed histogram. It is necessary to inversely transform the mapping curve of the histogram of the image to be processed, such as inverse Gamma curve mapping, to obtain the final mapping curve. The final mapping curve is then applied to the pixels of the image to be processed, that is, the brightness of the pixels is mapped pixel by pixel according to the calculated mapping curve to obtain an enhanced image.
本申请将待处理图像的直方图划分为多个子直方图,针对每个子直方图单独提取特征并获取增益曲线系数和均衡曲线权重,进而依前述参数得到子直方图的映射曲线,实现对待处理图像的增强处理,由于各子直方图分开处理,因此可以针对不同亮度区间,局部动 态调整子直方图的亮度分布和对比度分布,既达到精细调整的目的,又可以兼顾调整亮度分布和对比度分布,达到均衡的目的。This application divides the histogram of the image to be processed into multiple sub-histograms, extracts features separately for each sub-histogram and obtains the gain curve coefficient and equalization curve weight, and then obtains the mapping curve of the sub-histogram according to the aforementioned parameters to realize the image to be processed Since the sub-histograms are processed separately, the brightness distribution and contrast distribution of the sub-histograms can be dynamically adjusted locally for different brightness intervals, which not only achieves the purpose of fine adjustment, but also adjusts the brightness distribution and contrast distribution to achieve The purpose of balance.
图6为本申请图像增强处理装置实施例的结构示意图,如图6所示,本实施例的装置可以应用于图1-3所示实施例中的端设备。该图像增强处理装置可以包括:获取模块601和处理模块602,其中,获取模块601,用于获取待处理图像的直方图;处理模块602,用于将所述直方图划分成n个子直方图,n为正整数;计算所述n个子直方图中每个子直方图的映射曲线;对所述n个子直方图的映射曲线进行合成得到所述直方图的映射曲线;根据所述直方图的映射曲线对所述待处理图像进行增强处理。FIG. 6 is a schematic structural diagram of an embodiment of an image enhancement processing apparatus of this application. As shown in FIG. 6, the apparatus of this embodiment can be applied to the end device in the embodiment shown in FIGS. 1-3. The image enhancement processing device may include: an acquisition module 601 and a processing module 602, wherein the acquisition module 601 is used to obtain a histogram of the image to be processed; the processing module 602 is used to divide the histogram into n sub-histograms, n is a positive integer; calculate the mapping curve of each sub-histogram in the n sub-histograms; synthesize the mapping curves of the n sub-histograms to obtain the mapping curve of the histogram; according to the mapping curve of the histogram Perform enhancement processing on the to-be-processed image.
在一种可能的实现方式中,所述处理模块602,具体用于提取每个子直方图的多个特征;根据所述多个特征确定每个子直方图的映射曲线。In a possible implementation manner, the processing module 602 is specifically configured to extract multiple features of each sub-histogram; and determine the mapping curve of each sub-histogram according to the multiple features.
在一种可能的实现方式中,所述多个特征包括子直方图的亮度均值、亮度标准差和像素百分比中的一个或多个,所述像素百分比为所述子直方图中包括的像素数量在所述直方图中包括的像素数量中的占比。In a possible implementation manner, the multiple features include one or more of a brightness average value, a brightness standard deviation, and a pixel percentage of a sub-histogram, and the pixel percentage is the number of pixels included in the sub-histogram The percentage of the number of pixels included in the histogram.
在一种可能的实现方式中,所述处理模块,具体用于根据所述多个特征计算每个子直方图的增益曲线系数和均衡曲线权重;根据所述增益曲线系数和所述均衡曲线权重确定每个子直方图的映射曲线。In a possible implementation manner, the processing module is specifically configured to calculate the gain curve coefficient and the equalization curve weight of each sub-histogram according to the multiple characteristics; determine according to the gain curve coefficient and the equalization curve weight The mapping curve of each sub-histogram.
在一种可能的实现方式中,所述处理模块602,具体用于将所述多个特征输入预先训练得到的第一直方图增强系数生成器得到所述增益曲线系数,所述第一直方图增强系数生成器用于计算所述增益曲线系数;将所述多个特征输入预先训练得到的第二直方图增强系数生成器得到所述均衡曲线权重,所述第二直方图增强系数生成器用于计算所述均衡曲线权重。In a possible implementation manner, the processing module 602 is specifically configured to input the multiple features into the first histogram enhancement coefficient generator obtained by pre-training to obtain the gain curve coefficients, and the first histogram The histogram enhancement coefficient generator is used to calculate the gain curve coefficients; the multiple features are input into the second histogram enhancement coefficient generator obtained by pre-training to obtain the equalization curve weight, and the second histogram enhancement coefficient generator is used To calculate the weight of the equilibrium curve.
在一种可能的实现方式中,所述处理模块602,具体用于将所述多个特征和相邻子直方图的所述多个特征均输入预先训练得到的第一直方图增强系数生成器得到所述增益曲线系数,所述第一直方图增强系数生成器用于计算所述增益曲线系数;将所述多个特征和相邻子直方图的所述多个特征均输入预先训练得到的第二直方图增强系数生成器得到所述均衡曲线权重,所述第二直方图增强系数生成器用于计算所述均衡曲线权重。In a possible implementation manner, the processing module 602 is specifically configured to input the multiple features and the multiple features of the neighboring sub-histograms into the first histogram enhancement coefficient obtained by pre-training to generate The first histogram enhancement coefficient generator is used to calculate the gain curve coefficient; the multiple features and the multiple features of the adjacent sub-histograms are all input to the pre-trained The second histogram enhancement coefficient generator obtains the equalization curve weight, and the second histogram enhancement coefficient generator is used to calculate the equalization curve weight.
在一种可能的实现方式中,所述第一直方图增强系数生成器和所述第二直方图增强系数生成器包括自适应神经模糊系统或神经网络。In a possible implementation manner, the first histogram enhancement coefficient generator and the second histogram enhancement coefficient generator include an adaptive neuro-fuzzy system or a neural network.
在一种可能的实现方式中,所述n个子直方图中每个子直方图为经过低通滤波处理后的直方图。In a possible implementation manner, each sub-histogram in the n sub-histograms is a histogram processed by low-pass filtering.
在一种可能的实现方式中,所述处理模块602,还用于对所述直方图进行亮度变换处理;将亮度变换后的直方图划分成n个子直方图。In a possible implementation manner, the processing module 602 is further configured to perform brightness conversion processing on the histogram; divide the histogram after the brightness conversion into n sub-histograms.
在一种可能的实现方式中,所述处理模块602,还用于对所述n个子直方图中每个子直方图进行亮度变换处理。In a possible implementation manner, the processing module 602 is further configured to perform brightness transformation processing on each sub-histogram in the n sub-histograms.
在一种可能的实现方式中,所述处理模块602,具体用于对所述n个子直方图的映射曲线进行拼接以得到所述直方图的映射曲线,在相邻两个子直方图的映射曲线的连接处的值取平均值、最大值或最小值,所述平均值、最大值或最小值是所述相邻两个子直方图的映射曲线在彼此的连接端的两个取值的平均值,最大值或最小值。In a possible implementation, the processing module 602 is specifically configured to splice the mapping curves of the n sub-histograms to obtain the mapping curve of the histogram, and the mapping curves of the two adjacent sub-histograms The value at the connection of takes the average value, maximum value or minimum value, and the average value, maximum value or minimum value is the average of the two values of the mapping curves of the two adjacent sub-histograms at the connection ends of each other, Maximum or minimum value.
在一种可能的实现方式中,所述处理模块602,还用于根据第一设定参数训练得到所 述自适应神经模糊系统,所述第一设定参数包括输入特征隶属度函数参数、输出隶属度函数参数、规则函数。In a possible implementation, the processing module 602 is further configured to train the adaptive neuro-fuzzy system according to a first set parameter, and the first set parameter includes input feature membership function parameters, output Membership function parameter, rule function.
在一种可能的实现方式中,所述处理模块602,还用于根据第二设定参数训练得到所述神经网络,所述第二设定参数包括所述多个特征、隶属度函数计算节点、规则函数中不同组合设计对应输出值。In a possible implementation manner, the processing module 602 is further configured to train the neural network according to a second set parameter, where the second set parameter includes the multiple features and membership function calculation nodes , The corresponding output value of different combination design in the rule function.
在一种可能的实现方式中,所述处理模块602,具体用于根据公式(1)计算得到所述第一子直方图的映射曲线:In a possible implementation manner, the processing module 602 is specifically configured to calculate the mapping curve of the first sub-histogram according to formula (1):
y i=α i×y i_gaini×y i_hist   (1) y ii ×y i_gaini ×y i_hist (1)
其中,y i表示所述第一子直方图的映射曲线,γ i表示所述增益曲线系数,β i表示所述均衡曲线权重,α i=1-β i,y i_gain表示所述第一子直方图的增益曲线,
Figure PCTCN2020080774-appb-000009
j∈[0,m],y i_hist表示所述第一子直方图的均衡曲线。
Wherein, y i represents the mapping curve of the first sub-histogram, γ i represents the gain curve coefficient, β i represents the weight of the equalization curve, α i =1-β i , y i_gain represents the first sub-histogram The gain curve of the histogram,
Figure PCTCN2020080774-appb-000009
j∈[0,m], y i_hist represents the equalization curve of the first sub-histogram.
本实施例的装置,可以用于执行图3所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The device in this embodiment can be used to implement the technical solution of the method embodiment shown in FIG. 3, and its implementation principles and technical effects are similar, and will not be repeated here.
在实现过程中,上述方法实施例的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。处理器可以是通用处理器、数字信号处理器(digital signal processor,DSP)、特定应用集成电路(application-specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。本申请实施例公开的方法的步骤可以直接体现为硬件编码处理器执行完成,或者用编码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。In the implementation process, the steps of the foregoing method embodiments may be completed by hardware integrated logic circuits in the processor or instructions in the form of software. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other Programming logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like. The steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware encoding processor, or executed and completed by a combination of hardware and software modules in the encoding processor. The software module can be located in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
上述各实施例中提及的存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。应注意,本文描述的系统和方法的存储器旨在包括但不限于这些和任意其它适合类型的存储器。The memory mentioned in the above embodiments may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), and electrically available Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of exemplary but not restrictive description, many forms of RAM are available, such as static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), and synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory (synchlink DRAM, SLDRAM) ) And direct memory bus random access memory (direct rambus RAM, DR RAM). It should be noted that the memories of the systems and methods described herein are intended to include, but are not limited to, these and any other suitable types of memories.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以 硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person of ordinary skill in the art may realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, device, and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solution of the present application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (personal computer, server, or network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program code .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific implementations of this application, but the protection scope of this application is not limited to this. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in this application. Should be covered within the scope of protection of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (24)

  1. 一种图像增强处理方法,其特征在于,包括:An image enhancement processing method, characterized in that it comprises:
    获取待处理图像的直方图;Obtain the histogram of the image to be processed;
    将所述直方图划分成n个子直方图,n为正整数;Divide the histogram into n sub-histograms, where n is a positive integer;
    计算所述n个子直方图中每个子直方图的映射曲线;Calculating a mapping curve of each sub-histogram in the n sub-histograms;
    对所述n个子直方图的映射曲线进行合成得到所述直方图的映射曲线;Synthesize the mapping curves of the n sub-histograms to obtain the mapping curve of the histogram;
    根据所述直方图的映射曲线对所述待处理图像进行增强处理。The image to be processed is enhanced according to the mapping curve of the histogram.
  2. 根据权利要求1所述的方法,其特征在于,所述计算所述n个子直方图中每个子直方图的映射曲线,包括:The method according to claim 1, wherein the calculating the mapping curve of each sub-histogram in the n sub-histograms comprises:
    提取每个子直方图的多个特征;Extract multiple features of each sub-histogram;
    根据所述多个特征确定每个子直方图的映射曲线。The mapping curve of each sub-histogram is determined according to the multiple features.
  3. 根据权利要求2所述的方法,其特征在于,所述多个特征包括子直方图的亮度均值、子直方图的亮度标准差和子直方图的像素百分比中的一个或多个,所述子直方图的像素百分比为所述子直方图中包括的像素数量在所述直方图中包括的像素数量中的占比。The method according to claim 2, wherein the multiple features include one or more of the brightness mean value of the sub-histogram, the brightness standard deviation of the sub-histogram, and the pixel percentage of the sub-histogram, and the sub-histogram The pixel percentage of the graph is the ratio of the number of pixels included in the sub-histogram to the number of pixels included in the histogram.
  4. 根据权利要求2或3所述的方法,其特征在于,所述根据所述多个特征确定每个子直方图的映射曲线,包括:The method according to claim 2 or 3, wherein the determining the mapping curve of each sub-histogram according to the multiple characteristics comprises:
    根据所述多个特征计算每个子直方图的增益曲线系数和均衡曲线权重;Calculating the gain curve coefficient and the equalization curve weight of each sub-histogram according to the multiple characteristics;
    根据所述增益曲线系数和所述均衡曲线权重确定每个子直方图的映射曲线。The mapping curve of each sub-histogram is determined according to the gain curve coefficient and the equalization curve weight.
  5. 根据权利要求4所述的方法,其特征在于,所述根据所述多个特征计算每个子直方图的增益曲线系数和均衡曲线权重,包括:The method according to claim 4, wherein the calculating the gain curve coefficient and the equalization curve weight of each sub-histogram according to the multiple characteristics comprises:
    将所述多个特征输入预先训练得到的第一直方图增强系数生成器得到所述增益曲线系数,所述第一直方图增强系数生成器用于计算所述增益曲线系数;Inputting the plurality of features into a pre-trained first histogram enhancement coefficient generator to obtain the gain curve coefficient, and the first histogram enhancement coefficient generator is used to calculate the gain curve coefficient;
    将所述多个特征输入预先训练得到的第二直方图增强系数生成器得到所述均衡曲线权重,所述第二直方图增强系数生成器用于计算所述均衡曲线权重。The second histogram enhancement coefficient generator obtained by pre-training is input into the plurality of features to obtain the equalization curve weight, and the second histogram enhancement coefficient generator is used to calculate the equalization curve weight.
  6. 根据权利要求4所述的方法,其特征在于,所述根据所述多个特征计算每个子直方图的增益曲线系数和均衡曲线权重,包括:The method according to claim 4, wherein the calculating the gain curve coefficient and the equalization curve weight of each sub-histogram according to the multiple characteristics comprises:
    将所述多个特征和相邻子直方图的所述多个特征均输入预先训练得到的第一直方图增强系数生成器得到所述增益曲线系数,所述第一直方图增强系数生成器用于计算所述增益曲线系数;The multiple features and the multiple features of the adjacent sub-histograms are all input to the first histogram enhancement coefficient generator obtained by pre-training to obtain the gain curve coefficients, and the first histogram enhancement coefficients are generated The device is used to calculate the coefficient of the gain curve;
    将所述多个特征和相邻子直方图的所述多个特征均输入预先训练得到的第二直方图增强系数生成器得到所述均衡曲线权重,所述第二直方图增强系数生成器用于计算所述均衡曲线权重。The multiple features and the multiple features of the adjacent sub-histograms are all input to a second histogram enhancement coefficient generator obtained in advance to obtain the equalization curve weight, and the second histogram enhancement coefficient generator is used for Calculate the weight of the equilibrium curve.
  7. 根据权利要求5或6所述的方法,其特征在于,所述第一直方图增强系数生成器和所述第二直方图增强系数生成器包括自适应神经模糊系统或神经网络。The method according to claim 5 or 6, wherein the first histogram enhancement coefficient generator and the second histogram enhancement coefficient generator comprise an adaptive neuro-fuzzy system or a neural network.
  8. 根据权利要求1-7中任一项所述的方法,其特征在于,所述n个子直方图中每个子直方图为经过低通滤波处理后的直方图。The method according to any one of claims 1-7, wherein each sub-histogram in the n sub-histograms is a histogram processed by low-pass filtering.
  9. 根据权利要求1-8中任一项所述的方法,其特征在于,所述将所述直方图划分成n个子直方图之前,还包括:The method according to any one of claims 1-8, wherein before dividing the histogram into n sub-histograms, the method further comprises:
    对所述直方图进行亮度变换处理;Performing brightness conversion processing on the histogram;
    所述将所述直方图划分成n个子直方图,包括:The dividing the histogram into n sub-histograms includes:
    将亮度变换后的直方图划分成n个子直方图。The histogram after the brightness transformation is divided into n sub-histograms.
  10. 根据权利要求1-8中任一项所述的方法,其特征在于,所述将所述直方图划分成n个子直方图之后,还包括:The method according to any one of claims 1-8, wherein after the dividing the histogram into n sub-histograms, the method further comprises:
    对所述n个子直方图中每个子直方图进行亮度变换处理。Perform brightness conversion processing on each sub-histogram in the n sub-histograms.
  11. 根据权利要求1-10中任一项所述的方法,其特征在于,所述对所述n个子直方图的映射曲线进行合成得到所述直方图的映射曲线,包括:The method according to any one of claims 1-10, wherein the synthesizing the mapping curves of the n sub-histograms to obtain the mapping curve of the histogram comprises:
    对所述n个子直方图的映射曲线进行拼接以得到所述直方图的映射曲线,在相邻两个子直方图的映射曲线的连接处的值取平均值、最大值或最小值,所述平均值、最大值或最小值是所述相邻两个子直方图的映射曲线在彼此的连接端的两个取值的平均值、最大值或最小值。The mapping curves of the n sub-histograms are spliced to obtain the mapping curve of the histogram, and the values at the junction of the mapping curves of two adjacent sub-histograms are averaged, maximum, or minimum, and the average The value, the maximum value or the minimum value are the average value, the maximum value or the minimum value of the two values of the mapping curves of the two adjacent sub-histograms at the connection ends of each other.
  12. 一种图像增强处理装置,其特征在于,包括:An image enhancement processing device, characterized in that it comprises:
    获取模块,用于获取待处理图像的直方图;The acquisition module is used to acquire the histogram of the image to be processed;
    处理模块,用于将所述直方图划分成n个子直方图,n为正整数;计算所述n个子直方图中每个子直方图的映射曲线;对所述n个子直方图的映射曲线进行合成得到所述直方图的映射曲线;根据所述直方图的映射曲线对所述待处理图像进行增强处理。A processing module for dividing the histogram into n sub-histograms, where n is a positive integer; calculating the mapping curve of each sub-histogram in the n sub-histograms; synthesizing the mapping curves of the n sub-histograms Obtain the mapping curve of the histogram; perform enhancement processing on the image to be processed according to the mapping curve of the histogram.
  13. 根据权利要求12所述的装置,其特征在于,所述处理模块,具体用于提取每个子直方图的多个特征;根据所述多个特征确定每个子直方图的映射曲线。The device according to claim 12, wherein the processing module is specifically configured to extract multiple features of each sub-histogram; and determine the mapping curve of each sub-histogram according to the multiple features.
  14. 根据权利要求13所述的装置,其特征在于,所述多个特征包括子直方图的亮度均值、子直方图的亮度标准差和子直方图的像素百分比中的一个或多个,所述子直方图的像素百分比为所述子直方图中包括的像素数量在所述直方图中包括的像素数量中的占比。The device according to claim 13, wherein the multiple features include one or more of the brightness mean value of the sub-histogram, the brightness standard deviation of the sub-histogram, and the pixel percentage of the sub-histogram, and the sub-histogram The pixel percentage of the graph is the ratio of the number of pixels included in the sub-histogram to the number of pixels included in the histogram.
  15. 根据权利要求13或14所述的装置,其特征在于,所述处理模块,具体用于根据所述多个特征计算每个子直方图的增益曲线系数和均衡曲线权重;根据所述增益曲线系数和所述均衡曲线权重确定每个子直方图的映射曲线。The device according to claim 13 or 14, wherein the processing module is specifically configured to calculate the gain curve coefficient and the equalization curve weight of each sub-histogram according to the multiple characteristics; according to the gain curve coefficient and The weight of the equalization curve determines the mapping curve of each sub-histogram.
  16. 根据权利要求15所述的装置,其特征在于,所述处理模块,具体用于将所述多个特征输入预先训练得到的第一直方图增强系数生成器得到所述增益曲线系数,所述第一直方图增强系数生成器用于计算所述增益曲线系数;将所述多个特征输入预先训练得到的第二直方图增强系数生成器得到所述均衡曲线权重,所述第二直方图增强系数生成器用于计算所述均衡曲线权重。The apparatus according to claim 15, wherein the processing module is specifically configured to input the multiple features into a first histogram enhancement coefficient generator obtained by pre-training to obtain the gain curve coefficients, and The first histogram enhancement coefficient generator is used to calculate the gain curve coefficients; the multiple features are input into the second histogram enhancement coefficient generator obtained by pre-training to obtain the equalization curve weight, and the second histogram is enhanced The coefficient generator is used to calculate the weight of the equalization curve.
  17. 根据权利要求15所述的装置,其特征在于,所述处理模块,具体用于将所述多个特征和相邻子直方图的所述多个特征均输入预先训练得到的第一直方图增强系数生成器得到所述增益曲线系数,所述第一直方图增强系数生成器用于计算所述增益曲线系数;将所述多个特征和相邻子直方图的所述多个特征均输入预先训练得到的第二直方图增强系数生成器得到所述均衡曲线权重,所述第二直方图增强系数生成器用于计算所述均衡曲线权重。The device according to claim 15, wherein the processing module is specifically configured to input the multiple features and the multiple features of the neighboring sub-histograms into a first histogram obtained by pre-training The enhancement coefficient generator obtains the gain curve coefficient, and the first histogram enhancement coefficient generator is used to calculate the gain curve coefficient; inputting the multiple features and the multiple features of adjacent sub-histograms The pre-trained second histogram enhancement coefficient generator obtains the equalization curve weight, and the second histogram enhancement coefficient generator is used to calculate the equalization curve weight.
  18. 根据权利要求16或17所述的装置,其特征在于,所述第一直方图增强系数生成器和所述第二直方图增强系数生成器包括自适应神经模糊系统或神经网络。The device according to claim 16 or 17, wherein the first histogram enhancement coefficient generator and the second histogram enhancement coefficient generator comprise an adaptive neuro-fuzzy system or a neural network.
  19. 根据权利要求12-18中任一项所述的装置,其特征在于,所述n个子直方图中每 个子直方图为经过低通滤波处理后的直方图。The device according to any one of claims 12-18, wherein each sub-histogram in the n sub-histograms is a histogram after low-pass filtering.
  20. 根据权利要求12-19中任一项所述的装置,其特征在于,所述处理模块,还用于对所述直方图进行亮度变换处理;将亮度变换后的直方图划分成n个子直方图。The device according to any one of claims 12-19, wherein the processing module is further configured to perform brightness conversion processing on the histogram; divide the histogram after the brightness conversion into n sub-histograms .
  21. 根据权利要求12-19中任一项所述的装置,其特征在于,所述处理模块,还用于对所述n个子直方图中每个子直方图进行亮度变换处理。The device according to any one of claims 12-19, wherein the processing module is further configured to perform brightness transformation processing on each sub-histogram in the n sub-histograms.
  22. 根据权利要求12-21中任一项所述的装置,其特征在于,所述处理模块,具体用于对所述n个子直方图的映射曲线进行拼接以得到所述直方图的映射曲线,在相邻两个子直方图的映射曲线的连接处的值取平均值、最大值或最小值,所述平均值、最大值或最小值是所述相邻两个子直方图的映射曲线在彼此的连接端的两个取值的平均值,最大值或最小值。The device according to any one of claims 12-21, wherein the processing module is specifically configured to splice the mapping curves of the n sub-histograms to obtain the mapping curves of the histograms, and The value at the connection of the mapping curves of two adjacent sub-histograms takes the average, maximum or minimum value, and the average, maximum or minimum is the connection between the mapping curves of the two adjacent sub-histograms. The average, maximum or minimum of the two values at the end.
  23. 一种图像增强处理装置,其特征在于,包括:An image enhancement processing device, characterized in that it comprises:
    一个或多个处理器;One or more processors;
    存储器,用于存储一个或多个程序;Memory, used to store one or more programs;
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-11中任一所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-11.
  24. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有指令,当所述指令在计算机上运行时,用于执行权利要求1-11中任一项所述的方法。A computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and when the instructions are run on a computer, they are used to execute the method according to any one of claims 1-11.
PCT/CN2020/080774 2020-03-24 2020-03-24 Image enhancement processing method and device WO2021189222A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202080098763.8A CN115298688A (en) 2020-03-24 2020-03-24 Image enhancement processing method and device
PCT/CN2020/080774 WO2021189222A1 (en) 2020-03-24 2020-03-24 Image enhancement processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/080774 WO2021189222A1 (en) 2020-03-24 2020-03-24 Image enhancement processing method and device

Publications (1)

Publication Number Publication Date
WO2021189222A1 true WO2021189222A1 (en) 2021-09-30

Family

ID=77890107

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/080774 WO2021189222A1 (en) 2020-03-24 2020-03-24 Image enhancement processing method and device

Country Status (2)

Country Link
CN (1) CN115298688A (en)
WO (1) WO2021189222A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115278104A (en) * 2022-07-04 2022-11-01 浙江大华技术股份有限公司 Image brightness adjusting method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101452575A (en) * 2008-12-12 2009-06-10 北京航空航天大学 Image self-adapting enhancement method based on neural net
CN102831592A (en) * 2012-08-10 2012-12-19 中国电子科技集团公司第四十一研究所 Image nonlinearity enhancement method based on histogram subsection transformation
KR20160002517A (en) * 2014-06-30 2016-01-08 성균관대학교산학협력단 Method and apparatus for enhancing digital image, and apparatus for image processing using the same
CN106530237A (en) * 2016-09-19 2017-03-22 中山大学 Image enhancement method
CN107945122A (en) * 2017-11-07 2018-04-20 武汉大学 Infrared image enhancing method and system based on self-adapting histogram segmentation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101452575A (en) * 2008-12-12 2009-06-10 北京航空航天大学 Image self-adapting enhancement method based on neural net
CN102831592A (en) * 2012-08-10 2012-12-19 中国电子科技集团公司第四十一研究所 Image nonlinearity enhancement method based on histogram subsection transformation
KR20160002517A (en) * 2014-06-30 2016-01-08 성균관대학교산학협력단 Method and apparatus for enhancing digital image, and apparatus for image processing using the same
CN106530237A (en) * 2016-09-19 2017-03-22 中山大学 Image enhancement method
CN107945122A (en) * 2017-11-07 2018-04-20 武汉大学 Infrared image enhancing method and system based on self-adapting histogram segmentation

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115278104A (en) * 2022-07-04 2022-11-01 浙江大华技术股份有限公司 Image brightness adjusting method and device, electronic equipment and storage medium
CN115278104B (en) * 2022-07-04 2024-02-09 浙江大华技术股份有限公司 Image brightness adjustment method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN115298688A (en) 2022-11-04

Similar Documents

Publication Publication Date Title
WO2020238741A1 (en) Image processing method, related device and computer storage medium
CN112150399A (en) Image enhancement method based on wide dynamic range and electronic equipment
WO2021160001A1 (en) Image acquisition method and device
US20220245823A1 (en) Image Processing Method and Apparatus, and Device
US10242288B2 (en) Method and system for video processing
CN110930329B (en) Star image processing method and device
WO2019082925A9 (en) Image processing apparatus, image capturing system, image processing method, and recording medium
CN107623818B (en) Image exposure method and mobile terminal
WO2018076167A1 (en) Screen brightness adjustment method applicable to unmanned aerial vehicle control side, and unmanned aerial vehicle control side
CN108718388B (en) Photographing method and mobile terminal
US20220245778A1 (en) Image bloom processing method and apparatus, and storage medium
US20240119566A1 (en) Image processing method and apparatus, and electronic device
CN110570370B (en) Image information processing method and device, storage medium and electronic equipment
WO2021189222A1 (en) Image enhancement processing method and device
US20240046604A1 (en) Image processing method and apparatus, and electronic device
WO2023011302A1 (en) Photographing method and related apparatus
US20230342977A1 (en) Method for Determining Chromaticity Information and Related Electronic Device
CN114222072B (en) Image processing method, device, electronic equipment and storage medium
WO2022115996A1 (en) Image processing method and device
US10970828B2 (en) Image processing apparatus, image processing system, image processing method, and recording medium
EP4209989A1 (en) Device and method for generating image in which subject has been captured
CN116723416B (en) Image processing method and electronic equipment
CN117395495B (en) Image processing method and electronic equipment
CN115358937B (en) Image anti-reflection method, medium and electronic equipment
CN115955611B (en) Image processing method and electronic equipment

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: 20927187

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: 20927187

Country of ref document: EP

Kind code of ref document: A1