Created
May 15, 2018 23:46
-
-
Save vonqo/04ee4e2f257a0785d847fb636437c1f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cv2 as cv | |
| import numpy as np | |
| img = cv.imread('excited.jpg',0) | |
| kernel = np.ones((13,13),np.uint8) | |
| top_hat = cv.morphologyEx(img, cv.MORPH_TOPHAT, kernel) | |
| backtorgb = cv.cvtColor(top_hat,cv.COLOR_GRAY2RGB) | |
| l, a, b = cv.split(backtorgb) | |
| # cv.imwrite('l_channel.jpg', l) | |
| # cv.imwrite('a_channel.jpg', a) | |
| # cv.imwrite('b_channel.jpg', b) | |
| clahe = cv.createCLAHE(clipLimit=3.0, tileGridSize=(8,8)) | |
| cl = clahe.apply(l) | |
| ca = clahe.apply(a) | |
| cb = clahe.apply(b) | |
| limg = cv.merge((cl,ca,cb)) | |
| final = cv.cvtColor(limg, cv.COLOR_LAB2BGR) | |
| cv.imwrite('merged.jpg', final) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment