CN105513025A - Improved rapid demisting method - Google Patents
Improved rapid demisting method Download PDFInfo
- Publication number
- CN105513025A CN105513025A CN201510923653.1A CN201510923653A CN105513025A CN 105513025 A CN105513025 A CN 105513025A CN 201510923653 A CN201510923653 A CN 201510923653A CN 105513025 A CN105513025 A CN 105513025A
- Authority
- CN
- China
- Prior art keywords
- image
- yuv
- sampling
- format
- transmissivity
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 42
- 238000001914 filtration Methods 0.000 claims abstract description 20
- 238000005070 sampling Methods 0.000 claims abstract description 14
- 230000008569 process Effects 0.000 claims description 13
- 230000000903 blocking effect Effects 0.000 claims description 5
- 230000008859 change Effects 0.000 claims description 3
- 239000003595 mist Substances 0.000 claims 2
- 230000008030 elimination Effects 0.000 claims 1
- 238000003379 elimination reaction Methods 0.000 claims 1
- 238000002834 transmittance Methods 0.000 abstract description 35
- 230000000694 effects Effects 0.000 abstract description 27
- 238000012545 processing Methods 0.000 abstract description 25
- 238000004422 calculation algorithm Methods 0.000 description 14
- 238000006243 chemical reaction Methods 0.000 description 6
- 238000004364 calculation method Methods 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 2
- 125000001475 halogen functional group Chemical group 0.000 description 2
- 239000002245 particle Substances 0.000 description 2
- 230000015556 catabolic process Effects 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000006731 degradation reaction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000003912 environmental pollution Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 238000010191 image analysis Methods 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000035772 mutation Effects 0.000 description 1
- 230000008092 positive effect Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
-
- 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/10—Image acquisition modality
- G06T2207/10016—Video; Image sequence
-
- 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/10—Image acquisition modality
- G06T2207/10024—Color image
-
- 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/20172—Image enhancement details
- G06T2207/20182—Noise reduction or smoothing in the temporal domain; Spatio-temporal filtering
-
- 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/30—Subject of image; Context of image processing
- G06T2207/30236—Traffic on road, railway or crossing
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
Abstract
本发明公开了一种改进的快速去雾方法,分为三个部分:第一部分是对YUV数据进行均值降采样处理,并且转换成RGB格式的小图;第二部分是为了解决降采样带来突变边缘变黑的问题,对小图透射率进行最大值滤波;第三部分是针对降采样带来的块效应,采用双线性插值升采样避免块效应。本发明提出的方法针对500W像素YUV格式的视频,能够在PC机上达到实时处理。本发明针对降采样和升采样带来的黑边副作用,提出了一种有效的改善方法,可以有效避免这种副作用。本发明针对降采样产生的块效应,提出双线性插值升采样进行块效应的去除。
The invention discloses an improved fast defogging method, which is divided into three parts: the first part is to carry out mean value down-sampling processing on YUV data, and convert it into a small image in RGB format; the second part is to solve the problem caused by down-sampling For the problem of sudden blackening of the edge, the maximum value filtering is performed on the transmittance of the small image; the third part is aimed at the block effect caused by downsampling, and bilinear interpolation upsampling is used to avoid block effect. The method proposed by the invention can achieve real-time processing on the PC for the video in YUV format with 500W pixels. The present invention proposes an effective improvement method for the side effects of black borders caused by down-sampling and up-sampling, which can effectively avoid such side effects. The invention proposes bilinear interpolation and up-sampling to remove the block effect caused by down-sampling.
Description
技术领域technical field
本发明涉及数字图像处理、智能交通的技术领域,具体涉及一种改进的快速去雾方法。The invention relates to the technical fields of digital image processing and intelligent transportation, in particular to an improved fast defogging method.
背景技术Background technique
近几年,环境污染情况很严重,尤其雾霾的天气越来越多。雾、霾是一种悬浮在空气中的颗粒,它的散射作用大大降低了图像质量。图像质量的降低直接影响测速仪、行车记录仪等户外图像采集系统的功能。不仅降低图像的可视性,更对后续图像处理算法(如车牌识别、特征提取、图像分析等)的进行造成困难。图像采集装置如今以高清摄像头居多,采集的图像清晰,但是图像的数据量也较大,处理起来耗时较长。因此发明一种能够快速去雾的方法显得很重要。In recent years, environmental pollution has been very serious, especially more and more smoggy weather. Fog and haze are particles suspended in the air, whose scattering effect greatly reduces the image quality. The reduction of image quality directly affects the functions of outdoor image acquisition systems such as speedometers and driving recorders. It not only reduces the visibility of the image, but also causes difficulties in the subsequent image processing algorithms (such as license plate recognition, feature extraction, image analysis, etc.). Nowadays, most of the image acquisition devices are high-definition cameras, and the collected images are clear, but the data volume of the images is also large, and it takes a long time to process them. Therefore it is very important to invent a method that can quickly remove the fog.
但是现有的去雾算法性能和功能是一对矛盾体,效果好的算法复杂度高,很难达到实时性;速度快的算法较简单,但是处理结果不理想,往往会引起色彩的失真等副作用。因此需要对性能和功能两方面进行一个权衡,提出一种方法,在性能和功能上都有不错的表现。However, the performance and function of the existing dehazing algorithm are a pair of contradictions. The algorithm with good effect has high complexity and is difficult to achieve real-time performance; the algorithm with fast speed is relatively simple, but the processing result is not ideal, which often causes color distortion, etc. side effect. Therefore, it is necessary to make a trade-off between performance and function, and propose a method that has good performance in terms of performance and function.
现有的图像去雾处理方法有很多,总体上可以分为两大类:基于图像增强的方法和基于物理模型的方法。图像增强的方法是对被降质的图像进行增强,改善图像的质量。该方法较简单,处理速度较快,但是处理效果不理想,可能会造成图像部分信息的损失,以致图像失真。基于物理模型的方法,这种方法通过研究大气悬浮颗粒对光的散射作用,建立大气散射模型,了解图像退化的物理机理,并反演复原出无雾图像,现如今很多去雾算法都是基于物理模型提出的。现有技术一(HeK,SunJ,TangX.Singleimagehazeremovalusingdarkchannelprior.IEEETransactionsonPatternAnalysisandMachineIntelligence,2011,33(12):2341-2353)通过对大量无雾图像统计特征观察,发现了被命名为暗原色先验的先验规律。该方法在处理效果上有非常好的表现,开辟了图像去雾的一个新领域。但是文中采用软抠图来细化透射率图,复杂度非常高,耗时长,后来文章作者又使用导向滤波代替软抠图的方式,去雾效果相当,处理速度却提高100倍左右。但是即使使用导向滤波针对高清视频进行去雾,想要实现实时处理,还有很大的差距。现有技术二(TarelJP,HautiereN.Fastvisibilityrestorationfromasinglecolororgraylevelimage.In:Proceedingsofthe12thIEEEInternationalConferenceonComputerVision,2009.Kyoto:IEEE,2009.2201-2208)中,提出了一种快速去雾的方法,使用双中值滤波代替现有技术一中的最小值滤波和导向滤波,大大简化了处理过程,提高效率。但是中值滤波并不是好的边缘保持滤波算法,局部区域景深突变会产生光晕效应。并且算法中的参数较多,无法实现自适应调整,需要人工进行测试调整,在实际应用中受到了限制。There are many existing image defogging methods, which can be generally divided into two categories: methods based on image enhancement and methods based on physical models. The method of image enhancement is to enhance the degraded image to improve the quality of the image. This method is relatively simple and the processing speed is fast, but the processing effect is not ideal, which may cause the loss of part of the image information, resulting in image distortion. Based on the physical model method, this method establishes an atmospheric scattering model by studying the scattering effect of atmospheric suspended particles on light, understands the physical mechanism of image degradation, and inverts and restores a fog-free image. Nowadays, many dehazing algorithms are based on physical model proposed. Prior Art 1 (HeK, SunJ, TangX. Singleimagehazeremovingdarkchannelprior.IEEETransactionsonPatternAnalysisandMachineIntelligence, 2011, 33(12): 2341-2353) found a priori law named dark channel priori by observing the statistical characteristics of a large number of haze-free images. This method has a very good performance in the processing effect and opens up a new field of image dehazing. However, soft matting is used to refine the transmittance map in this paper, which is very complex and time-consuming. Later, the author of the article uses guided filtering instead of soft matting. The dehazing effect is equivalent, but the processing speed is increased by about 100 times. But even if guided filtering is used to dehaze high-definition video, there is still a big gap in real-time processing. In prior art 2 (TarelJP, HautiereN.Fastvisibilityrestorationfromasinglecolororgraylevelimage.In:Proceedingofthe12thIEEEInternationalConferenceonComputerVision, 2009.Kyoto:IEEE, 2009.2201-2208), a method for fast dehazing is proposed, using double-median filtering instead of the minimum Value filtering and guided filtering greatly simplify the processing process and improve efficiency. However, the median filter is not a good edge-preserving filter algorithm, and a sudden change in the depth of field in a local area will produce a halo effect. Moreover, there are many parameters in the algorithm, which cannot realize self-adaptive adjustment, and requires manual testing and adjustment, which is limited in practical application.
国内也有很多研究机构或者高校在去雾方面有不错的成果。现有技术三(基于DSP的雾天视频处理系统及方法CN103347171A)设计了一套针对雾天视频的处理系统,包含硬件和软件的设计,程序优化中针对有些变化缓慢的参数采用隔时更新的方法减少处理时间。但是作者最后只说到针对432*283的图像进行仿真处理耗时3.622s,并没有明确表示在DSP平台上针对高清视频能否达到实时性。现有技术四(CN104240192A,发明名称:一种快速的单幅图像去雾算法)中通过图像色彩空间的RGB三通道中的最小值、图像梯度和暗通道图以特定的条件快速合成出去雾模型所需要的透射图,代替了原来暗原色验去雾算法中软抠图法求解透射图的步骤,并优化了暗通道的计算。这种方法将原来的大规模稀疏矩阵的运算变为了对几幅不同信息图像对应像素点的比较,运算量大大减小,且在大多数情况下能得到与原算法效果同等理想的结果。There are also many research institutions or universities in China that have achieved good results in fog removal. Prior art three (DSP-based fog video processing system and method CN103347171A) designed a set of processing system for fog video, including the design of hardware and software, in the program optimization, some parameters that change slowly are updated every other time. method to reduce processing time. However, the author finally only said that the simulation processing for 432*283 images takes 3.622s, and did not clearly indicate whether the high-definition video can achieve real-time performance on the DSP platform. In prior art 4 (CN104240192A, title of invention: a fast single image dehazing algorithm), the dehazing model is quickly synthesized under specific conditions by using the minimum value, image gradient and dark channel map in the RGB three channels of the image color space The required transmission map replaces the step of solving the transmission map by the soft matting method in the original dark channel dehazing algorithm, and optimizes the calculation of the dark channel. This method changes the operation of the original large-scale sparse matrix into the comparison of the corresponding pixels of several different information images, the amount of calculation is greatly reduced, and in most cases, the same ideal results as the original algorithm can be obtained.
发明内容Contents of the invention
本发明的目的为:1)针对500W像素YUV格式的交通视频,本发明提出的方法能够在PC机上达到实时处理;2)针对降采样和升采样带来的黑边问题,本发明提出的方法可以很好的避免该副作用。3)针对降采样带来的块效应,本发明使用双线性插值升采样,可以避免块效应。The purpose of the present invention is: 1) for the traffic video of 500W pixel YUV format, the method that the present invention proposes can reach real-time processing on PC; This side effect can be well avoided. 3) For the blocking effect caused by downsampling, the present invention uses bilinear interpolation to upsampling, which can avoid blocking effect.
本发明采用的技术方案为:一种改进的快速去雾方法,该方法步骤如下:The technical scheme adopted in the present invention is: an improved quick defogging method, the steps of which are as follows:
步骤1)、输入一帧YUV格式的图像;Step 1), input the image of a frame YUV format;
步骤2)、YUV数据均值降采样,并转化为RGB格式;Step 2), YUV data mean value downsampling, and convert to RGB format;
对YUV数据进行均值降采样的处理,得到降采样之后的YUV格式的图像,并且把YUV格式的图像转换成RGB格式的图像;Perform mean downsampling processing on the YUV data to obtain an image in YUV format after downsampling, and convert the image in YUV format into an image in RGB format;
步骤3)、基于暗原色先验原理求取小图透射率;Step 3), calculate the transmittance of the small image based on the dark channel prior principle;
针对步骤2)中的RGB小图,通过最小值滤波求取暗通道,估算大气光值,计算预估的透射率,最后对预估透射率进行导向滤波,求得精细化的透射率;For the small RGB image in step 2), obtain the dark channel through minimum value filtering, estimate the atmospheric light value, calculate the estimated transmittance, and finally perform guided filtering on the estimated transmittance to obtain a refined transmittance;
步骤4)、最大值滤波;Step 4), maximum value filtering;
对小图透射率进行半径为1的最大值滤波处理之后再进行双线性插值的升采样,以避免黑边的现象;Perform bilinear interpolation up-sampling after the maximum value filtering process with a radius of 1 on the transmittance of the small image to avoid the phenomenon of black edges;
步骤5)、双线性插值升采样;Step 5), bilinear interpolation upsampling;
采用双线性插值升采样,在几个点之间进行线性的插值,使得升采样之后的图像变化平缓,块效应可以被消除;Using bilinear interpolation upsampling, linear interpolation is performed between several points, so that the image after upsampling changes smoothly and the block effect can be eliminated;
步骤6)直接恢复成无雾的YUV图像;Step 6) directly restores to a haze-free YUV image;
利用步骤5)插值之后的透射率大图,进行去雾图像的重构,直接采用YUV格式进行重构,省略了中间YUV和RGB转换的时间和空间;Use the large transmittance image after interpolation in step 5) to reconstruct the defogged image, and directly use the YUV format for reconstruction, omitting the time and space of intermediate YUV and RGB conversion;
步骤7)输入下一帧YUV图像。Step 7) Input the next frame of YUV image.
本发明技术方案的优点和积极效果为:The advantages and positive effects of the technical solution of the present invention are:
1)YUV均值降采样,并转化为RGB格式;1) YUV mean downsampling and conversion to RGB format;
对YUV数据进行均值降采样的处理,均值降采样可以一定程度保证原图像的信息,得到降采样之后的YUV格式的图像,并且把YUV格式的图像转换成RGB格式的图像。这样可以大大降低计算所带来的耗时以及节省一部分存储空间。The mean value downsampling process is performed on the YUV data. The mean value downsampling can guarantee the information of the original image to a certain extent, obtain the image in YUV format after downsampling, and convert the image in YUV format into an image in RGB format. This can greatly reduce the time consumption caused by calculation and save a part of storage space.
2)突变边缘黑边问题的解决;2) Solve the problem of black borders on sudden changes;
使用降采样和升采样会带来一定的副作用,尤其是针对大片天空区域中有颜色较暗的广告牌或者车辆,这样就会使得处理之后广告牌或者车身与天空交界的地方出现去雾过度的情况,也就是黑边的出现。本发明对算法中的透射率进行半径为1的最大值滤波处理可以有效的避免这种黑边的现象。The use of downsampling and upsampling will bring certain side effects, especially for billboards or vehicles with darker colors in large sky areas, which will cause excessive defogging at the junction of billboards or car bodies with the sky after processing situation, that is, the appearance of black borders. In the present invention, the maximum value filtering process with a radius of 1 is performed on the transmittance in the algorithm, which can effectively avoid the black edge phenomenon.
3)避免降采样的块效应;3) Avoid the block effect of downsampling;
本发明中,针对透射率小图进行双线性插值升采样处理,利用得到的透射率大图进行图像的重构,最终可以得到较好的去雾效果,并且没有块效应这种副作用。In the present invention, bilinear interpolation up-sampling is performed on the small transmittance image, and the obtained large transmittance image is used to reconstruct the image, so that a good defogging effect can be obtained finally, and there is no such side effect as block effect.
附图说明Description of drawings
图1为双线性插值升采样示意图;Fig. 1 is a schematic diagram of bilinear interpolation upsampling;
图2为改进方法的流程图;Fig. 2 is the flowchart of improved method;
图3为去雾结果。Figure 3 shows the results of dehazing.
具体实施方式detailed description
下面结合附图以及具体实施例进一步说明本发明。The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
本发明的技术方案分为三个部分:第一部分是对YUV数据进行均值降采样处理,并且转换成RGB格式的小图;第二部分是为了解决降采样带来突变边缘变黑的问题,对小图透射率进行最大值滤波;第三部分是针对降采样带来的块效应,采用双线性插值升采样避免块效应。The technical solution of the present invention is divided into three parts: the first part is to carry out the average value down-sampling process to the YUV data, and convert it into a small image in RGB format; The transmittance of the small image is filtered by the maximum value; the third part is to avoid the blocking effect caused by downsampling by using bilinear interpolation and upsampling.
1)YUV均值降采样,并转化为RGB格式1) YUV mean downsampling and converting to RGB format
对YUV数据进行均值降采样的处理,得到降采样之后的YUV格式的图像,并且把YUV格式的图像转换成RGB格式的图像。The average downsampling process is performed on the YUV data to obtain an image in the YUV format after downsampling, and the image in the YUV format is converted into an image in RGB format.
2)突变边缘黑边问题的解决2) Solve the problem of black borders on sudden changes
为了加快处理速度,使用了均值降采样和双线性插值升采样,但是会带来一定的副作用,尤其是突变边缘会出现去雾过度的情况,也就是黑边的出现。In order to speed up the processing speed, mean value downsampling and bilinear interpolation upsampling are used, but it will bring certain side effects, especially the edge of the mutation will have excessive defogging, that is, the appearance of black edges.
本发明中针对这种情况,对算法中的透射率进行半径为1的最大值滤波处理之后再进行双线性插值的升采样,可以有效的避免这种黑边的现象。In view of this situation, the present invention performs bilinear interpolation up-sampling after performing the maximum value filtering process with a radius of 1 on the transmittance in the algorithm, which can effectively avoid the black edge phenomenon.
3)双线性插值升采样3) Bilinear interpolation upsampling
升采样分为临近值升采样和双线性插值升采样已经双三次插值升采样。临近值升采样是在一个块内以距离最近的那个像素点值作为该块内所有点的取值。双三次插值升采样效果最好,但是算法复杂度较高,在本发明中不适合使用。本发明中采用双线性插值升采样,是在几个点之间进行线性的插值,这样做使得升采样之后的图像变化平缓,块效应可以被消除。双线性插值的原理如图1所示:Upsampling is divided into proximity upsampling, bilinear interpolation upsampling and bicubic interpolation upsampling. Proximity upsampling is to use the closest pixel value in a block as the value of all points in the block. Bicubic interpolation and upsampling have the best effect, but the complexity of the algorithm is relatively high, so it is not suitable for use in the present invention. In the present invention, bilinear interpolation is used for upsampling, which is to perform linear interpolation between several points, so that the image after upsampling changes smoothly, and the blocking effect can be eliminated. The principle of bilinear interpolation is shown in Figure 1:
图1中1、2、3、4分别表示小图的像素值,其他空白部分就是上采样待插值的像素值。任取第一块中的一点,求取该点的值,该点的值是最靠近其四点像素值(对应图中的1、2、3、4点像素值)的一个加权平均。加权系数跟距离有关系,距离越近,加权系数越大,越远加权系数越小。计算公式如下:In Figure 1, 1, 2, 3, and 4 represent the pixel values of the small image respectively, and the other blank parts are the pixel values to be up-sampled and to be interpolated. Take any point in the first block, and calculate the value of this point. The value of this point is a weighted average of the pixel values of the four points closest to it (corresponding to the pixel values of points 1, 2, 3, and 4 in the figure). The weighting coefficient is related to the distance, the closer the distance is, the larger the weighting coefficient is, and the farther the weighting coefficient is, the smaller it is. Calculated as follows:
dest=a*value1+b*value2+c*value3+d*value4dest=a*value1+b*value2+c*value3+d*value4
其中dest表示待插的像素值,valua1、valua2、valua3、valua4分别表示四个临近点的值,a、b、c、d表示加权系数,它们可按照如下公式求取:Among them, dest represents the pixel value to be interpolated, valua1, valua2, valua3, and valua4 represent the values of four adjacent points respectively, and a, b, c, and d represent weighting coefficients, which can be calculated according to the following formula:
上式中ratio表示上采样的倍率,上式分子中的(r,c)表示待求取像素点在ratio*ratio块中的坐标。In the above formula, ratio represents the magnification of upsampling, and (r, c) in the above formula numerator represents the coordinates of the pixel to be obtained in the ratio*ratio block.
如图2所示,本发明实施方式举例如下:As shown in Figure 2, the embodiment of the present invention is exemplified as follows:
1、YUV均值降采样成RGB小图1. YUV average downsampling into RGB small image
本发明针对高清的交通视频,比如500W大小的视频,每帧图像大小为2432*2048。首先针对YUV数据进行均值降采样,在此以n倍降采样为例,分别针对Y分量和UV分量进行求均值的处理。求n*n窗口中的均值不用保存起来,直接根据YUV和RGB之间的转换关系转换成RGB的图像,转换公式如下所示:The present invention is aimed at high-definition traffic video, such as a video with a size of 500W, and the image size of each frame is 2432*2048. Firstly, mean downsampling is performed on the YUV data. Here, taking n times downsampling as an example, the mean value processing is performed on the Y component and the UV component respectively. Find the mean value in the n*n window without saving it, and directly convert it into an RGB image according to the conversion relationship between YUV and RGB. The conversion formula is as follows:
R=Y+1.371*(V-128)R=Y+1.371*(V-128)
G=Y-0.698*(V-128)-0.336*(U-128)G=Y-0.698*(V-128)-0.336*(U-128)
B=Y+1.732*(U-128)B=Y+1.732*(U-128)
其中Y、U、V分别表示YUV三个分量的值,R、G、B表示转换之后RGB三个通道的值。Among them, Y, U, and V represent the values of the three components of YUV, respectively, and R, G, and B represent the values of the three channels of RGB after conversion.
2、基于暗原色先验的方法求得透射率2. Obtain the transmittance based on the method of dark channel prior
本发明是基于有雾图像的物理模型,有雾图像的物理模型可以表示成:The present invention is based on the physical model of the foggy image, and the physical model of the foggy image can be expressed as:
I(x)=J(x)t(x)+A(1-t(x))I(x)=J(x)t(x)+A(1-t(x))
其中,I(x)就是已有的图像(待去雾的图像),J(x)是要恢复的无雾的图像,A是全球大气光成分,t(x)为透射率。Among them, I(x) is the existing image (the image to be dehazed), J(x) is the haze-free image to be restored, A is the global atmospheric light component, and t(x) is the transmittance.
2.1、获取暗通道2.1. Obtain dark channel
在绝大多数非天空的局部区域里,某一些像素总会有至少一个颜色通道具有很低的值。换言之,该区域光强度的最小值是个很小的数。首先求出每个像素RGB分量中的最小值,暗通道的求取公式如下:In most non-sky local regions, some pixels will always have at least one color channel with a very low value. In other words, the minimum value of light intensity in this area is a very small number. First find the minimum value in the RGB component of each pixel. The formula for finding the dark channel is as follows:
式中Jc表示彩色图像的每个通道像素值,Ω(x)表示以像素x为中心的一个窗口。暗原色先验的理论指出:Jdark(x)→0。where J c represents the pixel value of each channel of the color image, and Ω(x) represents a window centered on pixel x. The theory of the dark channel prior states: J dark (x)→0.
2.2、求取大气光值2.2. Calculate the atmospheric light value
根据有雾图像的物理模型可知,要想恢复出无雾图像,前提是知道大气光值A。本发明中求取A值的方法是:从暗通道图中按照亮度的大小取前0.01%的像素;在这些位置中,从原始有雾图像I中寻找对应的点并求均值,作为A值。According to the physical model of the foggy image, in order to restore the fog-free image, the premise is to know the atmospheric light value A. The method for obtaining the A value in the present invention is: get the first 0.01% of the pixels according to the size of the brightness from the dark channel image; in these positions, find the corresponding point from the original foggy image I and calculate the mean value, as the A value .
2.3、计算预估的透射率2.3. Calculate the estimated transmittance
由有雾图像的变形,并且结合暗原色先验的理论,可以推导出透射率的表达式,如下所示:From the deformation of the foggy image, combined with the theory of the dark channel prior, the transmittance can be derived expression, as follows:
其中是透射率,Ic表示三通道的值,Ac表示大气光值;in is the transmittance, I c represents the value of the three channels, and A c represents the atmospheric light value;
2.4、导向滤波2.4. Guided filtering
对上述预估的透射率进行导向滤波处理,作为输入图,灰度图作为导向图,处理之后得到精细化的透射率小图。Guided filtering is performed on the above estimated transmittance, As the input image, the grayscale image is used as the guide image, and the refined transmittance small image is obtained after processing.
3、针对透射率小图进行最大值滤波3. Perform maximum value filtering for the small transmittance map
基于暗原色先验的去雾算法有这样的规则:偏白的区域需要去雾的程度高,相应的透射率就会比较小;较暗的区域(如车身或者广告牌)需要去雾的程度低,所以对应的透射率比较高。如果在大片天空区域中存在较暗的广告牌或者车身,那么就会出现广告牌或者车身与天空区域交界的边缘变黑的副作用。设天空区域透射率t1=0.5,广告牌区域透射率t2=0.9,那么在t1和t2之间会插上0.5~0.9之间的数。由于图像重构的公式为:J=(I-A)/t+A,车身或广告牌像素值I本来就比较小,A是大气光值(较大,一般在200以上),如果t稍微小一点的话,就会使得J的值小于零,所以会出现变黑的情况。The defogging algorithm based on the dark channel prior has such rules: the whiter area needs a higher degree of defogging, and the corresponding transmittance will be relatively small; the darker area (such as the car body or billboard) needs a higher degree of defogging Low, so the corresponding transmittance is relatively high. If there is a darker billboard or car body in a large sky area, then there will be a side effect of blackening the edge of the billboard or car body and the sky area. Assuming that the sky area transmittance t1=0.5 and the billboard area transmittance t2=0.9, then a number between 0.5 and 0.9 will be inserted between t1 and t2. Since the image reconstruction formula is: J=(I-A)/t+A, the pixel value I of the vehicle body or billboard is relatively small, and A is the atmospheric light value (larger, generally above 200), if t is slightly smaller If , it will make the value of J less than zero, so it will turn black.
为了解决这个问题,本发明中对小图透射率进行半径为1的最大值滤波处理,这样可以避免黑边的出现,当然这样会带来轻微的光晕效应,但是这种影响和黑边问题比起来微不足道。In order to solve this problem, in the present invention, the maximum value filtering process with a radius of 1 is performed on the transmittance of the small image, which can avoid the appearance of black borders. Of course, this will bring a slight halo effect, but this effect has nothing to do with the problem of black borders Insignificant in comparison.
4、双线性插值升采样4. Bilinear interpolation upsampling
针对步骤3得到的透射率小图,进行双线性插值升采样的处理。在本例中,进行16倍双线性插值升采样,也就是说在小图透射率两个点之间插入15个点,使得经过插值的透射率图像和原图的长宽相等。但是在插值的时候需要注意边缘的处理,防止出现升采样之后的透射率和原图不能一一对应,处理结果会出现一些边缘效应。For the small transmittance map obtained in step 3, perform bilinear interpolation and upsampling. In this example, 16 times bilinear interpolation upsampling is performed, that is to say, 15 points are inserted between two points of the transmittance of the small image, so that the length and width of the interpolated transmittance image are equal to those of the original image. However, it is necessary to pay attention to the edge processing during interpolation to prevent the transmittance after upsampling from being not in one-to-one correspondence with the original image, and some edge effects will appear in the processing results.
5、无雾图像的重构5. Reconstruction of haze-free images
由步骤4得到的大图的透射率,接下来就可以进行无雾图像的重构。本发明中直接省略中间转换过程,直接对YUV格式有雾图像进行重构成YUV的无雾图像。先计算出From the transmittance of the large image obtained in step 4, the haze-free image can be reconstructed next. In the present invention, the intermediate conversion process is directly omitted, and the hazy image in the YUV format is directly reconstructed into a YUV haze-free image. calculate first
上式中Ab、Ag、Ar分别表示B、G、R三个通道的大气光值,Ay、Au、Av表示对应到Y、U、V之后的大气光值。In the above formula, A b , A g , and Ar represent the atmospheric light values of the three channels B, G, and R , respectively, and A y , A u , and A v represent the atmospheric light values corresponding to Y, U, and V.
由于一帧图像中的AbAgAr是相同的,上面的计算每帧只需要计算一次。然后重构无雾的YUV图像:Since A b A g A r in one frame of image is the same, the above calculation only needs to be calculated once per frame. Then reconstruct the haze-free YUV image:
上式中Y、U、V表示原图像的数据,t(x)表示透射率,Ay、Au、Av表示对应到Y、U、V之后的大气光值,Y'、U'、V'表示重构之后的图像数据。In the above formula, Y, U, V represent the data of the original image, t(x) represents the transmittance, A y , A u , A v represent the atmospheric light value corresponding to Y, U, V, Y', U', V' represents image data after reconstruction.
处理结果分析如下:The processing results are analyzed as follows:
本发明提出的方法在PC机上,针对2432x2048大小的YUV图像处理耗时在30ms左右,达到实时性的要求。并且有较好的处理效果,如图3所示,其中图3(a)是原图,图3(b)是针对小图透射率进行最大值滤波之前去雾之后的图像,所以在车身边缘出现黑边问题,如图3(b)中的圈中所示。图3(c)是针对小图透射率进行最大值滤波之后重构出来的无雾图像。明显看出针对小图透射率加上最大值滤波之后黑边的问题不会再出现,并且去雾能力不会受到影响。The method proposed by the present invention takes about 30ms to process a YUV image with a size of 2432x2048 on a PC, which meets the real-time requirement. And it has a better processing effect, as shown in Figure 3, where Figure 3(a) is the original image, and Figure 3(b) is the image after dehazing before performing the maximum value filter on the transmittance of the small image, so at the edge of the car body The black border problem occurs, as shown in the circle in Fig. 3(b). Figure 3(c) is the haze-free image reconstructed after maximum filtering for the small image transmittance. It is obvious that the problem of black borders will no longer appear after the maximum value filter is added to the transmittance of the small image, and the defogging ability will not be affected.
Claims (1)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510923653.1A CN105513025B (en) | 2015-12-10 | 2015-12-10 | A kind of improved rapid defogging method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510923653.1A CN105513025B (en) | 2015-12-10 | 2015-12-10 | A kind of improved rapid defogging method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105513025A true CN105513025A (en) | 2016-04-20 |
CN105513025B CN105513025B (en) | 2018-12-14 |
Family
ID=55720983
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510923653.1A Active CN105513025B (en) | 2015-12-10 | 2015-12-10 | A kind of improved rapid defogging method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105513025B (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106097259A (en) * | 2016-05-27 | 2016-11-09 | 安徽超远信息技术有限公司 | A kind of Misty Image fast reconstructing method based on absorbance optimisation technique |
CN106651822A (en) * | 2016-12-20 | 2017-05-10 | 宇龙计算机通信科技(深圳)有限公司 | Picture recovery method and apparatus |
CN106933579A (en) * | 2017-03-01 | 2017-07-07 | 西安电子科技大学 | Image rapid defogging method based on CPU+FPGA |
CN107610058A (en) * | 2017-08-28 | 2018-01-19 | 浙江工业大学 | High-definition picture defogging method based on down-sampling |
CN109961412A (en) * | 2019-03-18 | 2019-07-02 | 浙江大华技术股份有限公司 | A kind of video frame images defogging method and equipment |
CN110060210A (en) * | 2018-01-19 | 2019-07-26 | 腾讯科技(深圳)有限公司 | Image processing method and relevant apparatus |
CN111986109A (en) * | 2020-08-13 | 2020-11-24 | 湖北富瑞尔科技有限公司 | Remote sensing image defogging method based on full convolution network |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104506755A (en) * | 2015-01-13 | 2015-04-08 | 武汉烽火众智数字技术有限责任公司 | Method for real-time automatic defogging of high-definition videos based on FPGA |
CN105046666A (en) * | 2015-07-24 | 2015-11-11 | 中国科学技术大学 | Dark channel prior based traffic video real-time defogging method |
-
2015
- 2015-12-10 CN CN201510923653.1A patent/CN105513025B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104506755A (en) * | 2015-01-13 | 2015-04-08 | 武汉烽火众智数字技术有限责任公司 | Method for real-time automatic defogging of high-definition videos based on FPGA |
CN105046666A (en) * | 2015-07-24 | 2015-11-11 | 中国科学技术大学 | Dark channel prior based traffic video real-time defogging method |
Non-Patent Citations (2)
Title |
---|
朱学俊 等: "基于DSP的实时去雾优化与实现", 《应用案例》 * |
王昕 等: "基于YUV颜色空间的图像去雾算法", 《吉林大学学报(信息科学版)》 * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106097259A (en) * | 2016-05-27 | 2016-11-09 | 安徽超远信息技术有限公司 | A kind of Misty Image fast reconstructing method based on absorbance optimisation technique |
CN106097259B (en) * | 2016-05-27 | 2018-11-30 | 安徽超远信息技术有限公司 | A kind of Misty Image fast reconstructing method based on transmissivity optimisation technique |
CN106651822A (en) * | 2016-12-20 | 2017-05-10 | 宇龙计算机通信科技(深圳)有限公司 | Picture recovery method and apparatus |
CN106933579A (en) * | 2017-03-01 | 2017-07-07 | 西安电子科技大学 | Image rapid defogging method based on CPU+FPGA |
CN107610058A (en) * | 2017-08-28 | 2018-01-19 | 浙江工业大学 | High-definition picture defogging method based on down-sampling |
CN110060210A (en) * | 2018-01-19 | 2019-07-26 | 腾讯科技(深圳)有限公司 | Image processing method and relevant apparatus |
CN110060210B (en) * | 2018-01-19 | 2021-05-25 | 腾讯科技(深圳)有限公司 | Image processing method and related device |
CN109961412A (en) * | 2019-03-18 | 2019-07-02 | 浙江大华技术股份有限公司 | A kind of video frame images defogging method and equipment |
CN111986109A (en) * | 2020-08-13 | 2020-11-24 | 湖北富瑞尔科技有限公司 | Remote sensing image defogging method based on full convolution network |
Also Published As
Publication number | Publication date |
---|---|
CN105513025B (en) | 2018-12-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105513025B (en) | A kind of improved rapid defogging method | |
CN105046666B (en) | A kind of method of the real-time defogging of traffic video based on dark primary priori | |
CN102831591B (en) | Gaussian filter-based real-time defogging method for single image | |
CN110148095A (en) | A kind of underwater picture Enhancement Method and enhancement device | |
CN104537615B (en) | A kind of local Retinex Enhancement Methods based on HSV color spaces | |
CN108537756B (en) | Single image defogging method based on image fusion | |
CN104794697B (en) | A kind of image defogging method based on dark primary priori | |
CN104253930B (en) | A real-time video defogging method | |
CN108564597B (en) | Video foreground object extraction method fusing Gaussian mixture model and H-S optical flow method | |
CN107527332A (en) | Enhancement Method is kept based on the low-light (level) image color for improving Retinex | |
CN106204491A (en) | A kind of adapting to image defogging method based on dark channel prior | |
CN106157267A (en) | A kind of image mist elimination absorbance optimization method based on dark channel prior | |
CN102930514A (en) | Rapid image defogging method based on atmospheric physical scattering model | |
CN103955905A (en) | Rapid wavelet transformation and weighted image fusion single-image defogging method | |
CN105225210A (en) | A kind of self-adapting histogram based on dark strengthens defogging method capable | |
CN105184743B (en) | A kind of image enchancing method based on non-linear Steerable filter | |
Shen et al. | Convolutional neural pyramid for image processing | |
CN107146209A (en) | A Single Image Dehazing Method Based on Gradient Domain | |
CN107730472A (en) | A kind of image defogging optimized algorithm based on dark primary priori | |
CN108022225A (en) | Based on the improved dark channel prior image defogging algorithm of quick Steerable filter | |
CN104537634A (en) | Method and system for removing raindrop influences in dynamic image | |
CN102110289A (en) | Method for enhancing color image contrast ratio on basis of variation frame | |
CN106933579A (en) | Image rapid defogging method based on CPU+FPGA | |
CN116579945A (en) | A Nocturnal Image Restoration Method Based on Diffusion Model | |
Liang et al. | Learning to remove sandstorm for image enhancement |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |