We frequently received documents in the form of images or PDFs. Sometimes we need to extract text/data from photos, and copy/paste is not an option. If we have several papers, it is extremely difficult and time consuming to extract data from photos.

With Python OCR, systems can read text from images, invoices, PDFs, hand-written text, and printed documents. OCR, or optical character recognition, is a computer vision technology. Text can be extracted from photos, and images may be simply converted to text. EasyOCR is the most basic method of implementing OCR. It is a Python library that can read text from photos in over 40 different languages. It is incredibly simple to implement with only a few lines of code and produces good results.

OCR text 1

When to use OCR

When we encounter a circumstance in which we must deal with non-editable textual pictures, PDFs, and printed hard copies, it will take a significant amount of time and effort to accomplish your work. Then OCR may be a better alternative for you, since it will quickly address your problem by extracting text from these papers rather than doing the same manually. Increase work efficiency by avoiding human errors.

How to use EasyOCR

EasyOCR is incredibly simple to use as it has few dependencies.

Install the EasyOCR package first with the pip install easyocr command.

When easyocr is installed, use the import easyocr command to import the package to your project.

Then you may start writing code to extract text from photos. By supplying [‘en’] to process in English, it will read only English text and ignore the rest of the text. You can pass whatever language you like and then load image path in readtext (image path) method for reading text.

And that’s how easily you extracted text from an image.

image-with-text

“import easyocr
reader = easyocr.Reader([‘en’])
Result = reader.readtext(‘abc.png’)
Print(result)”

OUTPUT: [([[272, 304], [446, 304], [446, 336], [272, 336]], ‘Hello World!!’, 0.737285318007567)]

This kind of output could be difficult for the non-developers to understand hence we can make it simple by passing the detail parameter as 0.

“import easyocr
reader = easyocr.Reader([‘en’])
Result = reader.readtext(‘abc.png’, detail=0)
Print(result)”

OUTPUT: [‘Hello World!!’]


The output is not showing the coordinates of the text as we pass the detail parameter as 0. It is only showing the required text. In this code ‘en’ is english language we can write any language in which we want to extract text.

Use Cases of OCR

Disadvantages

How OCR helps in solving Business Problems?

OCR helps in Business to become more productive and cost-efficient by making easy to process documents and digitize them.

Conclusion

EasyOCR is the simplest and easiest way to implement Optical Character Recognition (OCR) with very few lines of code. Dealing with images becomes simple and quick. A large amount of text can be processed quickly. The information obtained through OCR is then more understandable and accurate. OCR is more accurate and takes less time than manual typing. It contributes to improved performance accuracy.

If you want to learn more about such topics or if you need software consulting, please contact us at info@ignatiuz.com.