Text Extraction from Image using Python

With so much of our lives computerized, it is vitally important that machines and humans can understand one another and pass information back and forth. Mostly computers have things their way we have to & talk to them through relatively crude devices such keyboards and mice so they can figure out what we want them to do. However, when it comes to processing more human kinds of information, like an old-fashioned printed book or a letter scribbled with a fountain pen, computers have to work much harder. That is where optical character recognition (OCR) comes in. Here we process the image, where we apply various pre-processing techniques like desk wing, binarization etc. and algorithms like Tesseract to recognize the characters and give us the final document


I. INTRODUCTION
Text data present in images contain useful information for automatic annotation, indexing, and structuring of images. Extraction of this information involves detection, localization, tracking, extraction, enhancement, and recognition of the text from a giv image. However, variations of text due to differences in size, style, orientation, and alignment, as well as low image contrast and complex background make the problem of automatic text extraction extremely @ IJTSRD | Available Online @ www.ijtsrd.com | Volume -1 | Issue -6 | Sep-Oct 2017 With so much of our lives computerized, it is vitally important that machines and humans can understand one another and pass information back and forth. Mostly computers have things their way we have to & talk to them through relatively crude devices such as keyboards and mice so they can figure out what we want them to do. However, when it comes to processing more human kinds of information, like an fashioned printed book or a letter scribbled with a fountain pen, computers have to work much harder. at is where optical character recognition (OCR) comes in. Here we process the image, where we apply processing techniques like desk wing, binarization etc. and algorithms like Tesseract to recognize the characters and give us the final Python; Image Processing; Text Extraction; Image threshold; Virtual Image Text data present in images contain useful information for automatic annotation, indexing, and structuring of images. Extraction of this information involves detection, localization, tracking, extraction, enhancement, and recognition of the text from a given image. However, variations of text due to differences in size, style, orientation, and alignment, as well as low image contrast and complex background make the problem of automatic text extraction extremely challenging. While comprehensive surveys o problems such as face detection, document analysis, and image indexing can be found, the problem of text information extraction is not well surveyed. A large number of techniques have been proposed to address this problem, and the purpose of this classify and review these algorithms, discuss benchmark data and performance evaluation, and to point out promising directions for future research.
Content-based image indexing refers to the process of attaching labels to images based on the Image content can be divided into two main categories: perceptual content and semantic content. Perceptual content includes attributes such as color, intensity, shape, texture, and their temporal changes, whereas semantic content means objects, their relations. A number of studies on the use of relatively low-level perceptual content for image and video indexing have already been reported. based image indexing refers to the process of attaching labels to images based on their content. Image content can be divided into two main categories: perceptual content and semantic content. Perceptual content includes attributes such as color, intensity, shape, texture, and their temporal changes, whereas semantic content means objects, events, and their relations. A number of studies on the use of level perceptual content for image and video indexing have already been reported. Studies on semantic image content in the form of text, face, vehicle, and human action have also attracted some recent interest. Among them, text within an image is t is very useful for describing the contents of t can be easily extracted compared to other semantic contents, and It enables applications such as keyword-based image search, automatic video logging, and based image indexing.

II. TEXT IN IMAGES
A variety of approaches to text information extraction (TIE) from images have been proposed for specific applications including page segmentation, address block location, license plate location, and contentbased image indexing. Text in images can exhibit many variations with respect to the properties like geometry, color, motion, edge and compression. The problem of Text Information Extraction TIE system receives an input in the form of a still image or a sequence of images. The images can be in gray scale or color, compressed or un-compressed, and the text in the images may or may not move. The TIE problem can be divided into the following sub-problems: (i) detection, (ii) localization, (iii) tracking, (iv) extraction and enhancement (v) Optical Character recognition (OCR).  This thresholding operation can be expressed as: If the intensity of the pixel , then the new pixel intensity is set to a Otherwise, it is set to .
C. Truncate This thresholding operation can be expressed as: The maximum intensity value for the pixels is is greater, then its value is truncated. See figure below:

, if
International Journal of Trend in Scientific Research and Development (IJTSRD) ISSN: 2456 This thresholding operation can be expressed as: is higher than , then the new pixel intensity is set to a . Otherwise, the pixels are set to . This thresholding operation can be expressed as: is higher than , then the new pixel intensity is set to a .
This thresholding operation can be expressed as: The maximum intensity value for the pixels is is greater, then its value is D. Threshold to Zero This operation can be expressed as: If is lower than be set to .
E. Threshold to Zero, Inverted If is greater than will be set to .

