diff --git a/haze_removal.py b/haze_removal.py index bd0e5a8..5efcf60 100644 --- a/haze_removal.py +++ b/haze_removal.py @@ -12,8 +12,9 @@ def __init__(self, omega=0.95, t0=0.1, radius=7, r=20, eps=0.001): def open_image(self, img_path): img = Image.open(img_path) + if img.mode != 'RGB': + img = img.convert('RGB') self.src = np.array(img).astype(np.double)/255. - # self.gray = np.array(img.convert('L')) self.rows, self.cols, _ = self.src.shape self.dark = np.zeros((self.rows, self.cols), dtype=np.double) self.Alight = np.zeros((3), dtype=np.double)