This is question is a follow-up of Prepare complex image for OCR.
I have an output of a canny edge detector of an image with digits:
As you can see, I have various edges for a digit, which result from the embossment on a credit card. The goal would be to have solid digits, which are suitable for character recognition.
This is an attempt to "fill" the digits using a morphological close operation with a 5x5 structuring element in shape of a diamond:
I tried various structuring elements, but without much success. You can see how holes are being created (digit 9 and 0) and shapes are being distorted (digit 3).
Can you recommend a better approach to fill the structures, but without glueing different digits together and keeping the original shape?
However, even with the poorly looking digits and splitting the digits vertically after applying the close operation, there are already good recognition results achievable.
Thanks, Valentin