I am working on a sudoku solver that takes input from a video camera(Laptop) and processes it, parses the sudoku image as a list of lists, solves it, and projects back the solution onto the sheet.
I am now at the point where I need to recognize each digit from the image. I'm using the MNIST dataset to train my model which expects each input image in the shape of (28, 28, 1), I am successfully able to locate each digit and extract it but performing any kind of threshold on the digit leads to a lot of noise around the digit, which ultimately leads to misclassification by my model.
Is there any method to get rid of the white noise and only extract the digit from the square and then feed it to the Keras Model.
I think this can be achieved by using the cv2.connectedComponentsWithStats
by extracting the largest connected component but I do not know how the method works (and the arguments it expects or the output of the method) and I couldn't find a good explanation on how to use it.
If there is an alternative way other than using cv2.connectedComponentsWithStats
that produces better results please do suggest if not please explain how the cv2.connectedComponentsWithStats
the method works or please point me towards a good resource that helps me understand it and how to use it for my specific case.
PS. If you think the MNIST isn't a good dataset for this task please do tell why and any other dataset that may achieve the task of recognizing digits.