1. Ideas and process (solving problems)
This paper uses template matching character recognition algorithm.
First, a template is needed. There is little difference between the digital style and the digital style of the bank card number.
E.g:
I have a CCB card and an ABC card. Both 6 and 9 of the ABC card have a tick. They are just like the ones typed out earlier, but the CCB card does not have a tick, which is a bit like random handwriting.
This puts forward requirements for the template, and two different templates should be used for the two cards.
During the operation, I couldn't find a suitable template, and I didn't know P picture, so I directly typed 0123456789 in the word, then adjusted it to the initial number and bolded it and finally cut a picture.
Then I used the drawing that came with the computer to tick 6 and 9 by myself (strong smile), using it as a template for the Agricultural Bank of China.
1. Template preprocessing
Convert to grayscale image --> If the contrast between the number and the background is not obvious, you can corrode it (the highlight part is corroded, that is, the number is thickened) --> Binarized image.
Then extract the contour --> extract the roi area into the dictionary, and the number corresponds to the key.
(1)bug解决:contours is not a numpy array,neither a scalar
I want to draw an outline during the inspection, and make sure that an error is always reported