Handwritten text recognition with javascript [closed]
Asked Answered
H

1

6

I am trying to implement a system to identify/detect words of a handwritten text in a image. I need to recognize the words in the text. But I feel it is impossible since the images are not readable even for me. For now what I need is to separate out the words. I only need to figure out there is a word. When the user select an area, the system should select only a single word in the image.

My Question is : Is it doable using JavaScript?

Here is a sample Image. enter image description here

Helfrich answered 2/1, 2015 at 9:12 Comment(3)
Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on Stack Overflow. See "Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?. BTW, it's "Thanks in advance", not "Thanks in advanced".Ashore
If you're question is Is it doable using JavaScript?, then answer is yes! It's definitely possible. Doable, in any turing complete language. If you're question is how to do it well that is really a broad question...Andizhan
Useful Google query would be javascript optical character recognition. OCR is not an easy to do thing (usually commercial software) and you may not find a ready to consume open source package. Running the OCR server-side will give you better chances as you will not be constrained by the JavaScript platformLenzi
O
5

JS+Canvas and a basic implementation of the Viola-Jones face-recognition technique.
With some manuscript like that? I think you'll get really bad results.

You need first to detect the global horizontal inclination. (By getting the inclination you can simultaneously retrieve the line height.)
Create a 100% horizontal grid runner like:

0000000000...
1111111111...
0000000000...

where 0 checkes for light and 1 for dark areas. Let it run over your image-selection data from top-to-bottom, and to all inclinations (i.e. +-15deg max).
A positive match is when your (stripes)grid returns the threshold contrast density that matches its raster. If the runner returns no match increase it's size and let it run again.
You need to account for mistakes so you need to store every possible positive match. After you're done with all sizes and inclinations you just pick the one that resulted with more matches.

enter image description here

Now you'll have the general horizontal inclination and the line height.

Now you need to define the vertical letter inclination. At the same time you can retrieve the blank spaces.
Same technique. You let run a vertical runner line-by-line (you know the line-height)

0101010
0101010
0101010
0101010
0101010

starting from 0 left to the most right. No match? change degree. Let run again.
Retrieve the run that collected more matches. You have the letter inclination.
let it run over the same line of text and collect all the information about the highlight gaps between the dark areas.

enter image description here

Outlawry answered 2/1, 2015 at 9:53 Comment(1)
Thank you very much for your support. I am not smart enough to follow your post at this moment. I will research on this. But thank you again for your idea.Helfrich

© 2022 - 2024 — McMap. All rights reserved.