rnt final major1
TRANSCRIPT
-
8/22/2019 Rnt Final Major1
1/50
Separating text and non-text doodles 2012
1. INTRODUCTION
1.1 General Overview of the Problem
In electrical engineeringand computer science, image processing is any form
ofsignal processing for which the input is an image, such as aphotograph orvideo
frame; theoutput of image processing may be either an image or, a set of
characteristics orparametersrelated to the image. Most image-processing techniques
involve treating the image as atwo-dimensionalsignal and applying standard signal-
processing techniques to it.
Image processing usually refers to digital image processing, but optical and analog
image processing also are possible. Digital image processing is the use of
computeralgorithms to perform image processing ondigital images. As a subcategory
or field ofdigital signal processing, digital image processing has many advantages
over analog image processing. It allows a much wider range of algorithms to be
applied to the input data and can avoid problems such as the build-up of noise andsignal distortion during processing. Since images are defined over two dimensions,
digital image processing may be modeled in the form ofMultidimensional Systems.
With the growth of the World Wide Web, the need for easy access to a vast repository
of both historical and contemporary handwritten documents has led to an ever-
increasing demand for an efficient information retrieval system that can search and
retrieve handwritten documents when presented with user queries. In this project, we
present an overview of our method for information retrieval and extraction from noisy
handwritten documents of poet Rabindranath Tagore.
1 Sikkim Manipal Institute
of Technology
http://en.wikipedia.org/wiki/Electrical_engineeringhttp://en.wikipedia.org/wiki/Electrical_engineeringhttp://en.wikipedia.org/wiki/Computer_sciencehttp://en.wikipedia.org/wiki/Signal_processinghttp://en.wikipedia.org/wiki/Photographhttp://en.wikipedia.org/wiki/Video_framehttp://en.wikipedia.org/wiki/Video_framehttp://en.wikipedia.org/wiki/Outputhttp://en.wikipedia.org/wiki/Outputhttp://en.wikipedia.org/wiki/Parameterhttp://en.wikipedia.org/wiki/Parameterhttp://en.wikipedia.org/wiki/Two-dimensionalhttp://en.wikipedia.org/wiki/Two-dimensionalhttp://en.wikipedia.org/wiki/Two-dimensionalhttp://en.wikipedia.org/wiki/Signal_(electrical_engineering)http://en.wikipedia.org/wiki/Digital_image_processinghttp://en.wikipedia.org/wiki/Optical_engineeringhttp://en.wikipedia.org/wiki/Analog_image_processinghttp://en.wikipedia.org/wiki/Analog_image_processinghttp://en.wikipedia.org/wiki/Algorithmhttp://en.wikipedia.org/wiki/Image_processinghttp://en.wikipedia.org/wiki/Digital_imagehttp://en.wikipedia.org/wiki/Digital_imagehttp://en.wikipedia.org/wiki/Digital_imagehttp://en.wikipedia.org/wiki/Digital_signal_processinghttp://en.wikipedia.org/wiki/Multidimensional_Systemshttp://en.wikipedia.org/wiki/Multidimensional_Systemshttp://en.wikipedia.org/wiki/Electrical_engineeringhttp://en.wikipedia.org/wiki/Computer_sciencehttp://en.wikipedia.org/wiki/Signal_processinghttp://en.wikipedia.org/wiki/Photographhttp://en.wikipedia.org/wiki/Video_framehttp://en.wikipedia.org/wiki/Video_framehttp://en.wikipedia.org/wiki/Outputhttp://en.wikipedia.org/wiki/Parameterhttp://en.wikipedia.org/wiki/Two-dimensionalhttp://en.wikipedia.org/wiki/Signal_(electrical_engineering)http://en.wikipedia.org/wiki/Digital_image_processinghttp://en.wikipedia.org/wiki/Optical_engineeringhttp://en.wikipedia.org/wiki/Analog_image_processinghttp://en.wikipedia.org/wiki/Analog_image_processinghttp://en.wikipedia.org/wiki/Algorithmhttp://en.wikipedia.org/wiki/Image_processinghttp://en.wikipedia.org/wiki/Digital_imagehttp://en.wikipedia.org/wiki/Digital_signal_processinghttp://en.wikipedia.org/wiki/Multidimensional_Systems -
8/22/2019 Rnt Final Major1
2/50
Separating text and non-text doodles 2012
The PGM format is a lowest common denominator grayscale file format. It isdesigned to be extremely easy to learn and write programs for.
A PGM image represents a grayscale graphic image. There are many pseudo-PGM
formats in use where everything is as specified herein except for the meaning of
individual pixel values. For most purposes, a PGM image can just be thought of an
array of arbitrary integers, and all the programs in the world that think they're
processing a grayscale image can easily be tricked into processing something else.
The name "PGM" is an acronym derived from "Portable Gray Map."
A PGM file consists of a sequence of one or more PGM images. There are no data,
delimiters, or padding before, after, or between images.
Each PGM image consists of the following:
1. A "magic number" for identifying the file type. A pgm image's magic number
is the two characters "P5".
2. Whitespace (blanks, TABs, CRs, LFs).
3. A width, formatted as ASCII characters in decimal.
4. Whitespace.
5. A height, again in ASCII decimal.
6. Whitespace.
7. The maximum gray value (Maxval), again in ASCII decimal. Must be less
than 65536, and more than zero.
8. A single whitespace character (usually a newline).
9. A raster of Height rows, in order from top to bottom. Each row consists of
Width gray values, in order from left to right. Each gray value is a number
from 0 through Maxval, with 0 being black and Maxval being white. Each
gray value is represented in pure binary by either 1 or 2 bytes. If the Maxval is
less than 256, it is 1 byte. Otherwise, it is 2 bytes. The most significant byte is
first.
A row of an image is horizontal. A column is vertical. The pixels in the image are
square and contiguous.
2 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
3/50
Separating text and non-text doodles 2012
1.2 Literature Survey
Many methods have been proposed for extracting text from cluttered background
and segmenting the document image. One of the best known methods is
that of Wong, Casey and Wahl, with its many adaptations and improvements.
However, whereas RLSA filtering has proved its efficiency in segmenting
textual documents, its use in graphics-rich documents is less frequent;
one of the few methods we are aware of is that of Lu other methods used for
text-rich documents include those based on white streams and the top-down
methods using some kind of X_Y decomposition of the document.
In the special case of forms, text often touches the graphics, but the latter
are mainly horizontal and vertical lines, which give the possibility to explicitly
look for these kinds of lines, with techniques such as the Hough transform, for
instance .
But in the general case of graphical documents, lines are more complex and
all these approaches are not very efficient. In this case, we are aware of three
basic families of methods for separating text and graphics:
1. Some authors perform directional morphological filtering to locate all linear
shapes and thus separate them from the other shapes, which are considered
to be text. This works especially well for simple maps, although it
remains to be seen how scalable the approach is when the complexity of the
drawing grows.
2. Similarly, other authors look for the lines, either on the distance transform, or
on a vectorization of the document image .
3 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
4/50
Separating text and non-text doodles 2012
3. A third approach, used by many people, is based on the analysis of the
connected components, which are filtered through a set of rules for
determining to which layer they belong. One of the best known algorithms for
performing this was proposed by Fletcher and Kasturi. This method has
proved to scale remarkably well with increasingly complex documents,
although it is of course not able to directly separate text which is touching the
graphics.
1.3 Problem Definition
Handwritten manuscripts contain graphics and images combined with text
which often overlap one another. The aim of the project is to separate textual
information from non-textual doodles of poet Tagores manuscripts. Connected
Component Labeling forms the first stage followed by the computation of the total no
of pixels and the total boundary pixels that constitute each connected-component.This
calculated values are further processed to obtain the desired output.
1.4 Analysis of the Problem and the SRS
1.4.1 Analysis of the Problem
The separation of text and the non-text doodles from ancienthandwritten manuscripts is a challenging task due to the large variations in writing
styles and document image quality. Specifically, our focus is on handwritten
documents that prove to be a very complex and challenging domain for any automatic
recognition, retrieval or separation system. The challenges lie in the following
respects:
1. Large variability in handwriting samples
2. Poor image quality
1.4.2 Software Requirement Specification
Software Used:
Visual Studio 2010
Irfanview
Windows 7
Hardware Used:
4 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
5/50
Separating text and non-text doodles 2012
256MB RAM
5 GB Hard Disk
P4 processor
1.5 Project Plan and Gantt Chart
Fig 1:Gantt Chart
5 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
6/50
Separating text and non-text doodles 2012
2. FUNCTIONAL REQUIREMENTS
2.1 Read:
Input : A input image in PGM format.
Output : A 2-D matrix representing the input image.
Method: It reads the image and creates a 2-D matrix representing 0's and 1's.
2.2 Totalcount:
Input : A 2-D matrix representing the connected components
Output : A matrix representing the density of each component.
Method: It computes the total no of pixels that each component is made of.The result
is stored in matrix.
2.3 Boundary:
Input : A 2-D matrix represnting the connected components.
Output : A matrix representing the no of boundary pixel values for each connected
componenet.
Method: It computes the total number of boundary values for each connectedcomponent in the input matrix.
6 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
7/50
Separating text and non-text doodles 2012
2.4 Reset:
Input : A 2-D matrix representing the connected components.
Output : A binary 2-D matrix.
Method: It resets the component labeled matrix to the binary matrix for processing it
again.
2.5 Optimize:
Input : A labelled matrix representing the connected components.
A user choice Threshold value. .Output : A matrix representing the non-textual information.
Method: It compares the totalcount of each connected component with the threshold
entered by the user.This function treats the connected component with total count less
than the threshold as text
2.6 Components:
Input : A binary 2-D matrix representing the input image.
Output : A 2-D matrix representing the connected components.
Method: It computes the different components and sub-components in the image.It
returns a labelled matrix that represnts different connected components.
7 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
8/50
Separating text and non-text doodles 2012
3. ALGORITHM
3.1 AlGO NAME : Main
Algo Description : Seaparate the text from non-text doodles
Input : Image
Output : Text and doodles
Variable Description : dataArray1[ ][ ], dataArray[ ][ ]
Datatype : Integer,Character
Step 0: Start
Step 1:Read filename with the extension
Step 2: Run loop from i=0 to imageheight do
Step 3: Run loop from j=0 to imagewidth do
Step 4: Binarize the array
4.1: Store the pixel value in dataArray[i][j]
4.2: If dataArray[i][j] is equal to 255
4.2.1: Then dataArray1[i][j] equal to 1
4.2.2: Else dataArray1[i][j] equal to 0
Step 5: Call components(imageheight,imagewidth)
Step 6: Call totalcount(imageheight,imagewidth)
Step 7: Call optimize(imageheight,imagewidth)
Step 8: Call reset(imageheight,imagewidth)
Step 9: Call components(imageheight,imagewidth)
Step 10: Call totalcount(imageheight,imagewidth)
8 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
9/50
Separating text and non-text doodles 2012
Step 11: Read threshold value
Step 12: If threshold value is less than 1 break
Step 13: Run loop from i=0 to imageheight
Step 14: Run loop from j=0 to imagewidth
Step 15: If dataArray[i][j] is equal to 1
15.1: Write 255 to the doodle file
15.2: Else write 0 to the doodle file
Step 16: If dataArray[i][j] is equal to 0 and dataArray1[i][j] is equal to 1
16.1: Write 0 to the text
16.2: Else write 255 to the text
Step 18: Repeat from step 8 till value not equal to 0
Step 19: Return 0
Step 20: Stop
9 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
10/50
Separating text and non-text doodles 2012
3.2 AlGO NAME : Totalcount
Algo Description : Read the image and identify all the pixels in the image
Input : Image
Output : Total pixels
Variable Description : dataArray1[ ][ ],tot[ ][ ]
Datatype : Integer
Assumption : Image represented by its equivalent binary representation
1 represents empty space
0 represents presence of black pixel
Step 0: Start
Step 1: Run loop from i=0 to row size do
Step 2: Rum loop from j=0 to coloumn size do
Step 3: Check for the black pixel
3.1: If dataArray1[i][j] is not equal to white pixel
3.1.1: Increment tot[dataArray1[i][j]]
Step 4: Return 1
Step 5: Stop
10 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
11/50
Separating text and non-text doodles 2012
3.3 AlGO NAME : Boundary
Algo Description : Read the image and identify the boundary of the image
Input : Image
Output : Boundary pixels
Variable Description : dataArray1[ ][ ]
Datatype : Integer
Assumption : Image represented by its equivalent binary representation
1 represents empty space
0 represents presence of black pixel
Step 0: Start
Step 1: Run loop from i=0 to row size do
Step 2: Rum loop from j=0 to column size do
Step 3: Check for the boundary pixel
3.1: If dataArray1[i][j] is not equal to white pixel
3.1.1: if i>0 and j>0
3.1.1.1: If dataArray1[i-1][j-1] not equal to dataarray1[i][j]
Flag is 1
3.1.2: if i>0
3.1.2.1: If dataArray1[i-1][j] not equal to dataarray1[i][j]
Flag is 1
3.1.3: if i>0 and j
-
8/22/2019 Rnt Final Major1
12/50
Separating text and non-text doodles 2012
3.1.4: if j>0
3.1.4.1: If dataArray1[i][j-1] not equal to dataarray1[i][j]
Flag is 1
3.1.5: if
-
8/22/2019 Rnt Final Major1
13/50
Separating text and non-text doodles 2012
3.4 AlGO NAME : Reset
Algo Description : Reset all the pixels to white and black pixel
Input : 2-D Array
Output : 2-D Array representing 0 and 1
Variable Description : dataArray1[ ][ ], tot[ ], bound[ ],parent[ ]
Datatype : Integer
Assumption : 1 represents empty space
0 represents presence of black pixel
Step 0: Start
Step 1: Run loop from i=0 to row size do
Step 2: Run loop from j=0 to coloumn size do
Step 3: Converting 2-D array in 0 and 1
3.1: If dataArray1[i][j] is not equal to white pixel i.e. 1
3.1.1: Equate dataArray1[i][j] by black pixel i.e. 0
Step 4: Run loop from i=0 to 45000
4.1: Equate tot[i] to 0
4.2: Equate bound[i] to 0
Step 5: Run loop from i=0 to 45000
5.1: Equate parent[i] to 0
Step 6: Return 1
Step 7: Stop
13 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
14/50
Separating text and non-text doodles 2012
3.5 AlGO NAME : Optimize
Algo Description : Optimize the number of pixel in the image
Input : 2-D Array
Output : 2-D Array representing 0 and 1
Variable Description : dataArray1[ ][ ], tot[ ]
Datatype : Integer
Assumption : 1 represents empty space
0 represents presence of black pixel
Step 0: Start
Step 1: Run loop from i=0 to row size do
Step 2: Run loop from j=0 to coloumn size do
Step 3: Optimizing the pixel value
3.1: If dataArray1[i][j] is not equal to white pixel i.e. 1
3.1.1: If tot[dataArray[i][j]] is less than or equal to threshold value
3.1.1.1: Equate dataArray1[i][j] to white pixel i.e. 1
Step 4: Return 1
Step 5: Stop
14 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
15/50
Separating text and non-text doodles 2012
3.6 AlGO NAME : Components
Algo Description : Read the image and identify the each component of the image
Input : Image
Output : Components of the image
Variable Description : dataArray1[ ][ ],arr[ ],parent[ ]
Datatype : Integer
Assumption : Image represented by its equivalent binary representation
1 represents empty space
0 represents presence of black pixel
Step 0: Start
Step 1: Run loop from i=0 to row size do
Step 2: Run loop from j=0 to column size do
Step 3: If dataArray1[i][j] not equal to white pixel
3.1: Equate arr[0],arr[1],arr[2],arr[3],arr[4],arr[5],arr[6],arr[7] to white pixel
and min by 0
3.2: If dataArray1[i-1][j-1] not equal to white pixel
3.2.1: Equate arr[0] by dataArray1[i-1][j-1] and min by arr[0]
3.3: If dataArray1[i-1][j] not equal to white pixel
3.3.1: Equate arr[1] by dataArray1[i-1][j] and min by arr[1]
3.4: If dataArray1[i-1][j+1] not equal to white pixel
3.4.1: Equate arr[2] by dataArray1[i-1][j+1] and min by arr[2]
3.5: If dataArray1[i][j-1] not equal to white pixel
3.5.1: Equate arr[3] by dataArray1[i][j-1] and min by arr[3]
15 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
16/50
Separating text and non-text doodles 2012
3.6: If dataArray1[i][j+1] not equal to white pixel
3.6.1: Equate arr[4] by dataArray1[i][j+1] and min by arr[4]
3.7: If dataArray1[i+1][j-1] not equal to white pixel
3.7.1: Equate arr[5] by dataArray1[i+1][j-1] and min by arr[5]
3.8: If dataArray1[i+1][j] not equal to white pixel
3.8.1: Equate arr[6] by dataArray1[i+1][j] and min by arr[6]
3.9: If dataArray1[i+1][j+1] not equal to white pixel
3.9.1: Equate arr[7] by dataArray1[i+1][j+1] and min by arr[7]
3.10: If arr[i] is greater than 1 where i=0 to 7
3.10.1: Equate min by (arr[i]+1)
3.10.2: From k=0 to 7
3.10.3: If arr[k] is less than min and arr[k] is greater than 1
3.10.3.1: Equate min by arr[k]
3.10.4: Equate dataArray1[i][j] by min
3.11: Equate dataArray1[i][j] by c and increment value of c
Step 4: Run loop from i=0 to row size do
Step 5: Run loop from j=0 to column size do
Step 6: If dataArray1[i][j] not equal to white pixel
6.1: Equate arr[0],arr[1],arr[2],arr[3],arr[4],arr[5],arr[6],arr[7] to white pixel
and min by 0
6.2: If dataArray1[i-1][j-1] is greater than white pixel
3.2.1: Equate arr[0] by dataArray1[i-1][j-1] and min by arr[0]
6.3: If dataArray1[i-1][j] is greater than white pixel
3.3.1: Equate arr[1] by dataArray1[i-1][j] and min by arr[1]
6.4: If dataArray1[i-1][j+1] is greater than white pixel
3.4.1: Equate arr[2] by dataArray1[i-1][j+1] and min by arr[2]
6.5: If dataArray1[i][j-1] is greater than white pixel
3.5.1: Equate arr[3] by dataArray1[i][j-1] and min by arr[3]
6.6: If dataArray1[i][j+1] is greater than white pixel
3.6.1: Equate arr[4] by dataArray1[i][j+1] and min by arr[4]
6.7: If dataArray1[i+1][j-1] is greater than white pixel
3.7.1: Equate arr[5] by dataArray1[i+1][j-1] and min by arr[5]
6.8: If dataArray1[i+1][j] is greater than white pixel
16 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
17/50
Separating text and non-text doodles 2012
3.8.1: Equate arr[6] by dataArray1[i+1][j] and min by arr[6]
6.9: If dataArray1[i+1][j+1] is greater than white pixel
3.9.1: Equate arr[7] by dataArray1[i+1][j+1] and min by arr[7]
Step 7: Run loop from i=45000 to 1
Step 8: While parent[parent[i]] not equal to 0
8.1: Equate min by parent[i] and parent[i] by parent[min]
Step 9: Run loop from i=0 to row size
Step 10: Run loop from i=0 to column size
Step 11: If parent[dataArray1[i][j] not equal to 0
11.1: Equate dataArray1[i][j] by parent[dataArray1[i][j]]
Step 12: Return value of c
Step 13: Stop
17 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
18/50
Separating text and non-text doodles 2012
3.7 AlGO NAME : Read
Ago Description : Reading an image in pgm format
Input : File name
Output : Image height,width and total pixel
Variable Description : buffer[ ]
Datatype : Integer
Step 0: Start
Step 1: Run loop from i=0 to 132 do
1.1: Equate buffer[i] by null value
Step 2: Read line of data from filename to buffer
Step 3: If P2 or P5 or P6 substring is not there within the buffer
3.1: Display error as it is not the pgm format
Step 4: Read line of data from filename to buffer
Step 5: Read a data from the filename to buffer
Step 6: Image width, height and total pixel was displayed
Step 7: Stop
18 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
19/50
Separating text and non-text doodles 2012
4. FLOWCHART
4.1 Main
No
Yes
19 Sikkim Manipal Institute
of Technology
Start
Read the file name
Store the pixel value in
If dataArray[i]
[j] is 255
dataArra [i][ ] e ual to 1
dataArray[i][j]
equal to 0
Components(height,wi
dth)
Totalcount(height,widt
h)
Optimize(height,width)
-
8/22/2019 Rnt Final Major1
20/50
Separating text and non-text doodles 2012
Yes
No
Yes No
20 Sikkim Manipal Institute
of Technology
Reset(height,width)
Component(height,wid
th)
Totalcount(height,widt
h)
Read threshold
value
If
threshold
is less
than 1
Break
dataArray[i]
[j]==1
Write 255 to the doodle
file
Write 0 to the
doodle file
STOP
-
8/22/2019 Rnt Final Major1
21/50
Separating text and non-text doodles 2012
Fig 2: Flowchart for main
4.2 Totalcount
No
Yes
Fig 3: Flowchart for Totalcount
21 Sikkim Manipal Institute
of Technology
Start
dataArray[i][j]
not equal towhite pixel
Increment tot[dataArray[i]
[j]]
Stop
-
8/22/2019 Rnt Final Major1
22/50
Separating text and non-text doodles 2012
4.3 Boundary
No
Yes
No
Yes
No
Yes
22 Sikkim Manipal Institute
of Technology
Start
dataArray1[i][j]
not equal to
white pixel
dataArray1[i-1][j-
1] not equal to
dataArray[i][j]
Flag=1
dataArray1[i-1][j]
not equal to
dataArray[i][j]
Flag=1
-
8/22/2019 Rnt Final Major1
23/50
Separating text and non-text doodles 2012
No
Yes
No
Yes
No
Yes
No
Yes
23 Sikkim Manipal Institute
of Technology
dataArray1[i-1]
[j+1] not equal to
dataArray[i][j]
Flag=1
dataArray1[i][j-1]
not equal to
dataArray[i][j]
Flag=1
dataArray1[i][j+1]
not equal to
dataArray[i][j]
Flag=1
dataArray1[i+1][j-
1] not equal to
dataArray[i][j]
Flag=1
-
8/22/2019 Rnt Final Major1
24/50
Separating text and non-text doodles 2012
No
Yes
No
Yes
Yes
No
Yes
Fig 4: Flowchart for boundary
24 Sikkim Manipal Institute
of Technology
dataArray1[i+1][j]
not equal to
dataArray[i][j]
Flag=1
dataArray1[i+1]
[j+1] not equal todataArray[i][j]
Flag=1
Flag
not
equal
to 1
Increment bound[dataArray[i][j]]
Stop
dataArray1[i+1]
[j+1] not equal to
dataArray[i][j]
Flag=1
Flag
not
equal
to 1
Increment bound[dataArray[i][j]]
Stop
-
8/22/2019 Rnt Final Major1
25/50
Separating text and non-text doodles 2012
4.4 Reset
No
Yes
No
Yes
25 Sikkim Manipal Institute
of Technology
Start
dataArray1[i][j] not
equal to white pixel
i.e. 1
Equate dataArray1[i][j] to0
I =0
I < 45000
Equate tot[i] to 0
Equate bound[i] to 0
Equate parent[i] to 0
Stop
-
8/22/2019 Rnt Final Major1
26/50
Separating text and non-text doodles 2012
Fig 5: Flowchart for reset
4.5 Optimize
No
Yes
No
Yes
Fig 6: Flowchart for optimize
26 Sikkim Manipal Institute
of Technology
Start
dataArray1[i][j]
not equal to
white pixel
tot[dataArray1[i][j]
less than or equal
to threshold
dataArray1[i][j] equal to white
pixel
Stop
-
8/22/2019 Rnt Final Major1
27/50
Separating text and non-text doodles 2012
4.6 Components
No
Yes
No
Yes
No
Yes
27 Sikkim Manipal Institute
of Technology
dataArray1[i][j]
not equal towhite pixel
dataArray1[i-1][j-
1] not equal to
white pixel
Start
Equate arr[0],arr[1]..arr[7] by
white pixel and min by 0
Equate arr[0] by dataArray[i-1][j-
1] and min by arr[0]
dataArray1[i-1][j]
not equal to
white pixel
Equate arr[1] by dataArray[i-1][j]
and min by arr[1]
-
8/22/2019 Rnt Final Major1
28/50
Separating text and non-text doodles 2012
No
Yes
No
Yes
No
Yes
No
28 Sikkim Manipal Institute
of Technology
dataArray1[i-1]
[j+1] not equal
to white pixel
Equate arr[2] by dataArray[i-1]
[j+1] and min by arr[2]
Equate arr[3] by dataArray[i][j-1]
and min by arr[3]
dataArray1[i][j-1]
not equal to
white pixel
dataArray1[i][j+1]
not equal to
white pixel
Equate arr[4] by dataArray[i]
[j+1] and min by arr[4]
dataArray1[i+1][j-
1] not equal to
white pixel
Equate arr[5] by dataArray[i+1]
[j-1] and min by arr[5]
-
8/22/2019 Rnt Final Major1
29/50
Separating text and non-text doodles 2012
No
Yes
No
Yes
Yes
No
Yes
29 Sikkim Manipal Institute
of Technology
dataArray1[i+1][j]
not equal to
white pixel
Equate arr[6] by dataArray[i+1]
[j] and min by arr[6]
dataArray1[i+1]
[j+1] not equal
to white pixel
Equate arr[7] by dataArray[i+1]
[j+1] and min by arr[7]
arr[i] greater than
1 where I varies
from 0 to 7
Equate min by (arr[i]+1)
From k=0 to 7
arr[k] is less than
min and arr[k] is
greater than 1
From k=0 to 7
-
8/22/2019 Rnt Final Major1
30/50
Separating text and non-text doodles 2012
No
Yes
No
Yes
30 Sikkim Manipal Institute
of Technology
Equate dataArray1[i][j] by min
Equate dataArray1[i][j] by c and
increment value of c
Run loop from i=0 to row size do
Run loop from i=0 to column sizedo
dataArray1[i][j] not
equal to white pixel
Equate arr[0],arr[7] to white
pixel and min by 0
dataArray1[i-1][j-
1] is greater than
white pixel
Equate arr[0] by dataArray[i-1][j-
1] and min by arr[0]
dataArray1[i-1][j]
is greater than
white pixel
Equate arr[1] by dataArray[i-1][j]
and min by arr[1]
-
8/22/2019 Rnt Final Major1
31/50
Separating text and non-text doodles 2012
No
Yes
No
Yes
No
Yes
No
31 Sikkim Manipal Institute
of Technology
dataArray1[i-1]
[j+1] is greater
than white pixel
Equate arr[2] by dataArray[i-1]
[j+1] and min by arr[2]
Equate arr[3] by dataArray[i][j-1]
and min by arr[3]
dataArray1[i][j-1]
is greater than
white pixel
dataArray1[i][j+1]
is greater than
white pixel
Equate arr[4] by dataArray[i]
[j+1] and min by arr[4]
dataArray1[i+1][j-
1] is greater than
white pixel
Equate arr[5] by dataArray[i+1]
[j-1] and min by arr[5]
-
8/22/2019 Rnt Final Major1
32/50
Separating text and non-text doodles 2012
No
Yes
No
Yes
No
Yes
32 Sikkim Manipal Institute
of Technology
dataArray1[i+1][j]
is greater than
white pixel
Equate arr[6] by dataArray[i+1]
[j] and min by arr[6]
dataArray1[i+1]
[j+1] is greater
than white pixel
Equate arr[7] by dataArray[i+1]
[j+1] and min by arr[7]
Run loop from i=45000 to 1
Equate min by parent[i] and
parent[i] by parent[min]
Parent[parent[i]]
not equal to 0
Run loop from i=0 to row size
Run loop from i=0 to column size
-
8/22/2019 Rnt Final Major1
33/50
Separating text and non-text doodles 2012
No
Yes
Fig 7: Flowchart for component
33 Sikkim Manipal Institute
of Technology
Parent[dataArray1
[i][j]] not equal to
0
Equate dataArray1[i][j] byparent[dataArray1[i][j]]
Return value of c
Stop
-
8/22/2019 Rnt Final Major1
34/50
Separating text and non-text doodles 2012
4.7 Read
No
Yes
Fig 7: Flowchart for read
34 Sikkim Manipal Institute
of Technology
Start
Run loop from i=0 to
132
Equate buffer[i] by null
values
Read line of data from
filename to buffer
P2 or P5 or P6
substring not in
buffer
Display Error
Read line of data from
filename to buffer
Read a data from
filename to buffer
Image width,height and
total pixel displayed
Stop
-
8/22/2019 Rnt Final Major1
35/50
Separating text and non-text doodles 2012
INPUT/OUTPUT FOR COMPONENT SEPARATION
ALGORITHM
35 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
36/50
Separating text and non-text doodles 2012
1. Input
36 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
37/50
Separating text and non-text doodles 2012
Output
37 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
38/50
Separating text and non-text doodles 2012
38 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
39/50
Separating text and non-text doodles 2012
2.Input
39 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
40/50
Separating text and non-text doodles 2012
Output
40 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
41/50
Separating text and non-text doodles 2012
41 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
42/50
Separating text and non-text doodles 2012
5. DETAILED TEST PLAN
5.1 Unit Testing:
It was performed on the codes of each of the module separately on the
environment they will be performing. The unit testing was initially performed using
black box testing where the input and output of each of the module was tested without
taking into consideration the details of the codes.
To enhance the results further white box testing was performed using the following
steps:-
1. Statement Coverage:-The statements of the modules were tested by executingevery statement, such that none of the statements had errors which had done
by debugging and compiling every statement.
2. Branch Coverage:- This white box testing was done where only the composite
conditions appearing in each branch of each of the modules by assuming true
and false values for the results.
3. Condition Coverage:- The above two white box tests was done for simple
statements and the composite statements appearing within a branch. Here each
component of a conditional expression was tested by using true and false
values.
4. Path Coverage:- With the help of this method, the flow of control within the
programs of each of the module is tested.
After performing unit testing using white box approach on the given code, the
following result was obtained for each of the modules:
42 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
43/50
Separating text and non-text doodles 2012
TEST CASES
MODULE INPUT OUTPUT REMARKS
read()
Image
Image in the
form of matrix
Reads an image in
the form of a
matrix
totalcount()A component
labelled matrixMatrix
Computes the total
number of pixels
of each component
boundary()A component
labelled matrixMatrix
Computes total
boundary value of
each component
reset() A component
labelled matrix
A binary 2-D
matrix
Re-initialize the
matrix
components()Image in the
form of matrix A component
labelled matrix
Label each
connected
component with a
unique number
Table 1.1
43 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
44/50
Separating text and non-text doodles 2012
5.2 Integration Testing:
After performing unit testing on all the modules, they were integrated together
and integration testing was performed using the following steps:
1. Big-bang approach:-In this step all the modules are put together and checked
for errors. If any error occurs it is difficult to detect it, from which module it
has arose, so we go for the next step of integration testing.
2. Top-down approach:-Here the main module of the program is tested
alongwith one or two sub-routines. When the initial modules are found to be
free from errors, the other sub-routines are combined and tested to make the
module error-free.
3. Bottom-Up approach:- Here initially all the sub-modules are tested separately
and then the interfaces connecting the modules are tested alongwith the
complete module.
4. Mixed Testing: It is done using both the top-down and bottom-up approach.
It removes the shortcomings of both the above two sets by testing the
modules whenever they are free. This is the most commonly used method.
The result obtained is:
TEST CASES
MAIN MODULE INPUT OUTPUT REMARKS
optimize() A component
labelled matrix
and A
A matrix
representing
the doodle
Text information
reduction
44 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
45/50
Separating text and non-text doodles 2012
threshold
value
Table 1.2
5.3 System Testing:
Finally after integrating the different modules, system testing is performed to
check for the validity. This is done by using alpha testing, which is done by the
project developers. After all the above tests are performed, it was found that the
program was error free and correct .
45 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
46/50
Separating text and non-text doodles 2012
7. SUMMARY AND CONCLUSIONS
7.1. Summary of achievements:
Labelling of each connected component was successfully implemented. We have successfully developed a code in Visual C++ separating the text from
the non-text (doodles).
The code is user-friendly as a GUI application has been developed to enable the
user to read an image of pgm format and thus obtain the output.
The code developed is simple to understand .
7.2. Difficulties Encountered and how they were tackled:
Difficulties:
Almost all methods are highly sensitive to noise, so the probability of formation
of faulty components in the output image is very high and they fail to the
physical features of the object correctly. Its reason is that they define the
components by the help of differences between two grey levels. So, we had to be
very careful and check many a times using different approaches whether the
components detected are not false ones.
The implementation of the connected component labelling algorithm of the input
image was difficult.
The optimize method to reduce the text information was also difficult to
implement.
How problems were tackled:
46 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
47/50
Separating text and non-text doodles 2012
We studied the various articles and papers that were available to us to improve
connected component labelling algorithms and techniques to optimize the
algorithm .
After the study, we were able to develop a code in Visual C++ showing the actual
implementations of the algorithm .
7.3. Limitations:
It was difficult to differentiate between a noise and a doodle to some extent
If the size of the doodle is relatively small as compared to a text then it might
be treated as a text.
7.4. Future Scope:
This algorithm can be further improved to differentiate easily between a non-
textual (doodle) and textual information of same scale.
47 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
48/50
Separating text and non-text doodles 2012
REFERENCES
[1] G. Deng and L.W. Cahill, An adaptive Gaussian filter for noise reduction and
edge detection, in Proc. IEEE Nucl. Sci. Symp. Med. Im. Conf., 1994, pp. 1615
1619.
[2] I. D. G. Macleod. Comments on Techniques for edge detection.
Proceedings of the IEEE, 1972, 60, p. 344.
[3] J. Canny, A Computational Approach to Edge Detection, IEEE Transaction on
Pattern Analysis and Machine intelligence, 1986, Volume: 8, Issue: 6, Publisher:
Morgan Kaufmann, pp. 679-698
[4] Yuan-Kai Huo, Gen Wei, Yu-Dong Zhang, Le-Nan Wu, An adaptive threshold
for the Canny Operator of edge detection, International Conference on Image
Analysis and Signal Processing (2010), Issue: 1, Publisher: IEEE, Pages: 2-5
48 Sikkim Manipal Institute
of Technology
-
8/22/2019 Rnt Final Major1
49/50
Separating text and non-text doodles 2012
BIBLIOGRAPHY
[1] C.Gonzalez Rafael., University of Tennessee, Richard E. Woods,MedData
Interactive,Digital image processing, Second edition ,10.1.3.Edge detection.
[2] Canny J. F., Finding Edges and Lines in Images, S.M. Thesis, Dept. of
Electrical engineering and Computer Science, M.I.T., Cambridge Mass., 1983.
[3]Kaur Rajwinder, Verma Monika, Kalpna, Kundra Harish,Department of Computer
Science, RIEIT, Railmajra.Classification of various edge detectors.
[4]K. Pratt William, Digital image processing , fourth edition , edge
detection,chapter 15.
[5]Oskoei Mohammadreza and Hu Huosheng, A Survey on Edge Detection
Methods, School of Computer Science & Electronic Engineering, University of
Essex, Colchester CO4 3SQ, United Kingdom
[6]Rosenfeld Azriel and C. Kak Avinash, Digital Picture Processing, Second
Edition,,Volume 2, Harcourt Brace Jovanovich Publishers
[7]http://citeseer.ist.psu.edu/ziou97edge.html.
49 Sikkim Manipal Institute
of Technology
http://citeseer.ist.psu.edu/ziou97edge.htmlhttp://citeseer.ist.psu.edu/ziou97edge.htmlhttp://citeseer.ist.psu.edu/ziou97edge.html -
8/22/2019 Rnt Final Major1
50/50
Separating text and non-text doodles 2012
[8]http://en.wikipedia.org/wiki/Canny_edge_detector
[9]http://en.wikipedia.org/wiki/Edge_detection
http://en.wikipedia.org/wiki/Canny_edge_detectorhttp://en.wikipedia.org/wiki/Canny_edge_detector