Images and video captured in water or fog suffer from low contrast and color distortion due to light scattering and absorption. An image formation model for hazy images is commonly used to restore both underwater images and hazy images because of the similarity between the two types of images. However, red light is attenuated faster than blue and green light in underwater, and underwater images are distorted by changes of color tone. Therefore, most current methods are specialized for either hazy images or underwater images. In this paper, we propose a novel defogging method which is efficient for both hazy images and underwater images. Our method is composed of adaptive color correction and weighted generalization of dark channel prior (WGDCP). Experimental results show that our algorithm can recover both underwater images and hazy images.