Images captured in adverse weather in the presence of fog or haze are degraded in terms of visibility, contrast, and color. The resultant images are degraded due to the presence of particles in the air which obscure the environment being captured by the camera. Often the images taken in these conditions cannot be used by the end-user computer or vision application such as surveillance, object detection, object tracking, navigation, and other applications.
The advantages of the methods and mechanisms described herein may be better understood by referring to the following description in conjunction with the accompanying drawings, in which:
In the following description, numerous specific details are set forth to provide a thorough understanding of the methods and mechanisms presented herein. However, one having ordinary skill in the art should recognize that the various implementations may be practiced without these specific details. In some instances, well-known structures, components, signals, computer program instructions, and techniques have not been shown in detail to avoid obscuring the approaches described herein. It will be appreciated that for simplicity and clarity of illustration, elements shown in the figures have not necessarily been drawn to scale. For example, the dimensions of some of the elements may be exaggerated relative to other elements.
Various systems, apparatuses, and methods for implementing defogging techniques for images and video are disclosed herein. In one implementation, a defogging engine generates a defog filter result from a grayscale format version of an input image or video frame. The image or frame can be received in the red-green-blue (RGB) color space and converted to the grayscale format prior to processing by the defogging engine. An estimation engine generates an enhancement strength variable from a hue-saturation-value (HSV) format version of the input image. An enhancement engine receives both the defog filter result from the defogging engine and the enhancement strength variable from the estimation engine. The enhancement engine also receives the original RGB format version of the input image. The enhancement engine generates an enhanced version of the input image from the original RGB format version based on the defog filter result and the enhancement strength variable. The enhanced version of the input image mitigates fog, haze, mist or other environmental impediments that obscured the original input image. It is noted that the defogging engine, the estimation engine, and the enhancement engine can be implemented using any suitable combination of circuitry (e.g., application specific integrated circuit (ASIC), field programmable gate array (FPGA)) and program instructions executable by one or more processing units. In some cases, one or more of the defogging engine, the estimation engine, and the enhancement engine are implemented entirely with circuitry configured to perform the functions described herein. In these cases, the defogging engine, the estimation engine, and/or the enhancement engine can be referred to as the defogging circuit, the estimation circuit, and the enhancement circuit, respectively. In other cases, one or more of the defogging engine, the estimation engine, and the enhancement engine are implemented by a combination of circuitry and program instructions executed by processing unit(s). In further cases, one or more of the defogging engine, the estimation engine, and the enhancement engine are implemented entirely by one or more processing units executing program instructions so as to realize the functions and/or algorithms described herein.
Referring now to
It is noted that any type of system or device can implement the techniques described herein, including an integrated circuit (IC), system on chip (SoC), processing unit, mobile device, smartphone, gaming device, Internet of Things (IoT) device, tablet, computer, camera, automobile, wearable device, and other types of computing devices and systems. It is also noted that defogging engine 110, estimation engine 120, and/or enhancement engine 130 can be included on a separate apparatus or system from the camera which captures the image(s) being defogged. In these cases, the image(s), or portions thereof, can be sent from the camera to the apparatus or system employing defogging engine 110, estimation engine 120, and/or enhancement engine 130. Also, while the descriptions herein often refer to images, it should be understood that these descriptions also apply to video frames captured by a video camera or other device capable of capturing a sequence of images.
Turning now to
In one implementation, the input pixel data is received by system 200 in the YUV format. The YUV format defines a color space in terms of one luminance component (Y) and two chrominance components U and V. Conversion unit 210 converts the input pixel data from the YUV to the red, green, blue (RGB) format. Next, the pixel data in the RGB format is provided to defogging unit 220 where a defogging algorithm is applied. It is noted that defogging unit 220 can also be referred to as defogging module 220 or defog module 220. In one implementation, defogging unit 220 combines defogging and adaptive color correction, which can be applied to remove fog, like smog, mist, dust, and haze. The defogged pixel data is output to conversion unit 230 which converts the defogged pixel data back to the YUV format. The output of conversion unit 230 is the defogged pixel data in the YUV format.
Referring now to
Turning now to
In one implementation, the input pixel data is converted to the HSV color space by conversion unit 404 and provided to estimate unit 408. Also, the input pixel data is converted to grayscale by conversion unit 406 and provided to defog filter 412. Estimate unit 408 receives the signal “EN” which is an auto-estimate enable signal in one implementation. Estimate unit 408 generates an estimate of the atmospheric fog intensity based on the input pixel data in the HSV color space. It is noted that estimate unit 408 can also be referred to as estimation engine 408. Based on the estimate of the atmospheric fog intensity, estimate unit 408 provides an enhancement strength signal (or “ER”) to enhancement unit 410.
In one implementation, defog filter 412 receives the grayscale pixel data, a regularization parameter (or “eps”), and a local window radius (or “r”). Defog filter 412 generates the defog filter result which is shown as signal “q” in
Referring now to
In one implementation, a nested for loop is performed for the Y dimension from 1 to h, where “h” is the height of the window, and in the x dimension from 1 to w, where “w” is the width of the window. Within the nested for loop, the conditional statement “if hsv(y,x,2)<0.10 && hsv(y,x,3)<0.40” is evaluated for each pixel. If the conditional statement is true, then the value of T(y,x) is set equal to T(y,x) multiplied by hsv(y,x,2) multiplied by 10. For the routine in box 520, the array T(y,x) represents the operation strength for the image window being evaluated.
Turning now to
The first mean and the second mean are provided to calculation unit 616, which calculates the “a” and “b” variables for the pixel data. It is noted that the “a” and “b” variables may also be referred to as “a” and “b” coefficients, and the “a” and “b” coefficients can be in vector or scalar form depending on the specific implementation. Formulas for calculating the “a” and “b” variables are shown in boxes 706 and 708, respectively, of
Referring now to
As shown in box 704, the variance “var_I” of the image pixel data is calculated as the difference between the second mean and the dot product of the first mean with the first mean. Box 706 lists the formula for calculating the “a” variable as the variance “var_I” divided by the sum of the variance “var_I” and the regularization parameter “eps”. In box 708, the value of the “b” variable is calculated as the difference between the first mean “mean_I” and the product of the “a” variable and the first mean “mean_I”. In box 710, the value of “q” is calculated as the sum of the “b” variable and the product of the “a” variable and the input image (or “I”).
Turning now to
Next, as shown in box 806, the defog filter (e.g., defog filter 412 of
Referring now to
Turning now to
A defogging module receives an input image and a request to defog the input image (block 1005). In one implementation, the input image is received in the red-green-blue (RGB) color space. In other words, in this implementation, the input image is encoded in the RGB color space format. In other implementations, the input image received by the defogging module is encoded in other color space formats. In response to receiving the input image and the defog request, a defogging engine generates a defog filter result from a first format version of the input image (block 1010). In one implementation, the first format is a grayscale format version of the input image. In this implementation, the input image is converted to the grayscale format from the format in which it was originally received.
Also, an estimation engine generates an enhancement strength variable from a second format version of the input image, where the second format version is different from the first format version (block 1015). In one implementation, the second format version is a hue-saturation-value (HSV) format version of the input image. In other implementations, the second format version is any of various other color space format versions of the input image. Additionally, an enhancement engine receives the defog filter result from the defogging engine, the enhancement strength variable from the estimation engine, and a third format version of the input image, where the third format version is different from the first and second format versions of the input image (block 1020). In one implementation, the third format version is a RGB color space version of the input image. In other implementations, the third format version is any of various other color space format versions of the input image.
It is noted that the defogging engine, the estimation engine, and the enhancement engine can be implemented using any suitable combination of circuitry (e.g., application specific integrated circuit (ASIC), field programmable gate array (FPGA)) and program instructions executable by one or more processing units. For example, in one implementation, at least some portion of the defogging engine, the estimation engine, and the enhancement engine can be defined at the register transfer level (RTL) using a language such as Verilog, VHDL, or other to create a high-level representation of the circuitry. Lower-level representations and actual wiring of the circuitry can be derived from the RTL code and one or more other inputs. Depending on the embodiment, the defogging engine, the estimation engine, and the enhancement engine can be implemented entirely in circuitry, implemented entirely by program instructions executed by one or more processing units, or implemented by a combination of circuitry and executable program instructions.
Next, the enhancement engine generates an enhanced version of the input image based on the defog filter result and the enhancement strength variable (block 1025). The “enhanced version of the input image” can also be referred to herein as the “defogged version of the input image”. In one implementation, the enhanced version of the input image is encoded in the RGB color space. In other implementations, the enhanced version of the input image is encoded in any of various other color space formats. Then, the enhanced version of the input image is displayed, stored, sent to a display controller, and/or processed by another image processing image as a representation of a defogged version of the original input image (block 1030). After block 1030, method 1000 ends. It is noted that method 1000 can be performed for an entire image or for any portion of an image.
Referring now to
Turning now to
In various implementations, program instructions of a software application are used to implement the methods and/or mechanisms described herein. For example, program instructions executable by a general or special purpose processor are contemplated. In various implementations, such program instructions are represented by a high level programming language. In other implementations, the program instructions are compiled from a high level programming language to a binary, intermediate, or other form. Alternatively, program instructions are written that describe the behavior or design of hardware. Such program instructions are represented by a high-level programming language, such as C. Alternatively, a hardware design language (EIDL) such as Verilog is used. In various implementations, the program instructions are stored on any of a variety of non-transitory computer readable storage mediums. The storage medium is accessible by a computing system during use to provide the program instructions to the computing system for program execution. Generally speaking, such a computing system includes at least one or more memories and one or more processors configured to execute program instructions.
It should be emphasized that the above-described implementations are only non-limiting examples of implementations. Numerous variations and modifications will become apparent to those skilled in the art once the above disclosure is fully appreciated. It is intended that the following claims be interpreted to embrace all such variations and modifications.