You are on page 1of 5

TEXT DETECTION BASED ON MORPHOLOGICAL

OPERATIONS AND INPAINTING


ANISHA P S
PG Student, ECE Department, DBIT, Bangalore, Karnataka, India
anishaps078@gmail.com

DR.MAHESH P K
Prof. & HOD, ECE Department, DBIT, Bangalore, Karnataka, India
mahesh24pk@gmail.com

ABSTRACT: Image is a positive quality and its a arrangement of pixels. Image can be
represented in two dimensional, three dimensional, analog or digital forms. Pixel is a detailed
information at a particular point in an image. Text detection and inpainting are the most widely
spread topics in image processing. Inpainting is the process of propagation of known information
in an image towards unknown region based on best match. There are various text detection and
inpainting techniques. This paper deals with the simulation of text detection based on
morphological operations and inpainting using OpenCV on Intel atom processor.

KEYWORDS: Text detection , Image inpainting , Morphology and OpenCV .

INTRODUCTION

Inpainting plays important role in image processing. Bertalmio [1], was the first person to
introduce the concept of image inpainting in digital images. Some pictures will contain text
inserted in it, which has to be erased as per the requirement of the user, in such a case text
detection and removal plays a very important role. The technique of rebuilding the missing or
deteriorated regions in a image is termed as image inpainting. Inpainting techniques is also
applicable to videos. Human eyes are the media through which humans can interact with
surrounding environment and they are very sensitive to the quality of images. The special quality
of inpainting is that the recovered image appears same as that of the original image and gives
better visual quality to the viewers.

The inpainting techniques can be used to fulfill the need of recovering the damaged paintings ,
photographs, artworks etc. which are caused due to ageing, scratches , dust or various
environmental conditions. Inpainting is used in wide range of applications such as zooming of
images, during transmission there will be loss of certain information due to various condition in
such case inpainting algorithms can be used to recover the lost information, it can also be used for
recovering the ancient artworks ,recovering a damaged image due to scratch[5], segmentation
applications, it can also be used for filtering purpose[6].

Morphology is concerned with the shape and structure of object without considering its
functionality. Mathematical morphology deals with is technique for the analysis and processing
of geometrical structures, based on set theory such as union, intersection etc.. Morphology is
basically performed on binary image. Morphological operations are used for text detection and
removing text based on certain criteria.
Various morphological transforms are dilation, erosion, open, close, hit/miss transform, boundary
extraction , connected components labeling, convex hull, thinning , thickening and skeletonization.
Morphology has wide range of applications ,few of them are preprocessing includes filtering and
simplification of shapes, segmentation , quantification of objects and object structure
enhancement.

OpenCV stands for open source computer vision. OpenCV was launched during 1999. OpenCV
focus on real time applications and provides better computational efficiency. It consists of various
functions and libraries for analysis of video and images. It is largely used by researchers,
scientists and developers in computer vision.

OpenCV 1.0 was launched in 2006 , OpenCV 1.1 was released during October 2008 and OpenCV
2 was launched during 2009. OpenCV 2 included improvements such as C++ interface, easy to
handle, new functionalities and better performance on multi-core processors. OpenCV performs
well on Windows, Android ,Blackberry, Linux and OS X .The library contains C and C++
interface.

LITERATURE SURVEY

Marcelo Bertalmio, Luminitia Vese , Guillermo Sapiro et al. [1], One of the important concept in
image processing is recovering the damaged information which is termed as image inpainting. It
includes applications such as image restoration, coding ,transmission etc. The idea of Bertalmio is
to develop a new approach to fill all the missing details in the regions using both texture synthesis
and structure synthesis inpainting method.

Uday Modha , Preeti Dave et al. [2] , in this paper is to combine both text detection techniques and
inpainting technique by using morphology algorithms. The resultant system is one which
automatically removes the text without user interaction at any point of time. The algorithm gives a
better performance on real images.

