- Exploring the fonts using digit images and OTSU binarisation.
- Creating the dataset directories.
- Writing augmentation functions.[digitAugmentation,add_noise,pixelate,stretch,preprocess]
- Creating 1000 variations to each digit of the font type sampled.This is train data.
- For Test data we are sampling the same dataset.In actual it is preferred to have real life unseen data from another source.
- Creating Classifier in Keras using LeNet CNN Architecture
- Train the model for 5 epochs.
- Using canny edge detection for card boundary.
- Using cv2.findContours() to extract the largest contour.
- Use the function four_point_transform() and order_points() to adjust the perspective of the card.
- First load grayscale extracted image and the original color.
- Apply the Canny Edge algorithm.
- Use findCountours to isolate the digits.
- Sort the contours by size.
- Then sort left to right by creating a function that returns the x-cordinate of a contour.(cv2.moments)
- Find the bounding rectange of the contour which gives us an enclosed rectangle around the digit.
- Take each extracted digit, use pre_processing function (which applies OTSU Binarization and re-sizes it) then breakdown that image array so that it can be loaded into our classifier.