Visiting Card Scanner GUI Application using Python
Python is an emerging programming language that consists of many in-built modules and libraries. Which provides support to many web and agile applications. Due to its clean and concise syntax behavior, many gigantic and renowned organizations like Instagram, Netflix so-and-so forth are working in Python work-frame and heading towards magnificent growth. In this article, We are going to build GUI Application for scanning the Visiting card using Tkinter.
Tkinter is a very strong and user-friendly toolkit, as it provides users full control to modify its behavior and attributes of widgets available in the Tkinter library. Since Tkinter provides an object-oriented work-frame it is a far better way of programming for an application. The object-oriented interface in Tkinter satisfies the DRY (Do not repeat yourself) principle and helps to reduce redundancy of the code.
Introduction of above-mentioned libraries:
- Pytesseract library: Pytesseract is an ICR (Intelligent character recognition) and OCR (Optical character recognition) based toolkit available in python. It is a wrapper tool of Google and can “Extract” and “Read” the embedded text in any image. For getting started, Firstly, install and run Pytesseract on your system using the tesseract setup available here. To install pytesseract on the shell after installing the application from the above Github link
pip install pytesseract
- Pillow library: It is a free open source library available in Python for image processing (manipulation, opening, and closing of various file formats i.e. jpeg/png).
pip install Pillow
- Os module: It is an interactive module that deals with the transaction of files between the program and the operating system. os.path utility module provides the functionality of file sharing.
- Firstly, we will create an interface i.e. GUI using various widgets and attributes available in Tkinter like Label, Button, Frame, and so on.
- After creating a basic layout we are now ready to make it responsive by implementing its main functionality i.e. uploading a file and then converting it.
- File dialog box logic will work here so that properly formatted images can be uploaded to the software.
- On successful upload, the system is now ready for conversion and now the Pytesseract module role comes into play. Pytesseract module will read and extract the embedded text from the image and will update the text area with that converted text.
- Also, the File handling approach in python will create and append a text file with that converted text and will store it in our system’s local database.
- The stored file can be accessed in the future for information and verification purposes.
Below is the full implementation:
The above image depicts the application interface.
How to use and How it works?
- User can scan and upload an image in two formats (i.e. jpeg, png)
- On clicking “Upload Card” the user will land on the file dialog box and can select a required image to convert.
- After a successful upload message will be prompted that image uploaded successfully.
- Now user can convert it by clicking on the button “Scan and Convert”.
- Text information will be shown in the text area and the converted file will be stored in the internal database.
Result and Analysis:
Accuracy and efficiency of conversion are very high, so it is recommended the use of this pytesseract library is a very efficient way of conversion.