Bhuvaneshwari , Subashini et al. [3] , in this paper text detection and inpainting is done based on
fast marching image algorithm. The region to be inpainted is selected by the user.

Prof. Amit Choksi , Nihar Desai, Ajay Chauhan, Vishal Revdiwala , Prof. Kaushal Patel et al. [4],
introduced a new approach using prewitt edge detection method. Many researches has been taken
place and few researches are undergoing for regaining the content from natural images such as
automatic text detection , object detection and face recognition. Pre-processing, edge detection,
morphological operations and character recognition are the steps employed in this approach.

METHODOLOGY

The entire concept of this paper is divided into two stages: text detection and inpainting. The text
detection stage consists of four steps :morphological edge detection, formation of text region ,
connected component labeling and text feature filtering. Figure 1 shows the block diagram of this
approach.

Morphological edge detection includes open-close and close-open filter, gradient and thresholding.
Edge detection can also be performed by using canny, sobel , prewitt functions. In this paper we

104
Input Output
Edge Candidate Connected
detection region component Filtering Inpainting
formation labeling

Figure 1. Block diagram used for text detection

have used canny function for edge detection. Text candidate region is formed with the help of
dilation and erosion operations. Once the text candidate region is detected each object in an image
is labeled separately. Later the text and the non-text regions are separated. This is followed by
inpainting.

Dilation and erosion are the very basic morphological operations. Morphological operations are
applied to binary images. Dilation is vector addition of input image and the structure element. By
performing dilation the area of the object in an image is expanded. Erosion is inversion of dilation.
Erosion is performed in order to decrease the area of an object. Erosion is nothing but vector
subtraction of input image and the structure element.

Morphological open and close filters are incorporated to overcome the drawbacks of dilation and
erosion. Opening and closing operations are performed by combining dilation and erosion
operations. The process of carrying out erosion operation followed by dilation operation is termed
as opening. Closing is the process of achieving dilation operation followed by erosion operation
using same structure element.

Text inpainting is done in two steps: at first the target region is found using the mask image and in
the second step the boundary of target region is found. Once the boundary is extracted the target
region is filled by using patch based filling procedure with the higher priority patch filled first,
followed by the lower priority patches.

RESULTS

Resultant figures after performing dilation ,erosion, edge detection , text candidate region
formation and the image after performing dilation on edge detected image using OpenCV are
shown below.

Figure 2. Input image Figure 3. Dilated image

105
Figure 4. Eroded image Figure 5. After edge detected image

Figure 6. Text candidate region formaton Figure 7. Image after dilation

CONCLUSION

In this paper edge detection is done using canny edge detection and with the help of mathematical
morphology, text detection and inpainting is implemented in OpenCV version 2.0.

106
REFERENCES

Marcelo Bertalmio, Luminita Vese, Guillermo Sapiro, Stanley Osher, Simultaneous Structure
and Texture Image Inpainting , IEEE Transactions On Image Processing ,
vol. 12, No. 8, 2003.
Uday Modha, Preeti Dave, Image Inpainting-Automatic Detection and Removal of Text From
Images, International Journal of Engineering Research and Applications (IJERA), ISSN: 2248-
9622 Vol. 2, Issue 2, 2012.
S.Bhuvaneswari, T.S.Subashini, Automatic Detection and Inpainting of Text Images,
International Journal of Computer Applications (0975 8887) Volume 61 No.7, 2013.
Boris Epshtein, Eyal ofek ,Yonatan Wexler , Text Extraction from Natural Scene Images using
Prewitt Edge Detection Method, International Journal of Advanced Research in Computer
Science and Software Engineering, ISSN: 2277 128X Vol. 3, Issue 12, 2013.
M. Bertalmio, G. Sapiro, V. Caselles, and C. Ballester, Image inpainting, in Proc. SIGGRAPH,
pp. 417424, 2000.
M. Dimmiccoli and P. Salembier, Perceptual filtering with connected operators and image
inpainting, in Proc. ISMM, 2007.

107