Using Optical Character Recognition to verify failed server screenshots.

During the past few months, I have wanted to extend my knowledge of individual programming languages so that I can use a wider range of systems, and while learning these I have come across different packages that can save tons of time for certain daily tasks. This article will go into more detail on how I have used Optical Character Recognition to analyse failed server screenshots to filter and report the reason to the end user.

To start, this project is running using Python 3.8.0 and using the below packages:

pytesseract

opencv-python

This project is far from complete but the basic functionality is a great base to make reporting more complex. I will show some demo results below and share the code snippets at the end.

First, let's analyze the failed screenshots that are reported by a backup manager:

Image for post
Image for post
(error (1)) Missing or Corrupt file.
Image for post
Image for post
(false (3)) False Positive.

Image 1. Shows an error for a missing or corrupt file and this prevents the screenshot from booting. This is a valid error and needs to be investigated.

Image 2. Shows the windows lock screen. This is not a valid error as the screenshot has booted successfully.

My goal was to iterate through a folder of images and classify them as ‘Errors’ or ‘False Positives’. Below is the output using the above images:

Image for post
Image for post
Program output

Once I have made the reporting more advanced I will make this public on my Github where you can fork this for yourself.

Project structure:

A Basic Python Implementation

main.py

OCR.py:

Software Engineer, 19 years old.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store