Detecting digits in a Video feed using OpenCV and Tensorflow
The two modules it contains are:
- main_utils - This contains main functions.
- model_utils - This contains functions to train a CNN model, using this CNN architecture I got an accuracy of 99.8% in Kaggle MNIST Competition.
-
Takes in video feed from mobile phone using an app like DroidCam, so we need to mention IP-address and port number which can be found in that app in python as follows:
cap = cv2.VideoCapture("http://x.x.x.x:y/mjpegfeed") # where x -> IP-address and y -> port number ret, frame = cap.read() # frame -> one frame(picture) captured at that moment
-
Then processes the image when key c is pressed to detect digits using contour detection.
-
Then resizes the image and predicts using pre-trained model (
mnist_model.h5
).
Image on the right shows us prediction results