Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply CLAHE on RGB color images

Tags:

CLAHE is Contrast Limited Adaptive Histogram Equalization and a source in C can be found at http://tog.acm.org/resources/GraphicsGems/gemsiv/clahe.c

So far I have only seen some examples/tutorials about applying CLAHE on grayscale images so is it possible to apply CLAHE on color images (such as RGB 3 channles images)? If yes, how?

like image 751
Mickey Shine Avatar asked Jul 29 '14 04:07

Mickey Shine


People also ask

How do you use Clahe?

Conversion of RGB to LAB(L for lightness and a and b for the color opponents green–red and blue–yellow) will do the work. Apply CLAHE to the converted image in LAB format to only Lightness component and convert back the image to RGB. Here is the snippet. bgr is the final RGB image obtained after applying CLAHE.

What is Clahe in image processing?

Contrast limited adaptive histogram equalization (CLAHE) is used for improve the visibility level of foggy image or video. In this paper we used CLAHE enhancement method for improving the video quality in real time system.

What is Clahe filter?

CLAHE is a variant of Adaptive histogram equalization (AHE) which takes care of over-amplification of the contrast. CLAHE operates on small regions in the image, called tiles, rather than the entire image. The neighboring tiles are then combined using bilinear interpolation to remove the artificial boundaries.

What is Clahe clip limit?

clip-limit is the contrast limit for localized changes in contrast. A clip-limit of 2 to 3 is a good starting place (e.g. -clahe 50x50%+128+3). Very large values will let the histogram equalization do whatever it wants to do, that is result in maximal local contrast. The value 1 will result in the original image.

Can CLAHE be applied to color images?

We can also apply CLAHE to color images, where usually it is applied on the luminance channel and the results after equalizing only the luminance channel of an HSV image are much better than equalizing all the channels of the BGR image.

How do I convert L*A*B* to RGB?

Perform CLAHE on the L channel. Scale the result to get back to the range used by the L*a*b* color space. L = adapthisteq (L, 'NumTiles' , [8 8], 'ClipLimit' ,0.005); LAB (:,:,1) = L*100; Convert the resulting image back into the RGB color space. Display the original image and the processed image.

What is the final RGB image obtained after applying CLAHE in Python?

bgr is the final RGB image obtained after applying CLAHE. cv2.split isn't required as OpenCV in Python uses NumPy arrays. Once you create the CLAHE object, just do lab [...,0] = clahe.apply (lab [...,0]). You can also remove cv2.merge This method sometimes gives bad results. See point 4 of stackoverflow.com/questions/56905592/….

How to enhance the contrast of a grayscale image using CLAHE?

J = adapthisteq (I) enhances the contrast of the grayscale image I by transforming the values using contrast-limited adaptive histogram equalization (CLAHE) [1]. J = adapthisteq (I,Name,Value) uses name-value pairs to control aspects of the contrast enhancement. Apply CLAHE to an image and display the results.


1 Answers

Conversion of RGB to LAB(L for lightness and a and b for the color opponents green–red and blue–yellow) will do the work. Apply CLAHE to the converted image in LAB format to only Lightness component and convert back the image to RGB. Here is the snippet.

bgr = cv2.imread(image_path)  lab = cv2.cvtColor(bgr, cv2.COLOR_BGR2LAB)  lab_planes = cv2.split(lab)  clahe = cv2.createCLAHE(clipLimit=2.0,tileGridSize=(gridsize,gridsize))  lab_planes[0] = clahe.apply(lab_planes[0])  lab = cv2.merge(lab_planes)  bgr = cv2.cvtColor(lab, cv2.COLOR_LAB2BGR) 

bgr is the final RGB image obtained after applying CLAHE.

like image 186
Nikhil V M Avatar answered Oct 13 '22 22:10

Nikhil V M