Number of bins in histogram after apply CLAHE from cv2 in python

asked 2019-06-25 21:25:56 -0500

Darkhunter9 gravatar image

updated 2019-06-26 13:56:46 -0500

I try to use CLAHE in cv2 to process some of my experiment images. I thought if I set the tile size same as the size of image, it will just do normal histogram equalization. However, it turns out if I increase the tile size, the number of bins in histogram of output will decrease. When I set the tile size 60*60 (same as my image), there are only 4 kinds of pixel values in the output (no matter how I set the contrast limit). This leads to loss of details in the image. Is there any other method I can do histogram equalization while maintaining the number of bins? Thank you very much!!!

The number of bins decreases with the increase of the tile size tried different values for contrast limit but didn't work

Before CLAHE, it's image description

After CLAHE, tile size = 60*60, it's image description

import cv2
import matplotlib.pyplot as plt
clahe = cv2.createCLAHE(clipLimit=40, tileGridSize=(60,60))
img_new = clahe.apply(img)
edit retag flag offensive close merge delete