How to extract the text displayed in a dot matrix LED display


I need to extract the number from a display(LED dot matrix) my image for text extraction

Sample Image: dot matrix display

I am using the example code given by pytesseract to test. But I am failing.


try:
    from PIL import Image
except ImportError:
    import Image
import pytesseract

# If you don't have tesseract executable in your PATH, include the following:
pytesseract.pytesseract.tesseract_cmd = r'<full_path_to_your_tesseract_executable>'
# Example tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR\tesseract'

# Simple image to string
print(pytesseract.image_to_string(Image.open('test.png')))

From the sample image I need the output as the number and alphabets given.

If my image have only one number totally filled in whole display that number alone should be in result.. Am I using the right tools? or should I look into opencv and machine learning to extract characters from display.


Answers: