Recogizing hand written digit in the image by using the OpenCV and Convolution Neural Network Handwritten images of MNIST is trained by using the COnvolution Neural Network and that is available in Kaggle https://www.kaggle.com/madhankumarselvaraj/digit-recognition also available in this repository Model file will be generated from the Kaggle code and that model should be given to OpenCV as an input.
https://madhankumarselvaraj.blogspot.com/2020/04/logic-behind-machine-recognizes-digits.html