CN115914864A - Adaptive image shading correction method and image shading correction system - Google Patents
Adaptive image shading correction method and image shading correction system Download PDFInfo
- Publication number
- CN115914864A CN115914864A CN202110889947.2A CN202110889947A CN115914864A CN 115914864 A CN115914864 A CN 115914864A CN 202110889947 A CN202110889947 A CN 202110889947A CN 115914864 A CN115914864 A CN 115914864A
- Authority
- CN
- China
- Prior art keywords
- block
- blocks
- hue
- saturation
- current
- 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.)
- Pending
Links
Images
Landscapes
- Picture Signal Circuits (AREA)
Abstract
Description
技术领域Technical Field
本发明涉及一种校正方法及校正系统,特别是涉及一种自适应的图像阴影校正方法及图像阴影校正系统。The invention relates to a correction method and a correction system, and in particular to an adaptive image shadow correction method and an image shadow correction system.
背景技术Background Art
在影像模块中,存在必然发生的物理现象称镜头阴影(Lens Shading),其成因可概分为二:In the imaging module, there is an inevitable physical phenomenon called lens shading, and its causes can be roughly divided into two categories:
其一为亮度阴影(Luminance Shading),由于镜头可视为凸透镜且会将大部分光线集中在中心区域,进而导致边缘角落处光线不足,也会因为入射角所造成的自然光衰减(以cos4θ近似)导致亮度阴影。One is luminance shading. Since the lens can be regarded as a convex lens and will concentrate most of the light in the central area, resulting in insufficient light in the corners, the natural light attenuation caused by the incident angle (approximated by cos 4 θ) will also cause luminance shading.
其二称为色彩阴影(Color Shading),镜头模块中存在红外光滤波器(IR-CutFilter)位于镜头和影像感测器之间,目的为了防止人眼不可见的红外线光对感测器产生干扰,红外光滤波器主要分为吸收型及反射型。The second is called color shading. There is an infrared light filter (IR-CutFilter) in the lens module, which is located between the lens and the image sensor. The purpose is to prevent infrared light that is invisible to the human eye from interfering with the sensor. Infrared light filters are mainly divided into absorption type and reflection type.
详细而言,反射型的红外光滤波器其好处在于截止区较陡峭,可以切掉较多的红外光,但对于入射光角度的要求是其最大的问题,也是造成色彩阴影的主因之一。而吸收型的红外光滤波器其好处则为稳定且不会因为入射光角度改变而造成截止波长的平移,成本考量则是吸收型滤波器的短处。Specifically, the advantage of reflective infrared filters is that the cut-off region is steeper, which can cut off more infrared light, but the requirement for the incident light angle is its biggest problem and one of the main reasons for color shadows. The advantage of absorption infrared filters is that they are stable and will not cause the cut-off wavelength to shift due to changes in the incident light angle. Cost considerations are the disadvantages of absorption filters.
针对不同镜头、不同感测器之间的差异,相同的图像阴影补偿设置并没有办法对每一个模块都有一样的表现,其次,在阴影补偿中会出现“同色异谱”的现象,在相似色温下所需要搭配的图像阴影补偿其实是不相同的,但以现行的方法来施行的话,时常会有误判的情况发生。Due to the differences between different lenses and sensors, the same image shading compensation setting cannot achieve the same performance for every module. Secondly, the phenomenon of "different colors and different spectra" will occur in shading compensation. The image shading compensation required under similar color temperatures is actually different. However, if it is implemented using the current method, misjudgment often occurs.
发明内容Summary of the invention
本发明所要解决的技术问题在于,针对现有技术的不足提供一种自适应的图像阴影校正方法及图像阴影校正系统。The technical problem to be solved by the present invention is to provide an adaptive image shading correction method and an image shading correction system in view of the deficiencies in the prior art.
为了解决上述的技术问题,本发明所采用的其中一种技术方案是提供一种自适应的图像阴影校正方法,其包括:配置影像捕获装置取得当前画面;配置影像处理电路接收该当前画面,并配置处理单元执行下列步骤:将该当前画面分割为多个区块;从该些区块中选择出多个区块对,其中该些区块对各包括内部区块及外部区块,该内部区块为在该当前画面的内部区域中的该些区块的其中之一,该外部区块为在该当前画面的外部区域中的该些区块的其中之一;针对该些区块对中的每一个执行筛选流程,包括下列步骤:取得当前的该区块对的亮度差异及饱和度差异;判断该亮度差异及该饱和度差异是否分别满足亮度条件及饱和度条件;响应于判断该亮度差异及该饱和度差异分别满足该亮度条件及该饱和度条件,进一步取得当前的该区块对的色相统计数据;判断该色相统计数据是否满足色相相似度条件;响应于判断该色相统计数据满足该色相相似度条件,进一步将当前的该区块对的锐利度进行比较,以判断是否满足锐利度相似度条件;及响应于判断满足该锐利度相似度条件,则将当前的该区块对视为经筛选区块对;响应于取得多个该经筛选区块对,依据该些经筛选区块中的每一个的该色相统计数据、该饱和度差异及该亮度差异,计算总和相似度阈值;针对该些经筛选区块中的每一个,是否具有小于该总和相似度阈值的个别阈值;将具有小于该总和相似度阈值的该个别阈值的该些经筛选区块用于计算阴影补偿值;以该阴影补偿值调整该当前画面。In order to solve the above-mentioned technical problems, one of the technical solutions adopted by the present invention is to provide an adaptive image shading correction method, which includes: configuring an image capture device to obtain a current picture; configuring an image processing circuit to receive the current picture, and configuring a processing unit to perform the following steps: dividing the current picture into a plurality of blocks; selecting a plurality of block pairs from the blocks, wherein the block pairs each include an internal block and an external block, the internal block being one of the blocks in the internal area of the current picture, and the external block being one of the blocks in the external area of the current picture; performing a screening process for each of the block pairs, including the following steps: obtaining a brightness difference and a saturation difference of the current block pair; determining whether the brightness difference and the saturation difference satisfy a brightness condition and a saturation condition, respectively; and determining whether the brightness difference and the saturation difference satisfy a brightness condition and a saturation condition, respectively. The brightness condition and the saturation condition are met, and hue statistics of the current block pair are further obtained; it is determined whether the hue statistics meet the hue similarity condition; in response to the determination that the hue statistics meet the hue similarity condition, the sharpness of the current block pair is further compared to determine whether the sharpness similarity condition is met; and in response to the determination that the sharpness similarity condition is met, the current block pair is regarded as a filtered block pair; in response to obtaining a plurality of filtered block pairs, a total similarity threshold is calculated based on the hue statistics, the saturation difference and the brightness difference of each of the filtered blocks; for each of the filtered blocks, whether there is an individual threshold value less than the total similarity threshold value; the filtered blocks having the individual threshold value less than the total similarity threshold are used to calculate the shadow compensation value; and the current picture is adjusted with the shadow compensation value.
为了解决上述的技术问题,本发明所采用的另外一种技术方案是提供一种自适应的图像阴影校正系统,其包括影像捕获装置及影像处理电路。影像捕获装置,经配置以取得当前画面。影像处理电路接收该当前画面,且包括处理单元,经配置以:将该当前画面分割为多个区块;从该些区块中选择出多个区块对,其中该些区块对各包括内部区块及外部区块,该内部区块为在该当前画面的内部区域中的该些区块的其中之一,该外部区块为在该当前画面的外部区域中的该些区块的其中之一;针对该些区块对中的每一个执行筛选流程,包括下列步骤:取得当前的该区块对的亮度差异及饱和度差异;判断该亮度差异及该饱和度差异是否分别满足亮度条件及饱和度条件;响应于判断该亮度差异及该饱和度差异分别满足该亮度条件及该饱和度条件,进一步取得当前的该区块对的色相统计数据;判断该色相统计数据是否满足色相相似度条件;响应于判断该色相统计数据满足该色相相似度条件,进一步将当前的该区块对的锐利度进行比较,以判断是否满足锐利度相似度条件;及响应于判断满足该锐利度相似度条件,则将当前的该区块对视为经筛选区块对;响应于取得多个该经筛选区块对,依据该些经筛选区块中的每一个的该色相统计数据、该饱和度差异及该亮度差异,计算总和相似度阈值;针对该些经筛选区块中的每一个,是否具有小于该总和相似度阈值的个别阈值;将具有小于该总和相似度阈值的该个别阈值的该些经筛选区块用于计算阴影补偿值;以该阴影补偿值调整该当前画面以产生经调整画面。In order to solve the above-mentioned technical problems, another technical solution adopted by the present invention is to provide an adaptive image shading correction system, which includes an image capture device and an image processing circuit. The image capture device is configured to obtain the current picture. The image processing circuit receives the current picture and includes a processing unit, which is configured to: divide the current picture into multiple blocks; select multiple block pairs from the blocks, wherein the block pairs each include an internal block and an external block, the internal block is one of the blocks in the internal area of the current picture, and the external block is one of the blocks in the external area of the current picture; perform a screening process for each of the block pairs, including the following steps: obtain the current brightness difference and saturation difference of the block pair; determine whether the brightness difference and the saturation difference meet the brightness condition and the saturation condition respectively; in response to determining that the brightness difference and the saturation difference meet the brightness condition and the saturation condition respectively, further obtain the hue statistics of the current block pair; determine the whether the hue statistical data satisfies a hue similarity condition; in response to determining that the hue statistical data satisfies the hue similarity condition, further comparing the sharpness of the current block pair to determine whether the sharpness similarity condition is satisfied; and in response to determining that the sharpness similarity condition is satisfied, treating the current block pair as a filtered block pair; in response to obtaining a plurality of filtered block pairs, calculating a total similarity threshold based on the hue statistical data, the saturation difference and the brightness difference of each of the filtered blocks; for each of the filtered blocks, determining whether it has an individual threshold value less than the total similarity threshold value; using the filtered blocks having the individual threshold value less than the total similarity threshold value to calculate a shadow compensation value; and adjusting the current frame with the shadow compensation value to generate an adjusted frame.
本发明的其中一个有益效果在于,本发明所提供的自适应的图像阴影校正方法及图像阴影校正系统,可以在不同模块之间取得更好的平衡,同时也可以避免掉“同色异谱”所带来的阴影补偿误差。在不消耗额外的计算量以及硬件支持下,由既有自动白平衡以及自动曝光的统计量来做到阴影补偿。One of the beneficial effects of the present invention is that the adaptive image shading correction method and image shading correction system provided by the present invention can achieve a better balance between different modules, and can also avoid the shading compensation error caused by "metamerism". Without consuming additional calculation amount and hardware support, the shading compensation is achieved by the statistics of the existing automatic white balance and automatic exposure.
此外,本发明所提供的自适应的图像阴影校正方法及图像阴影校正系统,可以通过将选定的配对区块经过滤除以及计算相似性,得到最适合用来做阴影补偿运算的配对结果,并且,在所有经过筛选后的配对块中,各别实施移动平均来达成乖离极值剔除,可避免单一配对块造成的偏移量过大,同时保证本发明的图像阴影校正方法及图像阴影校正系统的稳定度。In addition, the adaptive image shading correction method and image shading correction system provided by the present invention can obtain the pairing result most suitable for shadow compensation operation by filtering out the selected pairing blocks and calculating the similarity, and in all the screened pairing blocks, moving average is implemented separately to achieve deviation extreme value elimination, which can avoid excessive offset caused by a single pairing block, while ensuring the stability of the image shading correction method and image shading correction system of the present invention.
为使得能够更进一步了解本发明的特征及技术内容,请参阅以下有关本发明的详细说明与图式,然而所提供的图式仅用于提供参考与说明,并非用来对本发明加以限制。In order to further understand the features and technical contents of the present invention, please refer to the following detailed description and drawings of the present invention. However, the drawings provided are only for reference and description and are not used to limit the present invention.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本发明实施例的图像阴影校正系统的功能方块图。FIG. 1 is a functional block diagram of an image shading correction system according to an embodiment of the present invention.
图2为本发明实施例的图像阴影校正方法的流程图。FIG. 2 is a flow chart of an image shading correction method according to an embodiment of the present invention.
图3为根据本发明实施例的分割为多个区块的当前画面示意图。FIG. 3 is a schematic diagram of a current picture divided into multiple blocks according to an embodiment of the present invention.
图4为根据本发明实施例,从当前画面选出内部区块及外部区块以作为区块对的示意图。FIG. 4 is a schematic diagram of selecting an inner block and an outer block from a current picture as a block pair according to an embodiment of the present invention.
具体实施方式DETAILED DESCRIPTION
以下是通过特定的具体实施例来说明本发明所公开有关“自适应的图像阴影校正方法及图像阴影校正系统”的实施方式,本领域技术人员可由本说明书所公开的内容了解本发明的优点与效果。本发明可通过其他不同的具体实施例加以施行或应用,本说明书中的各项细节也可基于不同观点与应用,在不背离本发明的构思下进行各种修改与变更。另外,本发明的附图仅为简单示意说明,并非依实际尺寸的描绘,事先声明。以下的实施方式将进一步详细说明本发明的相关技术内容,但所公开的内容并非用以限制本发明的保护范围。另外,本文中所使用的术语“或”,应视实际情况可能包括相关联的列出项目中的任一个或者多个的组合。The following is an explanation of the implementation methods of the "adaptive image shading correction method and image shading correction system" disclosed in the present invention through specific embodiments. Those skilled in the art can understand the advantages and effects of the present invention from the contents disclosed in this specification. The present invention can be implemented or applied through other different specific embodiments, and the details in this specification can also be modified and changed in various ways based on different viewpoints and applications without departing from the concept of the present invention. In addition, the drawings of the present invention are only simple schematic illustrations and are not depicted in actual size. It is stated in advance. The following embodiments will further explain the relevant technical contents of the present invention in detail, but the disclosed contents are not intended to limit the scope of protection of the present invention. In addition, the term "or" used in this article may include any one or more combinations of the associated listed items depending on the actual situation.
参阅图1所示,本发明第一实施例提供一种自适应的图像阴影校正系统1,其包括影像捕获装置10及影像处理电路12。影像捕获装置10可例如为相机、摄影机,经配置以取得当前画面FM。图像阴影校正系统1可为手持型装置或类似装置(诸如,具有类似成像能力的桌上型电脑或膝上型电脑)。应注意,影像处理电路12、处理单元120、存储器122及/或其他处理电路在本文中大体上可称为「影像处理电路」。此影像处理电路可全部或部分地体现为软件、固件、硬件或其任何组合。此外,影像处理电路可为所含有的单个处理模块,或可全部或部分地并入图像阴影校正系统1内的其他元件中的任一者内。替代地,影像处理电路12可部分地体现于图像阴影校正系统1内。Referring to FIG. 1 , a first embodiment of the present invention provides an adaptive image
在图1的影像处理电路12中,处理单元120及/或其他数据处理电路可操作地耦接至存储器122以执行用于执行本发明所揭示技术的各种算法。此等算法可由处理单元120及/或其他处理电路、相关联的固件或软件基于可由处理单元120及/或其他处理电路执行的某些指令来执行。可使用任何合适制品(包括一个或多个有形电脑可读媒体)来储存此等指令以至少集中地储存该等指令。该(等)制品可包括(例如)存储器122。存储器122可包括用于储存数据及可执行指令的任何合适制品,诸如随机存取存储器、只读存储器、可重写快闪存储器、硬碟机及光碟。In the image processing circuit 12 of FIG. 1 , the
可进一步参考图2、图3及图4,图2为根据本发明实施例的图像阴影校正方法的流程图,图3为根据本发明实施例的分割为多个区块的当前画面示意图,图4为根据本发明实施例,从当前画面选出内部区块及外部区块以作为区块对的示意图。Further reference may be made to Figures 2, 3 and 4, wherein Figure 2 is a flow chart of an image shading correction method according to an embodiment of the present invention, Figure 3 is a schematic diagram of a current picture divided into multiple blocks according to an embodiment of the present invention, and Figure 4 is a schematic diagram of selecting internal blocks and external blocks from the current picture as block pairs according to an embodiment of the present invention.
如图2所示,图像阴影校正方法可包括下列步骤:As shown in FIG2 , the image shading correction method may include the following steps:
步骤S200:将当前画面FM分割为多个区块BLK。例如,图3示出将当前画面FM分割为10乘10的多个区块BLK,且区块BLK的大小相等,但本发明不限于此,可依据需求改变其大小及数量配置。Step S200: divide the current frame FM into a plurality of blocks BLK. For example, FIG3 shows that the current frame FM is divided into a plurality of 10×10 blocks BLK, and the sizes of the blocks BLK are equal, but the present invention is not limited thereto, and the sizes and number of the blocks BLK can be changed according to the requirements.
步骤S201:从该些区块BLK中选择出多个区块对。Step S201: Select a plurality of block pairs from the blocks BLK.
详细而言,区块对各包括内部区块IB及外部区块OB,内部区块IB为在当前画面FM的内部区域IA中的多个区块BLK的其中之一,外部区块OB为在当前画面的外部区域OA中的多个区块BLK的其中之一。其中,区块对的数量至多可达到该些区块BLK的总数,且选择方式可为重复或不重复的。In detail, each block pair includes an inner block IB and an outer block OB, wherein the inner block IB is one of the blocks BLK in the inner area IA of the current frame FM, and the outer block OB is one of the blocks BLK in the outer area OA of the current frame. The number of block pairs can be at most the total number of the blocks BLK, and the selection method can be repeated or non-repeated.
为了准确地还原影像捕获装置10的镜头阴影所造成的影像误差,须先筛选出有参考价值的区块对。因此,执行步骤S202:针对该些区块对中的每一个执行筛选流程,包括下列步骤:In order to accurately restore the image error caused by the lens shading of the
步骤S203:取得当前的区块对的亮度差异及饱和度差异。Step S203: Obtain the brightness difference and saturation difference of the current block pair.
详细而言,若仅是考量区块对的亮度差异,容易造成误判,因此,需要同时考虑饱和度差异。在一些实施例中,可先计算内部区块IB中的多个像素的亮度平均值,以及外部区块OB中的多个像素的亮度平均值,进而以两者之间的差值作为亮度差异。如此,可避免在像素级下进行运算,以节省系统运算量。In detail, if only the brightness difference of the block pair is considered, it is easy to cause misjudgment, so the saturation difference needs to be considered at the same time. In some embodiments, the brightness average of multiple pixels in the internal block IB and the brightness average of multiple pixels in the external block OB can be calculated first, and then the difference between the two is used as the brightness difference. In this way, it is possible to avoid performing operations at the pixel level to save system operations.
此外,在此步骤中,内部区块IB或外部区块OB的亮度平均值是将对应的该些像素中,其像素亮度高于亮度阈值者剔除后所计算。换言之,可通过设定亮度阈值,来剔除过曝的像素后,统计区块内有效的像素亮度。In addition, in this step, the brightness average of the internal block IB or the external block OB is calculated by eliminating the corresponding pixels whose pixel brightness is higher than the brightness threshold. In other words, the effective pixel brightness in the block can be counted by setting the brightness threshold to eliminate overexposed pixels.
另一方面,区块对的饱和度差异为内部区块IB的饱和度与外部区块OB的饱和度之间的差值。On the other hand, the saturation difference of the block pair is the difference between the saturation of the inner block IB and the saturation of the outer block OB.
内部区块IB或外部区块OB的饱和度可由下式(1)表示:The saturation of the inner block IB or the outer block OB can be expressed by the following formula (1):
其中,Δ=Cmax-Cmin,S为饱和度,Cmax为RGB极大值,Cmin为RGB极小值,可分别由下式(2)、(3)表示:Wherein, Δ=C max -C min , S is the saturation, C max is the RGB maximum value, and C min is the RGB minimum value, which can be expressed by the following equations (2) and (3) respectively:
Cmax=max(R′,G′,B′)...式(2);C max =max(R′, G′, B′)...Equation (2);
Cmin=min(R′,G′,B′)...式(3);C min =min(R′, G′, B′)...Formula (3);
其中,且 in, and
R为红色坐标值、G为绿色坐标值,B为蓝色坐标值。R is the red coordinate value, G is the green coordinate value, and B is the blue coordinate value.
步骤S204:判断亮度差异及饱和度差异是否分别满足亮度条件及饱和度条件。亮度条件及饱和度条件可例如为:在内外饱和度都较低的情况下,代表内部区块及外部区块均接近灰色,基于阴影补偿的判断上,即便内部区块及外部区块之间的亮度差异较大,仍应视为具有较高相似度而可作为用于判断阴影补偿的区块对。Step S204: Determine whether the brightness difference and the saturation difference satisfy the brightness condition and the saturation condition respectively. The brightness condition and the saturation condition may be, for example, when the saturation of both the inner and outer blocks is low, it means that both the inner block and the outer block are close to gray. Based on the determination of shadow compensation, even if the brightness difference between the inner block and the outer block is large, they should still be considered to have a high similarity and can be used as a block pair for determining shadow compensation.
响应于判断亮度差异未满足亮度条件,或饱和度差异未满足饱和度条件,进入步骤S213:结束对当前区块对的筛选流程,可接续判断其余未筛选的区块对。In response to determining that the brightness difference does not satisfy the brightness condition, or the saturation difference does not satisfy the saturation condition, the process proceeds to step S213: the screening process for the current block pair is terminated, and the remaining unscreened block pairs may be continuously determined.
响应于判断亮度差异及饱和度差异分别满足亮度条件及饱和度条件,进入步骤S205:取得当前的区块对的色相统计数据。In response to determining that the brightness difference and the saturation difference satisfy the brightness condition and the saturation condition respectively, the process proceeds to step S205 : obtaining hue statistics of the current block pair.
详细而言,色相统计数据可包括红色增益及绿色增益,可作为判断区块对是否具有相似色相的条件。Specifically, the hue statistical data may include red gain and green gain, which may be used as a condition for determining whether a block pair has similar hues.
红色增益(R Gain)为外部区块或内部区块中,所有像素的红色坐标值的平均值以及所有像素的绿色坐标值的平均值的比值,亦即,称之为区块平均红色坐标值及区块平均绿色坐标值的比值(R/G)。需要说明的是,内部区块的R Gain标示为R/G,外部区块的R Gain标示为R’/G’。The red gain (R Gain) is the ratio of the average red coordinate value of all pixels in the outer block or the inner block to the average green coordinate value of all pixels, that is, the ratio of the block average red coordinate value to the block average green coordinate value (R/G). It should be noted that the R Gain of the inner block is marked as R/G, and the R Gain of the outer block is marked as R’/G’.
蓝色增益(B Gain)则为外部区块或内部区块中,所有像素的蓝色坐标值的平均值以及所有像素的绿色坐标值的平均值的比值,亦即,称之为区块平均蓝色坐标值及区块平均绿色坐标值的比值(B/G)。需要说明的是,内部区块的B Gain标示为B/G,外部区块的BGain标示为B’/G’。The blue gain (B Gain) is the ratio of the average blue coordinate value of all pixels in the outer block or the inner block to the average green coordinate value of all pixels, that is, the ratio of the block average blue coordinate value to the block average green coordinate value (B/G). It should be noted that the B Gain of the inner block is marked as B/G, and the B Gain of the outer block is marked as B’/G’.
此外,虽然红色增益及蓝色增益可作为判断区块对是否具有相似色相的条件,但由于区块对的绿色坐标值为关键因子,因此,色相统计数据还包括当前的区块对的内部区块的区块平均绿色坐标值及外部区块的区块平均绿色坐标值的比值,此比值作为一绿色通道比值,用于判断及避免绿色坐标值所造成的色相通道错误情形。In addition, although red gain and blue gain can be used as conditions for determining whether a block pair has similar hue, since the green coordinate value of the block pair is the key factor, the hue statistics data also includes the ratio of the block average green coordinate value of the inner block of the current block pair to the block average green coordinate value of the outer block. This ratio is used as a green channel ratio to determine and avoid hue channel errors caused by green coordinate values.
步骤S206:判断色相统计数据是否满足色相相似度条件。Step S206: Determine whether the hue statistical data meets the hue similarity condition.
在此步骤中,色相相似度条件可例如为判断是否满足下式(4):In this step, the hue similarity condition may be, for example, to determine whether the following formula (4) is satisfied:
0.9<Hue Diff’/Hue Diff<1.1…式(4);0.9<Hue Diff’/Hue Diff<1.1…Formula (4);
其中,Hue Diff代表在内部区块中,R/G及B/G之间的差异值,而Hue Diff’代表在外部区块中,R’/G’及B’/G’之间的差异值。其中的意义在于,从RGB坐标转换至HSV坐标时,X轴为R/G,Y轴为B/G,在HSV坐标上可以藉由R/G、B/G的数值来当作色相的参考值,且可用于取代HSV中的H。Among them, Hue Diff represents the difference between R/G and B/G in the inner block, and Hue Diff' represents the difference between R'/G' and B'/G' in the outer block. The significance lies in that when converting from RGB coordinates to HSV coordinates, the X axis is R/G and the Y axis is B/G. The values of R/G and B/G on the HSV coordinates can be used as reference values for hue and can be used to replace H in HSV.
因此,判断色相统计数据是否满足色相相似度条件的步骤,可包括先判别绿色通道比值是否在预定色相范围内,再比较内部区块及外部区块的红色增益及蓝色增益。Therefore, the step of determining whether the hue statistical data satisfies the hue similarity condition may include first determining whether the green channel ratio is within a predetermined hue range, and then comparing the red gain and the blue gain of the inner block and the outer block.
响应于判断该色相统计数据满足该色相相似度条件,进入步骤S207:将当前的区块对的锐利度进行比较,以判断是否满足锐利度相似度条件。In response to determining that the hue statistical data satisfies the hue similarity condition, the process proceeds to step S207: comparing the sharpness of the current block pair to determine whether the sharpness similarity condition is satisfied.
详细而言,计算区块对的锐利度是为了判断其画面复杂度,且在画面复杂的情形下,计算其灰阶的平均值实质上具备进行阴影补偿的参考价值。因此,本发明可通过锐利度统计量(AF)来给予了不同复杂度下的场景,相应的阈值来做为取块的权重。Specifically, the sharpness of a block pair is calculated to determine the complexity of the image, and in the case of a complex image, calculating the average grayscale value is actually a reference for shadow compensation. Therefore, the present invention can use the sharpness statistic (AF) to give scenes of different complexities, and the corresponding threshold is used as the weight of the block.
详细而言,可藉由内外锐利度的比例当作设定权重时使用的参数,其比值皆为小值除以大值。举例来说,若是内部区块的锐利度与外部区块的锐利度比值在0.9至1的范围内,则设定权重为1;若锐利度比值落在0.75至0.9的范围内,则取此区间的平均值作为权重,亦即,权重为(0.75+0.9)/2,为0.825,并且可以此类推计算所有区块对的权重。Specifically, the ratio of the sharpness of the inner and outer blocks can be used as a parameter for setting the weight, and the ratio is the smaller value divided by the larger value. For example, if the sharpness ratio of the inner block to the outer block is in the range of 0.9 to 1, the weight is set to 1; if the sharpness ratio falls in the range of 0.75 to 0.9, the average value of this interval is taken as the weight, that is, the weight is (0.75+0.9)/2, which is 0.825, and the weights of all block pairs can be calculated in this way.
而将当前的区块对的锐利度进行比较的步骤可包括对外部区块OB及内部区块IB分别执行边缘检测Sobel滤波器,以产生内块锐利度及外块锐利度并进行比较。The step of comparing the sharpness of the current block pair may include performing edge detection Sobel filters on the outer block OB and the inner block IB respectively to generate inner block sharpness and outer block sharpness for comparison.
锐利度可由下式(5)表示:The sharpness can be expressed by the following formula (5):
边缘检测Sobel滤波器可由下式(6)、(7)表示:The edge detection Sobel filter can be expressed by the following equations (6) and (7):
其中,Image可为外部区块OB及内部区块IB对应的图像。Here, Image may be an image corresponding to the external block OB and the internal block IB.
进一步的,内块锐利度可与外块锐利度进行比较以判断是否满足锐利度相似度条件。例如,可计算内块锐利度与外块锐利度之间的差值,并判断此差值是否在锐利度范围内。或者,可计算内块锐利度与外块锐利度的比例,并判断此比例是否在锐利度范围设定的比例内,例如,可设定锐利度范围为0.95至1.05之间。Further, the inner block sharpness can be compared with the outer block sharpness to determine whether the sharpness similarity condition is satisfied. For example, the difference between the inner block sharpness and the outer block sharpness can be calculated, and it can be determined whether the difference is within the sharpness range. Alternatively, the ratio of the inner block sharpness to the outer block sharpness can be calculated, and it can be determined whether the ratio is within the ratio set by the sharpness range, for example, the sharpness range can be set between 0.95 and 1.05.
举例而言,当内块锐利度与外块锐利度的比例为1时,代表内块锐利度与外块锐利度相等,而且是在锐利度范围内,因此满足锐利度相似度条件。而针对锐利度范围中的不同区间,可给予不同的信心权重,例如,在1至1.03的区间内时,给予100%的信任度,信心权重为1,当在1.03至1.05的区间内时,则给予80%信任度,信心权重为0.8,并以此类推。For example, when the ratio of the inner block sharpness to the outer block sharpness is 1, it means that the inner block sharpness is equal to the outer block sharpness and is within the sharpness range, thus satisfying the sharpness similarity condition. Different confidence weights may be given to different intervals in the sharpness range, for example, when it is within the interval of 1 to 1.03, 100% confidence is given, and the confidence weight is 1, when it is within the interval of 1.03 to 1.05, 80% confidence is given, and the confidence weight is 0.8, and so on.
响应于判断满足锐利度相似度条件,进入步骤S208:将当前的该区块对视为经筛选区块对,代表通过筛选流程。In response to the determination that the sharpness similarity condition is satisfied, the process proceeds to step S208 : the current block pair is regarded as a filtered block pair, which means that the filtering process has been passed.
取得多个经筛选区块对后,可先各别统计其红色增益及绿色增益,并执行移动平均过滤以剔除乖离极值,如此,将可避免单一配对块造成的偏移量过大,保证本发明的算法的稳定度。After obtaining a plurality of filtered block pairs, the red gain and green gain of each pair can be counted, and moving average filtering can be performed to remove deviation extreme values. In this way, excessive offset caused by a single paired block can be avoided, thereby ensuring the stability of the algorithm of the present invention.
接着,在针对每一个区块对执行筛选流程而取得多个经筛选区块对后,进入步骤S209:依据该些经筛选区块中的每一个的色相统计数据、饱和度差异及亮度差异,计算总和相似度阈值。Next, after performing the screening process for each block pair to obtain a plurality of screened block pairs, the process proceeds to step S209 : calculating a total similarity threshold value according to the hue statistics, saturation difference, and brightness difference of each of the screened blocks.
详细而言,可通过藉由计算该些经筛选区块对的欧几里得范数来设置总和相似度阈值,可由下式(8)表示:Specifically, the total similarity threshold can be set by calculating the Euclidean norm of the filtered block pairs, which can be expressed by the following formula (8):
其中,RBGain_Diff为经筛选区块对中的内部区块及外部区块之间的色相(HUE)的差异,Saturation_Diff为经筛选区块对中的内部区块及外部区块之间的饱和度差异,Brightness_Diff为经筛选区块对中的内部区块及外部区块之间的亮度差异。Among them, RBGain_Diff is the difference in hue (HUE) between the inner block and the outer block in the filtered block pair, Saturation_Diff is the difference in saturation between the inner block and the outer block in the filtered block pair, and Brightness_Diff is the difference in brightness between the inner block and the outer block in the filtered block pair.
针对该些经筛选区块对中的每一个,进入步骤S210:判断是否具有小于总和相似度阈值的个别阈值。若是,则进入步骤S211,否则进入步骤S214,对并未具有小于总和相似度阈值的个别阈值的该些经筛选区块对进行剔除。For each of the filtered block pairs, proceed to step S210: determine whether they have individual thresholds less than the total similarity threshold. If yes, proceed to step S211, otherwise proceed to step S214, and eliminate the filtered block pairs that do not have individual thresholds less than the total similarity threshold.
此外,在步骤S210中,可进一步判断此区块对的权重是否大于预定权重值,亦即,根据上文中所描述的,根据内外锐利度的比例所决定的权重。在一些实施例中,若权重小于0.5,则弃用此区块对。In addition, in step S210, it can be further determined whether the weight of the block pair is greater than a predetermined weight value, that is, the weight determined according to the ratio of the inside and outside sharpness as described above. In some embodiments, if the weight is less than 0.5, the block pair is discarded.
响应于具有小于总和相似度阈值的个别阈值,进入步骤S211:将具有小于总和相似度阈值的该个别阈值的该些经筛选区块用于计算阴影补偿值。In response to having the individual threshold value smaller than the total similarity threshold value, the process proceeds to step S211 : the filtered blocks having the individual threshold value smaller than the total similarity threshold value are used to calculate the shadow compensation value.
更详细而言,计算阴影补偿值主要是计算该些经筛选区块对中,内部区块的R/G比例以及外部区块的R’/G’比例,若是外块的红色增益(R Gain)较大,则视为外部区块需要较多的R值。In more detail, the shadow compensation value is calculated mainly by calculating the R/G ratio of the inner block and the R’/G’ ratio of the outer block among the filtered block pairs. If the red gain (R Gain) of the outer block is larger, it is considered that the outer block requires a larger R value.
举例而言,若R’/G’除以R/G的值(亦即,内部区块的R Gain与外部区块的R Gain比值)大于1,则代表外部区块的红色坐标值R不足,因此将提高R通道的阴影补偿,直到此比值介于0.99至1.01之间。For example, if the value of R'/G' divided by R/G (i.e., the ratio of the R Gain of the inner block to the R Gain of the outer block) is greater than 1, it means that the red coordinate value R of the outer block is insufficient, so the shadow compensation of the R channel will be increased until this ratio Between 0.99 and 1.01.
需要说明的是,取得最后用来参照的区块对时,理想情况下应能够维持足量的区块对,然而,在实际应用中,有时取得的区块对有可能数量过少。It should be noted that when obtaining the last block pair used for reference, ideally a sufficient number of block pairs should be maintained. However, in practical applications, sometimes the number of obtained block pairs may be too small.
因此,为了避免取得的区块对的数量过少,反而造成补偿错误的情形,可藉由另一阈值(百分比),来决定权重大小,并且设立缓冲区尝试执行阴影补偿,在超过一定次数仍然没有搜寻到更多区块对时,则停止阴影补偿,并以此为最终结果。Therefore, in order to avoid the situation where the number of block pairs obtained is too small, which would cause compensation errors, another threshold (percentage) can be used to determine the weight, and a buffer can be set up to try to perform shadow compensation. When more block pairs are not found after a certain number of times, shadow compensation is stopped and this is used as the final result.
在最后算出的阴影比值时依照公式分别针对R通道及B通道采用下式:When calculating the shadow ratio at the end, use the following formula for the R channel and the B channel respectively:
R通道:(内部红色增益/外部红色增益-1)*相应权重;R channel: (internal red gain/external red gain-1)*corresponding weight;
B通道:(内部蓝色增益/外部蓝色增益-1)*相应权重;B channel: (internal blue gain/external blue gain-1)*corresponding weight;
上述二式中的相应权重则由最终取出的区块对决定。The corresponding weights in the above two formulas are determined by the block pair finally taken out.
举例而言,n为取得的区块对数量,N为区块对的总数,若n小于或等于N*1/4,则相应权重为1,否则相应权重为4*n/N。上述仅为举例,本发明不限于此条件。For example, n is the number of block pairs obtained, N is the total number of block pairs, if n is less than or equal to N*1/4, the corresponding weight is 1, otherwise the corresponding weight is 4*n/N. The above is only an example, and the present invention is not limited to this condition.
进入步骤S212:以阴影补偿值调整当前画面以产生经调整画面。Enter step S212: adjust the current frame with the shading compensation value to generate an adjusted frame.
举例而言,当决定阴影补偿值之后,可依据预定修正倍率来对当前画面进行调整,例如,画面中心与边缘的调整值可因乘上预定修正倍率而有所不同。而预定修正倍率可例如由下式(9)所示,x代表画面的横向坐标,y代表对应x坐标的修正倍率:For example, after determining the shadow compensation value, the current image can be adjusted according to a predetermined correction factor. For example, the adjustment values of the center and edge of the image can be different due to multiplication by the predetermined correction factor. The predetermined correction factor can be, for example, as shown in the following formula (9), where x represents the horizontal coordinate of the image, and y represents the correction factor corresponding to the x coordinate:
此外,需要说明的是,由于在上述流程中,所使用的亮度、饱和度、锐利度及色相统计数据均可由现有的影像捕获装置固有的硬件统计数据取得,因此,本发明所提供的自适应的图像阴影校正方法及图像阴影校正系统可不需消耗额外的计算量,亦无需专用的硬件支持。In addition, it should be noted that since the brightness, saturation, sharpness and hue statistics used in the above process can be obtained from the inherent hardware statistics of the existing image capture device, the adaptive image shading correction method and image shading correction system provided by the present invention do not require additional computing power and do not require dedicated hardware support.
[实施例的有益效果][Beneficial Effects of Embodiments]
本发明的其中一个有益效果在于,本发明所提供的自适应的图像阴影校正方法及图像阴影校正系统,可以在不同模块之间取得更好的平衡,同时也可以避免掉“同色异谱”所带来的阴影补偿误差。在不消耗额外的计算量以及硬件支持下,由既有自动白平衡以及自动曝光的统计量来做到阴影补偿。One of the beneficial effects of the present invention is that the adaptive image shading correction method and image shading correction system provided by the present invention can achieve a better balance between different modules, and can also avoid the shading compensation error caused by "metamerism". Without consuming additional calculation amount and hardware support, the shading compensation is achieved by the statistics of the existing automatic white balance and automatic exposure.
此外,本发明所提供的自适应的图像阴影校正方法及图像阴影校正系统,可以通过将选定的配对区块经过滤除以及计算相似性,得到最适合用来做阴影补偿运算的配对结果,并且,在所有经过筛选后的配对块中,各别实施移动平均来达成乖离极值剔除,可避免单一配对块造成的偏移量过大,同时保证本发明的图像阴影校正方法及图像阴影校正系统的稳定度。In addition, the adaptive image shading correction method and image shading correction system provided by the present invention can obtain the pairing result most suitable for shadow compensation operation by filtering out the selected pairing blocks and calculating the similarity, and in all the screened pairing blocks, moving average is implemented separately to achieve deviation extreme value elimination, which can avoid excessive offset caused by a single pairing block, while ensuring the stability of the image shading correction method and image shading correction system of the present invention.
以上所公开的内容仅为本发明的优选可行实施例,并非因此局限本发明的申请专利范围,所以凡是运用本发明说明书及图式内容所做的等效技术变化,均包含于本发明的申请专利范围内。The contents disclosed above are only preferred feasible embodiments of the present invention, and are not intended to limit the scope of the present invention. Therefore, all equivalent technical changes made using the contents of the present invention's specification and drawings are included in the scope of the present invention.
符号说明Explanation of symbols
1:图像阴影校正系统1: Image shading correction system
12:影像处理电路12: Image processing circuit
120:处理单元120: Processing unit
122:存储器122: Memory
10:影像捕获装置10: Image capture device
BLK:区块BLK:Block
FM:当前画面FM: Current screen
OA:外部区域OA: External Area
IA:内部区域IA: Internal Area
OB:外部区块OB: External Block
IB:内部区块IB: Internal Block
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110889947.2A CN115914864A (en) | 2021-08-04 | 2021-08-04 | Adaptive image shading correction method and image shading correction system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110889947.2A CN115914864A (en) | 2021-08-04 | 2021-08-04 | Adaptive image shading correction method and image shading correction system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115914864A true CN115914864A (en) | 2023-04-04 |
Family
ID=86486821
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110889947.2A Pending CN115914864A (en) | 2021-08-04 | 2021-08-04 | Adaptive image shading correction method and image shading correction system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115914864A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117745621A (en) * | 2023-12-18 | 2024-03-22 | 优视科技(中国)有限公司 | Training sample generation method and electronic equipment |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008153834A (en) * | 2006-12-15 | 2008-07-03 | Konica Minolta Opto Inc | Image processing apparatus |
CN101930461A (en) * | 2010-08-20 | 2010-12-29 | 郑茂 | Digital image visualized management and retrieval for communication network |
CN108234824A (en) * | 2018-03-26 | 2018-06-29 | 上海小蚁科技有限公司 | Shadow correction detection parameters determine, correct detection method and device, storage medium, fisheye camera |
-
2021
- 2021-08-04 CN CN202110889947.2A patent/CN115914864A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008153834A (en) * | 2006-12-15 | 2008-07-03 | Konica Minolta Opto Inc | Image processing apparatus |
CN101930461A (en) * | 2010-08-20 | 2010-12-29 | 郑茂 | Digital image visualized management and retrieval for communication network |
CN108234824A (en) * | 2018-03-26 | 2018-06-29 | 上海小蚁科技有限公司 | Shadow correction detection parameters determine, correct detection method and device, storage medium, fisheye camera |
CN111757029A (en) * | 2018-03-26 | 2020-10-09 | 上海小蚁科技有限公司 | Shadow correction detection parameter determination, correction detection method and device, storage medium, fisheye camera |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117745621A (en) * | 2023-12-18 | 2024-03-22 | 优视科技(中国)有限公司 | Training sample generation method and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111028189B (en) | Image processing method, device, storage medium and electronic equipment | |
CN107451969B (en) | Image processing method, image processing device, mobile terminal and computer readable storage medium | |
KR100983037B1 (en) | How to adjust the white balance automatically | |
US10038862B2 (en) | Methods and apparatus for automated noise and texture optimization of digital image sensors | |
CN109829859B (en) | Image processing method and terminal equipment | |
CN107392858B (en) | Image highlight area processing method, device and terminal device | |
CN108024057B (en) | Background blurring processing method, device and equipment | |
RU2496250C1 (en) | Image processing apparatus and method | |
JP6563751B2 (en) | Image processing apparatus and image processing method | |
CN108156369B (en) | Image processing method and device | |
CN107194901B (en) | Image processing method, image processing device, computer equipment and computer readable storage medium | |
CN107341782B (en) | Image processing method, image processing device, computer equipment and computer readable storage medium | |
CN107396079A (en) | Method and device for adjusting white balance | |
CN107872663A (en) | Image processing method and device, computer readable storage medium and computer equipment | |
TWI394443B (en) | Image brightness correction method | |
CN107465903A (en) | Image white balance method, device and computer-readable storage medium | |
CN110192388A (en) | Image processing device, digital camera, image processing program, and recording medium | |
CN108063934B (en) | Image processing method and device, computer readable storage medium and computer device | |
CN107454318B (en) | Image processing method, image processing device, mobile terminal and computer readable storage medium | |
CN107580205A (en) | Method and device for adjusting white balance | |
CN115914864A (en) | Adaptive image shading correction method and image shading correction system | |
CN110782400A (en) | A kind of self-adaptive illumination uniform realization method and device | |
CN102804227B (en) | Use the lenses attenuate correct operation of the value corrected based on monochrome information | |
CN107392870B (en) | Image processing method, image processing device, mobile terminal and computer readable storage medium | |
JP2013114692A (en) | Video processor and video processing method for automatic video correction |
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 |