Document Scanner


This was the second project completed during my internship at HP. I was tasked to design a smart document scanner, which automatically crops and rotates scanned documents. This project was submitted for HP patent filing.

There are two parts to the solution I came up with. The first script uses OpenCV image processing functions to crop out individual documents from the scanned image, while the second uses TensorFlow to identify the image’s angle of rotation and corrects it accordingly.

Auto Crop

Auto Rotation


  • Having a larger dataset (currently only about 100 images per category)
  • Classifier can be trained to be more specific (ie. One model just for receipts, another just for name cards)
  • Another method could be by using OCR – the angle of rotation where the OCR engine would be able to extract the most text.