F. Simple Thresholding
If pixel value is greater than a threshold value, it is assigned one value (may be white), else it is assigned another value (may be black). The function used is cv2.threshold. First argument is the source image, which should be a grayscale image is the threshold value which is used to classify the pixel values. Third argument is the maxVal which represents the value to be given if pixel value is more than (sometimes less than) the threshold value. OpenCV provides different styles of thresh decided by the fourth parameter of the function. This operation can be expressed as: , the new pixel value will ero, Inverted If pixel value is greater than a threshold value, it is assigned one value (may be white), else it is assigned another value (may be black). The function used is . First argument is the source image, should be a grayscale image. Second argument is the threshold value which is used to classify the pixel values. Third argument is the maxVal which represents the value to be given if pixel value is more than (sometimes less than) the threshold value. OpenCV provides different styles of thresholding and it is decided by the fourth parameter of the function. is an online Integrated Development Environment (IDE) and Web hosting service based on the Python programming language. It based Python and line interfaces, along with a code editor with Syntax highlighting. One striking different between Python Anywhere and the usual Python Cloud of, is that you can totally work on it online using internet browser in developing your Python application. With this, you can bypass the usual delicacies on preparing a local workstation that meet cloud hosting service y work inside your browser that connected to many consoles provided by Python anywhere, such as : Bash, Python/iPython 2.6/2.7/3.3 and MySQL.
step guide on how to deploy your Django applications. The service provides inbased Python and Bash command line interfaces, meaning you can interact with Python Anywhere's servers just like you would with a regular terminal instance on your own computer. Currently, Python Anywhere are offering a h sets you up with an adequate amount of storage space and CPU time to get a Django A. Creating a Python Anywhere Account First sign up for a Beginner Python Anywhere account. If your application takes off and becomes popular, you can always upgrade your account at a later stage to gain more storage space and CPU time along with a number of other benefits (like hosting specific domains and ssh abilities).
Once your account has been created, you will have your own little slice of the World Wide Web at http://<username>.pythonanywhere.com, where <username> is your Python Anywhere username. It is from this URL that your hosted a available from.

B. The Python Anywhere Web Interface
The Python Anywhere web interface contains a dashboard, which in turn provides a series of tabs allowing you to manage your application. The tabs as illustrated in Fig. 10 include:  a consoles tab, allowing you to create and interact with Python and Bash console instances;  a files tab, which allows you to upload to and organize files within your disk quota;  a web tab, allowing you to configure settings for your hosted web applicatio  a schedule tab, allowing you to setup tasks to be executed at particular times; and  a databases tab, which allows you to configure a MySQL instance for your applications should you require it.
Of the five tabs provided, we'll be working primarily with the consoles and web tabs. The Python Anywhere help pages provide a series of detailed explanations on how to use the other tabs. A. Creating a Python Anywhere Account First sign up for a Beginner Python Anywhere account. If your application takes off and becomes popular, you can always upgrade your account at a later stage to gain more storage space and CPU time along with a number of other benefits (like hosting ic domains and ssh abilities).
Once your account has been created, you will have your own little slice of the World Wide Web at http://<username>.pythonanywhere.com, where <username> is your Python Anywhere username. It is from this URL that your hosted application will be

B. The Python Anywhere Web Interface
The Python Anywhere web interface contains a , which in turn provides a series of tabs allowing you to manage your application. The tabs as tab, allowing you to create and interact with Python and Bash console tab, which allows you to upload to and organize files within your disk quota; tab, allowing you to configure settings for your hosted web application; tab, allowing you to setup tasks to be executed at particular times; and tab, which allows you to configure a MySQL instance for your applications should Of the five tabs provided, we'll be working primarily tabs. The Python Anywhere provide a series of detailed explanations on  Here we specify the file we wish to run. Python is the keyword to specify that we are running a python file and testest.py is the file name.

E. Result File
Fig. 14: Text files containing extracted text The text extracted from the images is pipelined to a text file where the user can view, edit and modify its contents. User can thus save the obtained text file and download it from Python Anywhere.

A. System Architecture
The entire process can be depicted using these basic steps: Fig. 15: Workflow in the system The three basic steps involved in this process are detection, enhancement and extraction. This diagram defines the structure of the system.  A. Example 1:

FUTURE SCOPE
With machine learning algorithms constantly being developed and improved, massive amounts of computational power becoming readily available both locally and on the cloud, and unfathomable amounts of data can be extracted not only in the domain of image but also in terms of scene, video frames and scrolling types of data.