'Adaptive threshold return empty characters

When I adaptive threshold an image, in some cases it returns empty characters. I am looking for a solution, maybe some preprocessing to prevent this. Here are some examples. (photo from google)

enter image description here

and the result: enter image description here

I want something like the small size numbers (0123... - which are solid). It also happens when we have light characters on dark background! Thank you.

edit: here is a number on dark bg. I used a large kernel size but it is not resolved.

enter image description here

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source