How to automatically pick parameters for OpenCV adaptive binarization?


I’m talking about

adaptiveThreshold (InputArray src,
OutputArray dst,
double maxValue,
int adaptiveMethod,
int thresholdType,
int blockSize,
double C) 

Is it possible to somehow figure out the optimal blockSize and C parameters? For example, relying on image resolution or something like that.