CN111563865A - Image detail enhancement method and device for brightness preservation of consumer electronic products - Google Patents
Image detail enhancement method and device for brightness preservation of consumer electronic products Download PDFInfo
- Publication number
- CN111563865A CN111563865A CN202010322148.2A CN202010322148A CN111563865A CN 111563865 A CN111563865 A CN 111563865A CN 202010322148 A CN202010322148 A CN 202010322148A CN 111563865 A CN111563865 A CN 111563865A
- Authority
- CN
- China
- Prior art keywords
- array
- length
- histogram
- gray level
- public
- Prior art date
- Legal status (The legal status 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 status listed.)
- Withdrawn
Links
- 238000000034 method Methods 0.000 title claims abstract description 29
- 238000004321 preservation Methods 0.000 title claims description 3
- 238000004364 calculation method Methods 0.000 claims abstract description 12
- 239000011159 matrix material Substances 0.000 claims description 8
- 238000000638 solvent extraction Methods 0.000 claims 2
- 230000002708 enhancing effect Effects 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 230000001186 cumulative effect Effects 0.000 description 4
- 230000011218 segmentation Effects 0.000 description 3
- 238000012423 maintenance Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000008092 positive effect Effects 0.000 description 1
- 230000001629 suppression Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/40—Image enhancement or restoration using histogram techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20021—Dividing image into blocks, subimages or windows
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
- Facsimile Image Signal Circuits (AREA)
- Studio Devices (AREA)
Abstract
Description
技术领域technical field
本发明涉及图像对比度增强技术领域,尤其涉及一种消费类电子产品的亮度保持的图像细节增强方法及装置。The invention relates to the technical field of image contrast enhancement, and in particular, to a method and device for enhancing image details for maintaining brightness of consumer electronic products.
背景技术Background technique
全局直方图均衡化是数字图像增强的常用方法之一,其算法虽然实现简单,但不适合在电视、数码相机、摄像机等消费类电子产品中实现。这是因为传统的全局直方图均衡算法(HE)不能很好地保持输入与输出图像的亮度,即采用HE算法处理之后的输出图像,其亮度与输入图像的亮度会有一个较大的偏差。因此,对于一些消费类电子产品以及红外图像处理系统(要求输出图像能够保持输入图像的亮度),HE算法往往不能够得到令人满意的输出图像。Global histogram equalization is one of the commonly used methods for digital image enhancement. Although its algorithm is simple to implement, it is not suitable for implementation in consumer electronic products such as televisions, digital cameras, and video cameras. This is because the traditional global histogram equalization algorithm (HE) cannot maintain the brightness of the input and output images well, that is, the brightness of the output image processed by the HE algorithm will have a large deviation from the brightness of the input image. Therefore, for some consumer electronic products and infrared image processing systems (which require the output image to maintain the brightness of the input image), the HE algorithm often cannot obtain a satisfactory output image.
为了能够有效地解决这个问题,提出了许多基于HE的算法。尽管一些方法可以实现图像整体的对比度增强,亮度保持较好,但是对于局部细节往往不能够实现有效的增强,结果不能够得到令人满意的输出图像。To be able to solve this problem efficiently, many HE-based algorithms have been proposed. Although some methods can enhance the overall contrast of the image and keep the brightness better, they often cannot achieve effective enhancement of local details, resulting in unsatisfactory output images.
发明内容SUMMARY OF THE INVENTION
本发明旨在提供一种克服上述问题之一或者至少部分地解决上述任一问题的消费类电子产品的亮度保持的图像细节增强方法及装置。The present invention aims to provide an image detail enhancement method and apparatus for maintaining brightness of a consumer electronic product that overcomes one of the above problems or at least partially solves any of the above problems.
为达到上述目的,本发明的技术方案具体是这样实现的:In order to achieve the above object, the technical scheme of the present invention is specifically realized in this way:
本发明一方面提供了一种消费类电子产品的亮度保持的图像细节增强方法,包括:计算灰度输入图像I的灰度级直方图h(i)、概率p(i),其中,i为灰度级,设置输出图像imageout与输入图像I尺寸相同,数值设置为零矩阵;利用第一数组h1记录符合第一规则的直方图,利用第一灰度级数组id1记录对应灰度级,利用第二数组h2记录符合第二规则的直方图,利用第二灰度级数组id2记录对应灰度级,其中,第一规则包括0<p(i)<=1/255,第二规则包括:p(i)>1/255;将第一数组h1和第二数组h2进行再分割,利用jgh1数组记录第一灰度级数组id1中相邻两数之差,利用jg1数组记录jgh1(x)>=预设值的数值,分割块数大小1+length(jg1)个;利用jgh2数组记录第二灰度级数组id2中相邻两数之差,利用jg2数组记录jgh2(x)>=预设值的数值,分割块数大小1+length(jg2)个;设置第一公共数组Hx存放分块直方图,第二公共数组idx存放第一公共数组Hx的灰度级,其中,第一数组h1中各分块直方图Hx的获取方式为:判断jg1数组是否为空,若为空,确定第一数组h1不能分割,则令第一公共数组Hx=h1,第二公共数组idx=id1,第一公共数组Hx存放的分块直方图长度为length(Hx);若不为空,确定第一数组h1可以再次分割,分割的块数为1+length(jg1)个,对1...(1+length(jg1))中任意分块直方图为Hx=h1(T1:jg1(i)),对应分块直方图的灰度级为idx=id1(T1:jg1(i)),其中i=1...n1-1,在i=1时,T1=1,在i=2...n1-1时,T1=1+jg1(i);第二数组h2中各分块直方图Hx的获取方式为:判断jg2数组是否为空,若为空,确定第二数组h2不能分割,则令第一公共数组Hx=h2,第二公共数组idx=id2,第一公共数组Hx存放的分块直方图长度为length(Hx);若不为空,确定第二数组h2可以再次分割,分割的块数为1+length(jg2)个,对1...(1+length(jg2))中任意分块直方图为Hx=h2(T2:jg2(i)),对应分块直方图的灰度级为idx=id2(T2:jg2(i)),其中i=1...n2-1,在i=1时,T2=1,在i=2...n2-1时,T2=1+jg2(i);计算第一公共数组Hx中各分块直方图的概率累积概率其中i=1...length(Hx);对第一公共数组Hx中各分块直方图按如下公式计算:其中i=1...length(Hx),f(i)为输出图像的灰度值,P1为图像细节、亮度、对比度的调节参数;输出输出图像imageout。One aspect of the present invention provides an image detail enhancement method for brightness preservation of consumer electronic products, comprising: calculating a grayscale histogram h(i) and a probability p(i) of a grayscale input image I, where i is Gray level, set the output image imageout to be the same size as the input image I, and set the value to a zero matrix; use the first array h 1 to record the histogram that conforms to the first rule, and use the first gray level array id 1 to record the corresponding gray level , use the second array h 2 to record the histogram conforming to the second rule, and use the second gray level array id 2 to record the corresponding gray level, wherein the first rule includes 0<p(i)<=1/255, the first The second rule includes: p(i)>1/255; subdivide the first array h 1 and the second array h 2 , and use the jgh 1 array to record the difference between two adjacent numbers in the first grayscale array id 1 , Use the jg 1 array to record the value of jgh 1 (x)>=preset value, the size of the divided blocks is 1+length(jg 1 ); use the jgh 2 array to record the second grayscale array id 2 The two adjacent numbers Poor, use the jg 2 array to record the value of jgh 2 (x)>= preset value, the number of divided blocks is 1+length (jg 2 ); set the first public array Hx to store the block histogram, and the second public array idx Stores the gray level of the first public array Hx, wherein the acquisition method of each block histogram Hx in the first array h 1 is: judging whether the jg 1 array is empty, if it is empty, determine that the first array h 1 cannot be divided , then let the first public array Hx=h 1 , the second public array idx=id 1 , the length of the block histogram stored in the first public array Hx is length(Hx); if not empty, determine the first array h 1 It can be divided again, the number of divided blocks is 1+length(jg 1 ), and the histogram of any block in 1...(1+length(jg 1 )) is Hx=h 1 (T1:jg 1 (i )), the gray level of the corresponding block histogram is idx=id 1 (T1:jg 1 (i)), where i=1...n 1 -1, when i=1, T1=1, at When i=2...n 1 -1, T1=1+jg 1 (i); the acquisition method of each block histogram Hx in the second array h 2 is: judging whether the jg 2 array is empty, if it is empty , determine that the second array h 2 cannot be divided, then let the first public array Hx=h 2 , the second public array idx=id 2 , and the length of the block histogram stored in the first public array Hx is length(Hx); If it is empty, it is determined that the second array h 2 can be divided again, the number of divided blocks is 1+length(jg 2 ), and the histogram of any block in 1...(1+length(jg 2 )) is Hx= h 2 (T2:jg 2 (i)), the gray level of the corresponding block histogram is idx=id 2 (T 2: jg 2 (i)) where i=1...n 2 -1, when i=1, T2=1, when i=2...n 2 -1, T2=1+jg 2 (i); Calculate the probability of each block histogram in the first public array Hx cumulative probability where i=1...length(Hx); the histogram of each block in the first public array Hx is calculated according to the following formula: where i=1...length(Hx), f(i) is the gray value of the output image, P 1 is the adjustment parameter of image detail, brightness and contrast; output the output image imageout.
其中,P1取值范围[0,1]。Among them, the value range of P 1 is [0,1].
其中,P1=0.1。Wherein, P 1 =0.1.
其中,预设值为20。Among them, the default value is 20.
本发明另一方面提供了一种消费类电子产品的亮度保持的图像细节增强装置,包括:第一计算模块,用于计算灰度输入图像I的灰度级直方图h(i)、概率p(i),其中,i为灰度级,设置输出图像imageout与输入图像I尺寸相同,数值设置为零矩阵;记录模块,用于利用第一数组h1记录符合第一规则的直方图,利用第一灰度级数组id1记录对应灰度级,利用第二数组h2记录符合第二规则的直方图,利用第二灰度级数组id2记录对应灰度级,其中,第一规则包括0<p(i)<=1/255,第二规则包括:p(i)>1/255;分割模块,用于将第一数组h1和第二数组h2进行再分割,利用jgh1数组记录第一灰度级数组id1中相邻两数之差,利用jg1数组记录jgh1(x)>=预设值的数值,分割块数大小1+length(jg1)个;利用jgh2数组记录第二灰度级数组id2中相邻两数之差,利用jg2数组记录jgh2(x)>=预设值的数值,分割块数大小1+length(jg2)个;确定模块,用于设置第一公共数组Hx存放分块直方图,第二公共数组idx存放第一公共数组Hx的灰度级,其中,第一数组h1中各分块直方图Hx的获取方式为:判断jg1数组是否为空,若为空,确定第一数组h1不能分割,则令第一公共数组Hx=h1,第二公共数组idx=id1,第一公共数组Hx存放的分块直方图长度为length(Hx);若不为空,确定第一数组h1可以再次分割,分割的块数为1+length(jg1)个,对1...(1+length(jg1))中任意分块直方图为Hx=h1(T1:jg1(i)),对应分块直方图的灰度级为idx=id1(T1:jg1(i)),其中i=1...n1-1,在i=1时,T1=1,在i=2...n1-1时,T1=1+jg1(i);第二数组h2中各分块直方图Hx的获取方式为:判断jg2数组是否为空,若为空,确定第二数组h2不能分割,则令第一公共数组Hx=h2,第二公共数组idx=id2,第一公共数组Hx存放的分块直方图长度为length(Hx);若不为空,确定第二数组h2可以再次分割,分割的块数为1+length(jg2)个,对1...(1+length(jg2))中任意分块直方图为Hx=h2(T2:jg2(i)),对应分块直方图的灰度级为idx=id2(T2:jg2(i)),其中i=1...n2-1,在i=1时,T2=1,在i=2...n2-1时,T2=1+jg2(i);第二计算模块,用于计算第一公共数组Hx中各分块直方图的概率累积概率其中i=1...length(Hx);第三计算模块,用于对第一公共数组Hx中各分块直方图按如下公式计算:Another aspect of the present invention provides a brightness-preserving image detail enhancement device for consumer electronic products, comprising: a first calculation module for calculating a gray-level histogram h(i) and a probability p of a gray-scale input image I (i), wherein, i is the gray level, the output image imageout is set to be the same size as the input image I, and the numerical value is set to a zero matrix; the recording module is used to record the histogram that conforms to the first rule by using the first array h 1 , using The first gray level array id 1 records the corresponding gray level, the second array h 2 is used to record the histogram conforming to the second rule, and the second gray level array id 2 is used to record the corresponding gray level, wherein the first rule includes 0<p(i)<=1/255, the second rule includes: p(i)>1/255; the division module is used to subdivide the first array h 1 and the second array h 2 , using jgh 1 The array records the difference between two adjacent numbers in the first grayscale array id 1 , and uses the jg 1 array to record the value of jgh 1 (x)>=preset value, and the number of divided blocks is 1+length(jg 1 ); using The jgh 2 array records the difference between two adjacent numbers in the second grayscale array id 2 , and uses the jg 2 array to record the value of jgh 2 (x)>=preset value, and the number of divided blocks is 1+length(jg 2 ) Determine the module, for setting the first public array Hx to store the block histogram, the second public array idx to store the gray level of the first public array Hx, wherein, the acquisition of each block histogram Hx in the first array h 1 The method is: judging whether the jg 1 array is empty, if it is empty, it is determined that the first array h 1 cannot be divided, then the first public array Hx=h 1 , the second public array idx=id 1 , and the first public array Hx is stored The length of the block histogram is length(Hx); if it is not empty, it is determined that the first array h 1 can be divided again, and the number of divided blocks is 1+length(jg 1 ), for 1...(1+length (jg 1 )), the arbitrary block histogram is Hx=h 1 (T1:jg 1 (i)), and the gray level of the corresponding block histogram is idx=id 1 (T1:jg 1 (i)), where i=1...n 1 -1, when i=1, T1=1, when i=2...n 1 -1, T1=1+jg 1 (i); the second array h 2 The acquisition method of each block histogram Hx is as follows: judging whether the jg 2 array is empty, if it is empty, it is determined that the second array h 2 cannot be divided, then the first public array Hx=h 2 , the second public array idx= id 2 , the length of the block histogram stored in the first public array Hx is length(Hx); if it is not empty, it is determined that the second array h 2 can be divided again, and the number of divided blocks is 1+length(jg 2 ), For any block histogram in 1...(1+length(jg 2 )), Hx=h 2 (T2:jg 2 (i)), the gray level of the corresponding block histogram is idx=id 2 (T2:jg 2 (i)), where i=1...n 2 -1, when i=1, T2= 1. When i=2...n 2 -1, T2=1+jg 2 (i); the second calculation module is used to calculate the probability of each block histogram in the first public array Hx cumulative probability Wherein i=1...length(Hx); the third calculation module is used to calculate the histogram of each block in the first public array Hx according to the following formula:
其中i=1...length(Hx),f(i)为输出图像的灰度值,P1为图像细节、亮度、对比度的调节参数;输出模块,用于输出输出图像imageout。 where i=1...length(Hx), f(i) is the gray value of the output image, P 1 is the adjustment parameter of image detail, brightness and contrast; the output module is used to output the output image imageout.
其中,P1取值范围[0,1]。Among them, the value range of P 1 is [0,1].
其中,P1=0.1。Wherein, P 1 =0.1.
其中,预设值为20。Among them, the default value is 20.
由此可见,本发明实施例提供的消费类电子产品的亮度保持的图像细节增强方法及装置,以图像直方图为基础,根据输入图像的特点自动将输入图像的直方图分割为若干分块直方图,并在各分块内做直方图均衡计算,最后合并输出增强图像,从而可以针对消费类电子产品及红外图像处理图像要求输入与输出图像亮度基本保持一致的条件下,提高输出图像的对比度与细节呈现能力,能够更好地保持输入图像的亮度,同时又能够实现图像对比度增强,清晰呈现图像细节。It can be seen that, the method and device for enhancing image details for maintaining the brightness of consumer electronic products provided by the embodiments of the present invention are based on the image histogram, and automatically divide the histogram of the input image into several block histograms according to the characteristics of the input image. image, and perform histogram equalization calculation in each block, and finally combine and output the enhanced image, so that the contrast of the output image can be improved under the condition that the brightness of the input and output images are basically the same for consumer electronic products and infrared image processing images. With the ability to present details, it can better maintain the brightness of the input image, and at the same time, it can enhance the contrast of the image and present the details of the image clearly.
附图说明Description of drawings
为了更清楚地说明本发明实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,下面描述中的附图仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动的前提下,可以根据这些附图获得其他附图。In order to illustrate the technical solutions of the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. The drawings in the following description are only some For those of ordinary skill, other drawings can be obtained from these drawings without any creative effort.
图1为本发明实施例提供的消费类电子产品的亮度保持的图像细节增强方法的流程图;FIG. 1 is a flowchart of a method for enhancing image details for maintaining brightness of a consumer electronic product according to an embodiment of the present invention;
图2为本发明实施例提供的消费类电子产品的亮度保持的图像细节增强装置的结构示意图;2 is a schematic structural diagram of an image detail enhancement device for maintaining brightness of a consumer electronic product according to an embodiment of the present invention;
图3为本发明实施例提供的一般亮度图像—花盆示意图;3 is a schematic diagram of a general brightness image-flower pot provided by an embodiment of the present invention;
图4为本发明实施例提供的低亮度图像—风景示意图;4 is a low-brightness image-landscape schematic diagram provided by an embodiment of the present invention;
图5为本发明实施例提供的红外图像示意图;5 is a schematic diagram of an infrared image provided by an embodiment of the present invention;
图6为本发明实施例提供的高亮度图像—梅花示意图。FIG. 6 is a schematic diagram of a high-brightness image—a plum blossom provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be more thoroughly understood, and will fully convey the scope of the present disclosure to those skilled in the art.
图1示出了本发明实施例提供的消费类电子产品的亮度保持的图像细节增强方法的流程图,参见图1,本发明实施例提供的消费类电子产品的亮度保持的图像细节增强方法,包括:FIG. 1 shows a flowchart of a method for enhancing image details for maintaining brightness of a consumer electronic product provided by an embodiment of the present invention. Referring to FIG. 1 , the method for enhancing image details for maintaining brightness for a consumer electronic product provided by an embodiment of the present invention, include:
S1,计算灰度输入图像I的灰度级直方图h(i)、概率p(i),其中,i为灰度级,设置输出图像imageout与输入图像I尺寸相同,数值设置为零矩阵。S1, calculate the grayscale histogram h(i) and probability p(i) of the grayscale input image I, where i is the grayscale level, set the output image imageout to be the same size as the input image I, and set the value to a zero matrix.
具体地,可以利用现有的公式计算输入图像I的灰度级直方图h(i)和概率p(i)。其中:概率输出图像imageout的图像大小可以与输入图像I的矩阵相同,例如输入图像I的矩阵是20×11,输出图像imageout也是20×11,输出图像imageout的数据表中的数据为0。Specifically, the gray level histogram h(i) and the probability p(i) of the input image I can be calculated by using the existing formula. where: probability The image size of the output image imageout can be the same as the matrix of the input image I. For example, the matrix of the input image I is 20×11, the output image imageout is also 20×11, and the data in the data table of the output image imageout is 0.
S2,利用第一数组h1记录符合第一规则的直方图,利用第一灰度级数组id1记录对应灰度级,利用第二数组h2记录符合第二规则的直方图,利用第二灰度级数组id2记录对应灰度级,其中,第一规则包括0<p(i)<=1/255,第二规则包括:p(i)>1/255。S2, use the first array h 1 to record the histogram conforming to the first rule, use the first gray level array id 1 to record the corresponding gray level, use the second array h 2 to record the histogram conforming to the second rule, use the second The gray level array id 2 records the corresponding gray level, wherein the first rule includes 0<p(i)<=1/255, and the second rule includes: p(i)>1/255.
具体地,将0<p(i)<=1/255的直方图分成一类用h1数组记录,即h1(1)...h1(n1)记录统计数,id1(1)...id1(n1)即id1数组记录对应灰度级;同理将p(i)>1/255的直方图分成另外一类用h2数组记录,即h2(1)...h2(n2)记录统计数,id2(1)...id2(n2)即id2数组记录对应灰度级。其中,n1为第一数组h1中的直方图个数,n2为第二数组h2中的直方图个数。Specifically, the histogram of 0<p(i)<=1/255 is divided into one class and recorded by h 1 array, that is, h 1 (1)...h 1 (n 1 ) records the statistics, id 1 (1 )...id 1 (n 1 ) means that the id 1 array records the corresponding gray level; in the same way, the histogram of p(i)>1/255 is divided into another type and recorded by the h 2 array, that is, h 2 (1) ...h 2 (n 2 ) records the statistics, id 2 (1)...id 2 (n 2 ) means that the id 2 array records the corresponding gray level. Wherein, n 1 is the number of histograms in the first array h 1 , and n 2 is the number of histograms in the second array h 2 .
S3,将第一数组h1和第二数组h2进行再分割,利用jgh1数组记录第一灰度级数组id1中相邻两数之差,利用jg1数组记录jgh1(x)>=预设值的数值,分割块数大小1+length(jg1)个;利用jgh2数组记录第二灰度级数组id2中相邻两数之差,利用jg2数组记录jgh2(x)>=预设值的数值,分割块数大小1+length(jg2)个。S3, subdivide the first array h 1 and the second array h 2 , use the jgh 1 array to record the difference between two adjacent numbers in the first grayscale array id 1 , and use the jg 1 array to record jgh 1 (x)> = The value of the preset value, the number of divided blocks is 1+length(jg 1 ); the jgh 2 array is used to record the difference between two adjacent numbers in the second grayscale array id 2 , and the jg 2 array is used to record jgh 2 (x )>=the value of the preset value, the number of divided blocks is 1+length(jg 2 ).
作为本发明实施例的一个可选实施方式,预设值为20。具体地,本步骤进行直方图h1、h2再分割。利用公式jgh1(x)=id1(x+1)-id1(x)x=1...n1-1,记录id1数组相邻两数之差,差值放jgh1数组中,同时将jgh1(x)>=20的数值放置数组jg1中,分割块数大小1+length(jg1)个;同理,利用公式jgh2(x)=id2(x+1)-id2(x)x=1...n2-1,记录id2数组相邻两数之差,差值放jgh2数组中,同时将jgh2(x)>=20的数值放置数组jg2中,分割块数大小1+length(jg2)个。As an optional implementation manner of the embodiment of the present invention, the preset value is 20. Specifically, in this step, the histograms h 1 and h 2 are re-segmented. Using the formula jgh 1 (x)=id 1 (x+1)-id 1 (x)x=1...n 1 -1, record the difference between two adjacent numbers in the id 1 array, and put the difference in the jgh 1 array , at the same time, the value of jgh 1 (x)>=20 is placed in the array jg 1 , and the number of divided blocks is 1+length(jg 1 ); similarly, using the formula jgh 2 (x)=id 2 (x+1) -id 2 (x)x=1...n 2 -1, record the difference between two adjacent numbers in the id 2 array, put the difference in the jgh 2 array, and put the value of jgh 2 (x)>=20 in the array In jg 2 , the number of divided blocks is 1+length(jg 2 ).
S4,设置第一公共数组Hx存放分块直方图,第二公共数组idx存放第一公共数组Hx的灰度级,其中,第一数组h1中各分块直方图Hx的获取方式为:判断jg1数组是否为空,若为空,确定第一数组h1不能分割,则令第一公共数组Hx=h1,第二公共数组idx=id1,第一公共数组Hx存放的分块直方图长度为length(Hx);若不为空,确定第一数组h1可以再次分割,分割的块数为1+length(jg1)个,对1...(1+length(jg1))中任意分块直方图为Hx=h1(T1:jg1(i)),对应分块直方图的灰度级为idx=id1(T1:jg1(i)),其中i=1...n1-1,在i=1时,T1=1,在i=2...n1-1时,T1=1+jg1(i);第二数组h2中各分块直方图Hx的获取方式为:判断jg2数组是否为空,若为空,确定第二数组h2不能分割,则令第一公共数组Hx=h2,第二公共数组idx=id2,第一公共数组Hx存放的分块直方图长度为length(Hx);若不为空,确定第二数组h2可以再次分割,分割的块数为1+length(jg2)个,对1...(1+length(jg2))中任意分块直方图为Hx=h2(T2:jg2(i)),对应分块直方图的灰度级为idx=id2(T2:jg2(i)),其中i=1...n2-1,在i=1时,T2=1,在i=2...n2-1时,T2=1+jg2(i)。S4, set the first public array Hx to store the block histogram, and the second public array idx to store the gray level of the first public array Hx, wherein, the acquisition method of each block histogram Hx in the first array h 1 is: judging Whether the jg 1 array is empty, if it is empty, it is determined that the first array h 1 cannot be divided, then let the first public array Hx=h 1 , the second public array idx=id 1 , and the block histogram stored in the first public array Hx The length of the graph is length(Hx); if it is not empty, it is determined that the first array h 1 can be divided again, and the number of divided blocks is 1+length(jg 1 ), for 1...(1+length(jg 1 ) ) in any block histogram is Hx=h 1 (T1:jg 1 (i)), and the gray level of the corresponding block histogram is idx=id 1 (T1:jg 1 (i)), where i=1 ...n 1 -1, when i=1, T1=1, when i=2...n 1 -1, T1=1+jg 1 (i); each block in the second array h 2 The acquisition method of the histogram Hx is as follows: judging whether the jg 2 array is empty, if it is empty, it is determined that the second array h 2 cannot be divided, then the first public array Hx=h 2 , the second public array idx=id 2 , the The length of the block histogram stored in a public array Hx is length(Hx); if it is not empty, it is determined that the second array h 2 can be divided again, and the number of divided blocks is 1+length(jg 2 ), for 1.. .(1+length(jg 2 )), the arbitrary block histogram is Hx=h 2 (T2:jg 2 (i)), and the gray level of the corresponding block histogram is idx=id 2 (T2:jg 2 (i)), where i= 1 ...n2-1, when i=1, T2=1, and when i= 2 ...n2-1, T2=1+ jg2 (i).
具体地,设置公共数组Hx存放分块直方图,公共数组idx存放Hx的灰度级,直方图h1中各分块直方图Hx的获取方式为:首先,判断数组jg1是否为空(isempty(jg1)==1),若为空,表明直方图h1不能分割,则Hx=h1,idx=id1,分块Hx长度为length(Hx);其次,若不为空,表明直方图h1可以再次分割,可以分割的块数为1+length(jg1)个。对1...(1+length(jg1))中任意分块直方图为Hx=h1(T1:jg1(i)),对应分块直方图的灰度级为idx=id1(T1:jg1(i)),其中i=1...n1-1,T1变量在i=1时,取T1=1,而在i=2...n1-1时,T1变量为上一块的处理完的jg1(i)+1,即T1=1+jg1(i)。Specifically, the public array Hx is set to store the block histogram, the public array idx is set to store the gray level of Hx, and the acquisition method of each block histogram Hx in the histogram h1 is: first , determine whether the array jg1 is empty (isempty (jg 1 )==1), if it is empty, it indicates that the histogram h 1 cannot be divided, then Hx=h 1 , idx=id 1 , the length of the segment Hx is length(Hx); secondly, if it is not empty, it indicates that The histogram h 1 can be divided again, and the number of blocks that can be divided is 1+length(jg 1 ). For any block histogram in 1...(1+length(jg 1 )) is Hx=h 1 (T1:jg 1 (i)), the gray level of the corresponding block histogram is idx=id 1 ( T1:jg 1 (i)), where i=1...n 1 -1, the T1 variable takes T1=1 when i=1, and the T1 variable when i=2...n 1 -1 is the processed jg 1 (i)+1 of the previous block, that is, T1=1+jg 1 (i).
(5)同理,如步骤(4)一样,获取直方图h2中各分块直方图Hx。首先,判断数组jg2是否为空(isempty(jg2)==1),若为空,表明直方图h2不能分割,则Hx=h2,idx=id2,分块Hx长度为length(Hx);其次,若不为空,表明直方图h2可以再次分割,可以分割的块数为1+length(jg2)个。对1...(1+length(jg2))中任意分块直方图为Hx=h2(T2:jg2(i)),对应分块直方图的灰度级为idx=id2(T2:jg2(i)),其中i=1...n2-1,T2变量在i=1时,取T2=1,而在i=2...n2-1时,T2变量为上一块的处理完的jg2(i)+1,即T2=1+jg2(i)。(5) Similarly, as in step ( 4 ), obtain the histogram Hx of each block in the histogram h2. First, judge whether the array jg 2 is empty (isempty(jg 2 )==1), if it is empty, it means that the histogram h 2 cannot be divided, then Hx=h 2 , idx=id 2 , and the length of the segment Hx is length( Hx); secondly, if it is not empty, it indicates that the histogram h 2 can be divided again, and the number of blocks that can be divided is 1+length(jg 2 ). For any block histogram in 1...(1+length(jg 2 )) is Hx=h 2 (T2:jg 2 (i)), the gray level of the corresponding block histogram is idx=id 2 ( T2:jg 2 (i)), where i=1...n 2 -1, the T2 variable takes T2=1 when i=1, and the T2 variable when i=2...n 2 -1 is the processed jg 2 (i)+1 of the previous block, that is, T2=1+jg 2 (i).
S5,计算第一公共数组Hx中各分块直方图的概率累积概率其中i=1...length(Hx);S5, calculate the probability of each block histogram in the first public array Hx cumulative probability where i=1...length(Hx);
S6,对第一公共数组Hx中各分块直方图按如下公式计算:S6, the histogram of each block in the first public array Hx is calculated according to the following formula:
其中i=1...length(Hx),f(i)为输出图像的灰度值,P1为图像细节、亮度、对比度的调节参数。where i=1...length(Hx), f(i) is the gray value of the output image, and P 1 is the adjustment parameter of image detail, brightness, and contrast.
作为本发明实施例的一个可选实施方式,P1取值范围[0,1]。优选的P1=0.1。具体地,P1是可以根据需要变化的,P1可以细微调节图像的对比度与信息熵,在实际计算的过程中选取0.1可以简化计算、用于提高计算速度。As an optional implementation manner of the embodiment of the present invention, P 1 has a value range of [0, 1]. Preferred P 1 =0.1. Specifically, P 1 can be changed as required, P 1 can finely adjust the contrast and information entropy of the image, and selecting 0.1 in the actual calculation process can simplify the calculation and improve the calculation speed.
S7,输出输出图像imageout。S7, output the output image imageout.
由此可见,通过本发明实施例提供的消费类电子产品的亮度保持的图像细节增强方法,采用直方图自动分割技术的局部直方图处理,算法简单有效,能够很好地保持输入图像的亮度,同时又能够实现图像对比度增强,清晰呈现图像细节,可以适用于亮度保持要求较高的消费类电子产品图像和红外图像处理系统中。It can be seen that the method for enhancing the image details of the consumer electronic products provided by the embodiment of the present invention adopts the local histogram processing of the automatic histogram segmentation technology, the algorithm is simple and effective, and the brightness of the input image can be well maintained. At the same time, it can achieve image contrast enhancement, clearly present image details, and can be applied to consumer electronic product images and infrared image processing systems that require high brightness maintenance.
图2示出了本发明实施例提供的消费类电子产品的亮度保持的图像细节增强装置的结构示意图,本发明实施例提供的消费类电子产品的亮度保持的图像细节增强装置应用于上述方法,以下仅对消费类电子产品的亮度保持的图像细节增强装置的结构进行概括说明,其他未尽事宜,请参照上述消费类电子产品的亮度保持的图像细节增强方法中的相关说明,参见图2,本发明实施例提供的消费类电子产品的亮度保持的图像细节增强装置,包括:2 shows a schematic structural diagram of an image detail enhancement device for maintaining brightness of a consumer electronic product provided by an embodiment of the present invention. The device for enhancing image detail for maintaining brightness of a consumer electronic product provided by an embodiment of the present invention is applied to the above method, The following only briefly describes the structure of the image detail enhancement device for maintaining the brightness of consumer electronic products. The image detail enhancement device for maintaining the brightness of a consumer electronic product provided by the embodiment of the present invention includes:
第一计算模块,用于计算灰度输入图像I的灰度级直方图h(i)、概率p(i),其中,i为灰度级,设置输出图像imageout与输入图像I尺寸相同,数值设置为零矩阵;The first calculation module is used to calculate the grayscale histogram h(i) and the probability p(i) of the grayscale input image I, where i is the grayscale, and the output image imageout is set to be the same size as the input image I, and the numerical value set to zero matrix;
记录模块,用于利用第一数组h1记录符合第一规则的直方图,利用第一灰度级数组id1记录对应灰度级,利用第二数组h2记录符合第二规则的直方图,利用第二灰度级数组id2记录对应灰度级,其中,第一规则包括0<p(i)<=1/255,第二规则包括:p(i)>1/255;The recording module is used to record the histogram conforming to the first rule by using the first array h1 , record the corresponding grayscale by using the first grayscale array id1, and record the histogram conforming to the second rule by using the second array h2, The corresponding gray level is recorded by using the second gray level array id 2 , wherein the first rule includes 0<p(i)<=1/255, and the second rule includes: p(i)>1/255;
分割模块,用于将第一数组h1和第二数组h2进行再分割,利用jgh1数组记录第一灰度级数组id1中相邻两数之差,利用jg1数组记录jgh1(x)>=预设值的数值,分割块数大小1+length(jg1)个;利用jgh2数组记录第二灰度级数组id2中相邻两数之差,利用jg2数组记录jgh2(x)>=预设值的数值,分割块数大小1+length(jg2)个;The segmentation module is used to subdivide the first array h 1 and the second array h 2 , use the jgh 1 array to record the difference between two adjacent numbers in the first grayscale array id 1 , and use the jg 1 array to record jgh 1 ( x)>= the value of the preset value, the size of the number of divided blocks is 1+length(jg 1 ); use the jgh 2 array to record the difference between two adjacent numbers in the second grayscale array id 2 , and use the jg 2 array to record jgh 2 (x)>= the value of the preset value, the number of divided blocks is 1+length(jg 2 );
确定模块,用于设置第一公共数组Hx存放分块直方图,第二公共数组idx存放第一公共数组Hx的灰度级,其中,第一数组h1中各分块直方图Hx的获取方式为:判断jg1数组是否为空,若为空,确定第一数组h1不能分割,则令第一公共数组Hx=h1,第二公共数组idx=id1,第一公共数组Hx存放的分块直方图长度为length(Hx);若不为空,确定第一数组h1可以再次分割,分割的块数为1+length(jg1)个,对1...(1+length(jg1))中任意分块直方图为Hx=h1(T1:jg1(i)),对应分块直方图的灰度级为idx=id1(T1:jg1(i)),其中i=1...n1-1,在i=1时,T1=1,在i=2...n1-1时,T1=1+jg1(i);第二数组h2中各分块直方图Hx的获取方式为:判断jg2数组是否为空,若为空,确定第二数组h2不能分割,则令第一公共数组Hx=h2,第二公共数组idx=id2,第一公共数组Hx存放的分块直方图长度为length(Hx);若不为空,确定第二数组h2可以再次分割,分割的块数为1+length(jg2)个,对1...(1+length(jg2))中任意分块直方图为Hx=h2(T2:jg2(i)),对应分块直方图的灰度级为idx=id2(T2:jg2(i)),其中i=1...n2-1,在i=1时,T2=1,在i=2...n2-1时,T2=1+jg2(i);The determination module is used to set the first public array Hx to store the block histogram, the second public array idx to store the gray level of the first public array Hx, wherein, the acquisition method of each block histogram Hx in the first array h 1 It is: to judge whether the jg 1 array is empty, if it is empty, it is determined that the first array h 1 cannot be divided, then the first public array Hx=h 1 , the second public array idx=id 1 , and the first public array Hx stores the The length of the block histogram is length(Hx); if it is not empty, it is determined that the first array h 1 can be divided again, and the number of divided blocks is 1+length(jg 1 ). For 1...(1+length( jg 1 )) in any block histogram is Hx=h 1 (T1:jg 1 (i)), and the gray level of the corresponding block histogram is idx=id 1 (T1:jg 1 (i)), where i=1...n 1 -1, when i=1, T1=1, when i=2...n 1 -1, T1=1+jg 1 (i); in the second array h 2 The acquisition method of each block histogram Hx is as follows: judging whether the jg 2 array is empty, if it is empty, it is determined that the second array h 2 cannot be divided, then the first public array Hx=h 2 , the second public array idx=id 2. The length of the block histogram stored in the first public array Hx is length(Hx); if it is not empty, it is determined that the second array h 2 can be divided again, and the number of divided blocks is 1+length(jg 2 ). The arbitrary block histogram in 1...(1+length(jg 2 )) is Hx=h 2 (T2:jg 2 (i)), and the gray level of the corresponding block histogram is idx=id 2 (T2 :jg 2 (i)), where i=1...n 2 -1, when i=1, T2=1, when i=2...n 2 -1, T2=1+jg 2 ( i);
第二计算模块,用于计算第一公共数组Hx中各分块直方图的概率累积概率其中i=1...length(Hx);The second calculation module is used to calculate the probability of each block histogram in the first public array Hx cumulative probability where i=1...length(Hx);
第三计算模块,用于对第一公共数组Hx中各分块直方图按如下公式计算:The third calculation module is used to calculate the histogram of each block in the first public array Hx according to the following formula:
其中i=1...length(Hx),f(i)为输出图像的灰度值,P1为图像细节、亮度、对比度的调节参数;where i=1...length(Hx), f(i) is the gray value of the output image, and P 1 is the adjustment parameter of image detail, brightness, and contrast;
输出模块,用于输出输出图像imageout。The output module is used to output the output image imageout.
作为本发明实施例的一个可选实施方式,P1取值范围[0,1]。As an optional implementation manner of the embodiment of the present invention, P 1 has a value range of [0, 1].
作为本发明实施例的一个可选实施方式,P1=0.1。As an optional implementation manner of the embodiment of the present invention, P 1 =0.1.
作为本发明实施例的一个可选实施方式,预设值为20。As an optional implementation manner of the embodiment of the present invention, the preset value is 20.
由此可见,通过本发明实施例提供的消费类电子产品的亮度保持的图像细节增强装置,采用直方图自动分割技术的局部直方图处理,算法简单有效,能够很好地保持输入图像的亮度,同时又能够实现图像对比度增强,清晰呈现图像细节,可以适用于亮度保持要求较高的消费类电子产品图像和红外图像处理系统中。It can be seen that the image detail enhancement device for maintaining the brightness of consumer electronic products provided by the embodiment of the present invention adopts the local histogram processing of the automatic histogram segmentation technology, the algorithm is simple and effective, and the brightness of the input image can be well maintained. At the same time, it can achieve image contrast enhancement, clearly present image details, and can be applied to consumer electronic product images and infrared image processing systems that require high brightness maintenance.
为更好的说明本发明的积极效果,将GHE、BBHE、BHEPL、BHEMHE等算法与本发明进行在运行时间、平均亮度误差(ABME)、峰值信噪比(PSNR)等指标进行对比,数据为处理20幅图像的平均值,数据表如表1。In order to better illustrate the positive effects of the present invention, the algorithms such as GHE, BBHE, BHEPL, and BHEMHE are compared with the present invention for indicators such as running time, average luminance error (ABME), and peak signal-to-noise ratio (PSNR). The data are: The average value of 20 images was processed, and the data table is shown in Table 1.
表1Table 1
从表1看,本发明的运行速度与经典全局直方图(GHE)算法几乎一致,平均亮度误差(ABME)最小,说明本发明增强的图像与输入图像在亮度上基本保持一致;同时本发明处理的图像峰值信噪比(PSNR)最高,噪声抑制最优。It can be seen from Table 1 that the running speed of the present invention is almost the same as that of the classical global histogram (GHE) algorithm, and the average luminance error (ABME) is the smallest, indicating that the enhanced image of the present invention is basically consistent with the input image in terms of brightness; The image peak signal-to-noise ratio (PSNR) is the highest, and the noise suppression is the best.
同时,通过图3、4、5、6表明经过本发明实施例提供的消费类电子产品的亮度保持的图像细节增强方法处理前和处理后的图像。Meanwhile, FIGS. 3 , 4 , 5 , and 6 show the images before and after processing by the image detail enhancement method for maintaining the brightness of the consumer electronic product provided by the embodiment of the present invention.
以上仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。The above are merely examples of the present application, and are not intended to limit the present application. Various modifications and variations of this application are possible for those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included within the scope of the claims of this application.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010322148.2A CN111563865A (en) | 2020-04-22 | 2020-04-22 | Image detail enhancement method and device for brightness preservation of consumer electronic products |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010322148.2A CN111563865A (en) | 2020-04-22 | 2020-04-22 | Image detail enhancement method and device for brightness preservation of consumer electronic products |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111563865A true CN111563865A (en) | 2020-08-21 |
Family
ID=72071723
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010322148.2A Withdrawn CN111563865A (en) | 2020-04-22 | 2020-04-22 | Image detail enhancement method and device for brightness preservation of consumer electronic products |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111563865A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117635466A (en) * | 2024-01-26 | 2024-03-01 | 荣耀终端有限公司 | Image enhancement method, device, electronic equipment and readable storage medium |
-
2020
- 2020-04-22 CN CN202010322148.2A patent/CN111563865A/en not_active Withdrawn
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117635466A (en) * | 2024-01-26 | 2024-03-01 | 荣耀终端有限公司 | Image enhancement method, device, electronic equipment and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11227566B2 (en) | Method for reducing brightness of images, a data-processing apparatus, and a display apparatus | |
US8295607B1 (en) | Adaptive edge map threshold | |
JP2012510760A (en) | Improved bit resolution | |
US9779321B2 (en) | Image processing device and method thereof | |
CN104680500A (en) | Image intensification algorithm based on histogram equalization | |
CN107203982A (en) | A kind of image processing method and device | |
US8515170B2 (en) | Image correction apparatus and correction parameter creation apparatus | |
CN110223244B (en) | Image processing method and device, electronic equipment and storage medium | |
CN112419209A (en) | Image enhancement method for global histogram equalization | |
CN111563865A (en) | Image detail enhancement method and device for brightness preservation of consumer electronic products | |
JP7355763B2 (en) | Tonal mapping of video content colors | |
US20210042895A1 (en) | Field Programmable Gate Array (FPGA) Implementation and Optimization of Augmented Contrast Limited Adaptive Histogram Equalization | |
US9292912B2 (en) | Display apparatus and method for image output thereof | |
CN101377849A (en) | Image processing method and image processing apparatus | |
US10909669B2 (en) | Contrast adjustment system and contrast adjustment method | |
Lin et al. | Tri-histogram equalization based on first order statistics | |
KR20030066511A (en) | Apparatus and method for real-time brightness control of moving images | |
US20220004857A1 (en) | Neural network processing apparatus, neural network processing method, and neural network processing program | |
CN111563863A (en) | Histogram-limited image enhancement method and device | |
CN102855614A (en) | Self-adaptive image stretching method and device in real-time infrared imaging system | |
CN111861947B (en) | Methods and devices for improving information entropy of images using histogram technology | |
CN103793892B (en) | Image processing apparatus and image processing method | |
CN106897980B (en) | Self-adaptive space domain noise reduction method based on local variance | |
US10382516B2 (en) | Detecting upscaled source video | |
US8693809B2 (en) | Video processing method and circuit using thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20200821 |