1 | initial version |
I would suggest you an adaptive threshold. It is computing a threshold on regions and it will eliminate the problems of shadows. There are two types: Gaussian and K-Means. I would suggest you to try both of them to see which is better for your case. Here is the documentation on python, and here is the documentation for C++, you did not mentioned what you need.