Number of bins in histogram after apply CLAHE from cv2 in python
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
After CLAHE, tile size = 60*60, it's
import cv2
import matplotlib.pyplot as plt
cv2.imread('1.png')
clahe = cv2.createCLAHE(clipLimit=40, tileGridSize=(60,60))
img_new = clahe.apply(img)
plt.figure()
plt.hist(img_new.ravel(),256,[0,256])