Top Banner
Image to Text Converter BY, DHIRAJ RAJ, MANVENDRA PRIYADARSHI,
21

Image to Text Converter

Feb 17, 2017

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Image to Text Converter

Image to Text Converter

BY, DHIRAJ RAJ,MANVENDRA PRIYADARSHI,

Page 2: Image to Text Converter

Content :

AIM Technology Used Procedure Algo I Algo II Algo III Algo IV (Part 1 & 2) Algo V (Part 1 & 2) Advantage Limitations Conclusion

Page 3: Image to Text Converter

Aim :

To build an application to extract text from image.

Page 4: Image to Text Converter

Technology Used :

Language : Java IDE : NetBeans

Page 5: Image to Text Converter

Procedure :

Step 1 : Firstly, we have change the color of background to be white and the color of text to be black.

Step 2 : Now, we separate every sentence from the given segment. Step 3 : Then, we split each sentence into words. Step 4 : Each word will then split into letters. Step 5 : Now, we convert the obtained letter into 100x100 pixels. Step 6 : Then, we match the letter with predefined strips of co-

ordinate and validate the letter to be specified one. Step 7 : Finally, we display the corresponding letter as an output.

Page 6: Image to Text Converter

Algo I :

To change the color of image, we have used predefined class ‘Color’ which is available in java.awt package.

Color c1 = new Color(255, 255, 255); // for White Color c2 = new Color(0, 0, 0); // for Black

Input : Output :

Page 7: Image to Text Converter

Algo II :

Now, we separate each sentence from the given segment. We start searching horizontally, all the portion of text (in black)

area and count it separately for every horizontal line and store it into an array.

Then we look for that line which has white portion and the previous line should have some text portion and store the co-ordinate of that line into an array.

Then we also look for that line which has white portion and the next line should have some text portion and store the co-ordinate of that line into the same array.

Now, we have the co-ordinates of image from which we need to separate the image.

Page 8: Image to Text Converter

Algo II continues…. We have created an array of BufferedImage type to store the separated

images. BufferedImage imgs[ ] = new BufferedImage[size]; Then we defined the dimension for the portion of image to that array, which

is need to be separated. We used predefined method drawImage() for separating the image.

Output :Input :

Page 9: Image to Text Converter

Algo III :

Now, we split each word from the sentence. We start searching vertically, all the portion of text (in black) area and

count it separately for every vertical line and store it into an array. Then we look for that line which has white portion and the increment

the counter by one until we find a line which has text portion onto it and store value of counter into an array and the co-ordinate of that line into another array and use ‘continue’ keyword to skip that iteration and execute next iteration. Also, assign zero to counter so that it calculate next gap.

Then we find the maximum value from the counter and store the co-ordinate of the corresponding line into an array .

Now, we have the co-ordinates of image from which we need to separate the image.

Page 10: Image to Text Converter

Algo III continues….

Again, we have created an array of BufferedImage type to store the separated images.

BufferedImage imgs[ ] = new BufferedImage[size]; Then we defined the dimension for the portion of image to that array, which

is need to be separated. We used predefined method drawImage() for separating the image.

Input : Output :

Page 11: Image to Text Converter

Algo IV (Part 1 : Font Text)

Now, we split each letter (font text) from the word. We start searching vertically, all the portion of text (in black) area

and count it separately for every vertical line and store it into an array.

Then we look for that line which has white portion and the previous line should have some text portion and we shift the value to adjust the gap then store the co-ordinate of that line into an array.

Now, we have the co-ordinates of image from which we need to separate the image.

Page 12: Image to Text Converter

Algo IV (Part 1 : Font Text) continues….

Again, we have created an array of BufferedImage type to store the separated images.

BufferedImage imgs[ ] = new BufferedImage[size]; Then we defined the dimension for the portion of image to that array, which

is need to be separated. We used predefined method drawImage() for separating the image.

Input : Output :

Page 13: Image to Text Converter

Algo IV (Part 2 : Hand written Text)

Now, we split each letter (hand written text) from the word. We start searching vertically, all the portion of text (in black) area

and count it separately for every vertical line and store it into an array.

Then we look for that line which has minimum portion of text and store the co-ordinate of that line into an array.

We find the line which is next to the stored co-ordinate of minimum portion of text and if it is more than all the minimum portions stored in the array then we shift the value to adjust the gap then store the co-ordinate of that line into another array.

Now, we have the co-ordinates of image from which we need to separate the image.

Page 14: Image to Text Converter

Algo IV (Part 2 : Hand written Text) continues….

Again, we have created an array of BufferedImage type to store the separated images.

BufferedImage imgs[ ] = new BufferedImage[size]; Then we defined the dimension for the portion of image to that array, which

is need to be separated. We used predefined method drawImage() for separating the image.

Input : Output :

Page 15: Image to Text Converter

Algo V (Part 1) :

We convert the obtained image of letter into 100x100 pixels. For this purpose we convert the size of image into 100x100

pixels. We used predefined method drawImage() for changing the pixels

of the image.

Input : Output :

Page 16: Image to Text Converter

Algo V (Part 2) :

We have defined some strips condition for letters (particularly for A, B, C & D).

We match the image with predefined strips of co-ordinate. If the image matches every strips condition then it get validated

for that letter. And, we display the corresponding letter as an output.

Input : Output :

ABCD

Page 17: Image to Text Converter

Advantage :

Image to text converter utility helps in format portability and compatibility that serves the purpose of using conversion from one format to another. In the present scenario, interchangeable formats are more in demand and software developers around the world need utilities that can convert files from one format to another easily and without too much hassle. This is where the ‘Image To Text Converter’ utility comes into play and the benefits of using the same are required. Further, many of the media houses use the converted files to store and retrieve data whenever they need. This helps in files restoring of image files at one's convenience making life easier for everyone in the process.

Page 18: Image to Text Converter

Limitations :

The first co-ordinate (0,0) of the image should not be the portion of text.

The handwritten text extracting process is successful for few letters yet.

The joining portion of the hand written text should not have more thickness.

Page 19: Image to Text Converter

Conclusion :

By this project we can come to the conclusion that we can convert image’s texts into editable text.

Page 21: Image to Text Converter

Thank You