I'm using
import cv2
cv2.adaptiveThreshold(img,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
cv2.THRESH_BINARY_INV,
11,
0)
in python to compute a preprocess on different types of images. Since a constant C (0 in this case) and the kernel size (11 in this case) can be good for a specific type of image and bad for another type, is there a way to calculate them dynamically using some features of an image?