Adaptive Sky Detection and Preservation in Dehazing Algorithm Sheng-kui Dai College of Information Science and Engineering Huaqiao University Xiamen, China d.s.k@hqu.edu.cn Jean-Philippe Tarel LEPSiS, Cosys IFSTTAR Champs-sur-Marne, France Jean-Phillippe.Tarel@ifsttar.fr Abstract—Single image defogging and/or dehazing algorithms usually emphasize the small intensity variations of the sky, when it is heterogeneous. This leads to a dramatic aspect of the restored image. This sky problem is probably one of the biggest defects of all the state-of-the-art dehazing algorithms. It was proposed to handle the sky problem by hard or smooth threshold of the sky area and to process the detected sky area differently not to emphasize too much the contrast of the sky heterogeneity. But the threshold value needed to be set by the user. We thus here propose a rule for selecting the threshold value as a function of the histogram of the image to process. This rule shows nice improvements on different kinds of images as shown in our experiments on a database of 1500 images. Keywords—sky contrast preservation; defogging; dehazing; contrast restoration; histogram I. INTRODUCTION Due to the fog or haze, the contrast of a foggy image can be seriously decreased, as well as the color vividness. This may reduce the overall performance of real image or real video systems used in video surveillance, photography, intelligent vehicles... Due to these many fields of application, defogging or dehazing has been a subject of interest in the recent years in image processing and computer vision. In the early works [1], [2], [3], [4], defogging required multiple images from the same point of view or, at least, an approximate 3D model of the scene. Recently, fog removal in the context of stereo reconstruction was also a subject of interest see [5] and [6]. However, the mainstream in fog removal remains single image defogging, where only the foggy image to be restored is assumed available. This is the case which corresponds to the larger field of practical applications. The single image defogging algorithms proposed in the recent years can be grouped in three classes. The first class consists in the use or in the improvement of standard algorithms for contrast enhancement, such as CLAHE [18], Retinex [17] or other algorithms developed originally, most of the time, for uniformly attenuated images. In these algorithms the fog physical model is not used and results are not correct in case of large depth variations in the observed scene. The second class is based on a physical model of the fog, which is called Koschmieder’s law [9]. It is also the class of contrast restoration algorithms. For instance, Tan [7] removes fog by maximizing the local contrast of the result. But the enhanced sky is usually over contrasted. He et al. [10] proposed the Dark Channel Prior (DCP) but the sky area does not meet this prior and thus leads to bothersome color or contrast distortions. Tarel et al. [19] proposed fast defogging using median filter but they also face the sky problem. Kim et al. [8] can achieve nice results for most images, but sometimes there is a color cast in sky area. Very recently, Sulami et al. [11] obtained more vivid results but there are failure cases again in the sky. The third class of algorithms uses a mixture of physically based and not-physically based processing. For instance, in [21] or [12], CLAHE is combined with contrast restoration such as DCP. Despite the fact that the sky area is usually over contrasted in single image defogging, we only found two articles [13] and [14] on how to fix the sky problem for images under daylight. The success of these two algorithms deeply relies on the choice of a parameter value used to detect the sky. This value is usually different from one image to another. This paper is organized as follows. Section 2 recalls the general approach of the single image contrast restoration. Section 3 describes the proposed rule to detect the sky in the image and to select the sky threshold. Section 4 reports the experimental results obtained with the proposed algorithm and a user evaluation.