hayatkhan8660-maker/Light-DehazeNet

Question of the matlab code of CVR module

Opened this issue · 1 comments

I read the overall code of the file (CVR.m). I found that it seems you only conduct the operation of '' localcontrast'' on the input image. Am I right?

% Final color compensated Image
edgeThreshold = 0.4;
amount = 0.5;
RGB = localcontrast(RGB, edgeThreshold, amount);

If this is real, perhaps I implemented CVR in Python :)

def cvr(image, clip_limit=2.0, tile_size=(8, 8)):
    # Convert the image to LAB color space
    lab_image = cv2.cvtColor(image, cv2.COLOR_BGR2LAB)

    # Split the LAB image into channels
    l, a, b = cv2.split(lab_image)

    # Apply CLAHE to the L channel
    clahe = cv2.createCLAHE(clipLimit=clip_limit, tileGridSize=tile_size)
    enhanced_l = clahe.apply(l)

    # Merge the enhanced L channel with the original A and B channels
    enhanced_lab = cv2.merge([enhanced_l, a, b])

    # Convert the enhanced LAB image back to BGR
    enhanced_image = cv2.cvtColor(enhanced_lab, cv2.COLOR_LAB2BGR)

    return enhanced_image