The real-time defogging method capable of a kind of image based on CUDA
Technical field
The present invention relates to Computer Applied Technology and computer vision field, be specifically related to the real-time defogging method capable of a kind of image based on CUDA.
Background technology
The image mist elimination is an important topic in the computer vision field, and Misty Image is carried out the visual effect that sharpening can increase image.Under the weather conditions such as mist, haze, the scene radiant illumination is by the suspended particulates scattering in the atmosphere, and Outdoor Scene visibility reduces, and the feature such as target contrast and color is attenuated in the image, but the identification of scenery reduces greatly.Simultaneously, along with socioeconomic development, increasing to the dependence of video image such as intelligent video monitoring, target identification and the fields such as detection and remote sensing application, fog seems very necessary to the impact of scene objects in the removal of images.
Image mist elimination algorithm mainly is divided into two large classes: based on the image enchancing method of non-model and the Misty Image restored method of Physical modeling based.Based on the method for figure image intensifying, when algorithm process, do not need reason and the model of image degradation, it can be classified as the problem that picture contrast strengthens in essence.Typical method such as histogram equalization, wavelet method and Retinex algorithm etc.Because the defogging method capable based on non-model just simply strengthens picture contrast, does not start with from Misty Image Blur technique and causes for Degradation, has only improved to a certain extent the visual effect of image, is not that substantial mist elimination is processed.So, obtained development and innovation based on the image defogging method capable of atmospheric scattering model.Early stage model-based methods need to or need extra depth information to process by the plurality of pictures under the different weather.Although these methods can reach preferably effect, image acquisition there is harsh requirement, and needs user interactions, can't realize automatic defogging.Recently, some strong priori or hypothesis are applied in the single image automatic defogging, have made on the image mist elimination technical station a new step.Wherein, the single image mist elimination technology that is based on dark primary priori that has milestone significance.This technology is simply effective, but needs the matrix of calculation of complex and find the solution large linear systems, causes the mist elimination algorithm to expend a large amount of operation time and space, has restricted the real-time of its application.
Take a broad view of domestic and international existing image mist elimination algorithm, though obtained greater advance, be difficult to satisfactory to both parties at effect and quality.Traditional framework based on CPU seems awkward in graphics calculations, only has graphic process unit utilized (GPU) could satisfy the demand of practical application.
Summary of the invention
The object of the present invention is to provide the real-time defogging method capable of a kind of image based on CUDA, it is high to equipment requirement to the defogging method capable of image to solve prior art, calculates consuming time and image problem not clearly.
For solving above-mentioned technical matters, the present invention by the following technical solutions:
The real-time defogging method capable of a kind of image based on CUDA may further comprise the steps:
Utilize CUDA to make up CPU and GPU cooperative working environment;
Input the original mist image that has, obtain dark primary image and the atmosphere light value thereof of this image;
Obtain the original transmissivity initial value that the mist image is arranged according to dark primary priori, and utilize the transmissivity after the guiding filtering algorithm is optimized;
According to the original restored image that has after mist image, transmissivity distribution and atmosphere light are determined mist elimination in the atmospheric scattering model.
The real-time defogging method capable of a kind of image based on CUDA according to claim 1 is characterized in that: described dark primary priori is by observation and the logical following methods of open air without the mist image drawn: set J
cRepresent some Color Channels of J, and Ω (x) is a square region centered by x,
Draw, wherein, atmosphere light method of estimation is: get first J
DarkIn the pixel of 0.1% brightness maximum, then get the maximal value of these pixel correspondences in former figure as the atmosphere light value.
The real-time defogging method capable of a kind of image based on CUDA according to claim 1, it is characterized in that: described atmospheric scattering model description the degeneration method of atomizing image be: setting I is the brightness of observed image, J is the intensity of scenery light, and A is the atmosphere light of infinite point, and t is transmissivity.The target of mist elimination is restored J exactly from I, pass through formula
I(x)=J(x)t(x)+A(1-t(x))
Finish.
CUDA (Compute Unified Device Architecture), the calculate platform that the NVidia of video card manufacturer releases.CUDA
TBe a kind of general parallel computation framework of being released by NVIDIA, this framework makes GPU can solve complicated computational problem.It has comprised the parallel computation engine of CUDA instruction set architecture (ISA) and GPU inside.The developer can come to be CUDA with the C language now
TMFramework coding, C language are most widely used a kind of high-level programming languages.So the program of being write out just can supported CUDA
TMProcessor on move with very-high performance.In the future also other Languages be can support, FORTRAN and C++ comprised.
Kernel, the CUDA parallel computation function that operates on the GPU is called kernel (kernel function).A kernel function is not a complete program, but a step that can be executed in parallel in the whole CUDA program.
Compared with prior art, the invention has the beneficial effects as follows: the method is fully in conjunction with CPU and GPU advantage separately, make up the programming model of both collaborative works, and utilize dark primary priori and atmospheric scattering model to estimate atmosphere light value, transmissivity distribution, finally realize good and fast real-time Misty Image recovery effect.
Description of drawings
Fig. 1 is the schematic flow sheet of an embodiment of the real-time defogging method capable of a kind of image based on CUDA of the present invention.
Fig. 2 is not for using the original image of a kind of real-time defogging method capable of image based on CUDA of the present invention.
Fig. 3 is the image that has used behind the real-time defogging method capable of a kind of image based on CUDA of the present invention.
Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, is not intended to limit the present invention.
Fig. 1 shows an embodiment of a kind of real-time defogging method capable of image based on CUDA of the present invention: the real-time defogging method capable of a kind of image based on CUDA may further comprise the steps:
Utilize CUDA to make up CPU and GPU cooperative working environment;
Input the original mist image that has, obtain dark primary image and the atmosphere light value thereof of this image;
Obtain the original transmissivity initial value that the mist image is arranged according to dark primary priori, and utilize the transmissivity after the guiding filtering algorithm is optimized;
According to the original restored image that has after mist image, transmissivity distribution and atmosphere light are determined mist elimination in the atmospheric scattering model.
Here what deserves to be explained is that the programming model of CUDA is CPU and GPU collaborative work.Traditional GPU framework is subjected to the impact of its hardware structure not carry out general-purpose computations by efficent use of resources, and utilizes CUDA can make GPU can not only carry out traditional graphics calculations, can also carry out efficiently general-purpose computations.Because transmissivity is always inconstant in a regional area, so initial transmissivity estimation figure comprises some blocking effects, use the guiding filtering algorithm here and improve the transmissivity distribution function, optimize transmissivity and estimate.
Another embodiment of a kind of real-time defogging method capable of image based on CUDA according to the present invention, utilize CUDA to make up CPU and GPU cooperative working environment, as the main frame of being responsible for carrying out the strong issued transaction of logicality and serial computing with CPU, GPU is as the coprocessor of being responsible for carrying out the parallel processing of height threading, CPU, GPU have separate memory address space separately: the internal memory of host side and the video memory of coprocessor, simultaneously, parallel section in the determine procedures, and the kernel that the evaluation work of this part is given among the GPU processes.
Another embodiment of a kind of real-time defogging method capable of image based on CUDA according to the present invention, dark primary priori is by observation and the logical following methods of open air without the mist image drawn: set J
cRepresent some Color Channels of J, and Ω (x) is a square region centered by x,
Draw, wherein, atmosphere light method of estimation is for getting first J
DarkIn the pixel of 0.1% brightness maximum, then get the maximal value of these pixel correspondences in former figure as the atmosphere light value.
Another embodiment of a kind of real-time defogging method capable of image based on CUDA according to the present invention, describedly obtain the original transmissivity initial value that the mist image is arranged according to dark primary priori, and utilization guides the transmissivity after filtering algorithm is optimized, be to add the guiding wave filter, under the guiding of navigational figure, input picture carried out that filtering finishes.The guiding wave filter keeps fine to the image border, and the size of operation calculated amount and nuclear is irrelevant.When optimizing transmissivity, both improve counting yield, also guaranteed quality.
Another embodiment of a kind of real-time defogging method capable of image based on CUDA according to the present invention, the atmospheric scattering model description degeneration method of atomizing image be: setting I is the brightness of observed image, J is the intensity of scenery light, and A is the atmosphere light of infinite point, and t is transmissivity.The target of mist elimination is restored J exactly from I, pass through formula
I(x)=J(x)t(x)+A(1-t(x))
Finish.Namely by transmissivity distribution t, atmosphere light value A has a mist image I in conjunction with original, utilizes the atmospheric scattering model, namely obtains restored image J.
As shown in Figures 2 and 3, the mist elimination effect is very obvious, for example differentiates the image of road 600*400, and only be 31ms operation time, and the image of rate 720*576 respectively only is 46ms, and its real-time output speed is greater than 20 frame/seconds, and speed is very fast.
Although invention has been described with reference to a plurality of explanatory embodiment of the present invention here, but, should be appreciated that those skilled in the art can design a lot of other modification and embodiments, these are revised and embodiment will drop within the disclosed principle scope and spirit of the application.More particularly, in the scope of, accompanying drawing open in the application and claim, can carry out multiple modification and improvement to building block and/or the layout of subject combination layout.Except modification that building block and/or layout are carried out with improving, to those skilled in the art, other purposes also will be obvious.