Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recognizing handwritten shapes

I want to recognize handwriting shape and figure out which shape it probably is in the set. Simply saying, if I draw a triangle, the application should recognize it as an triangle. How can I do this using C# or java, any help is appreciated.

Thanks in advance.

These are some of the shapes I need to identify enter image description here

like image 307
Thilina H Avatar asked May 26 '11 13:05

Thilina H


People also ask

How does handwriting recognition work?

First, the handwriting to be recognized is digitized through scanners or cameras. Second, the image of the document is segmented into lines, words, and individual characters. Third, each character is recognized using OCR techniques. Finally, errors are corrected using lexicons or spelling checkers.

Which algorithm is best for handwriting recognition?

Connectionist Temporal Classification(CTC) is an algorithm used to deal with tasks like speech recognition, handwriting recognition etc.

What are current limitations of handwriting recognition?

The issue is that there's a wide range of handwriting – good and bad. This makes it tricky for programmers to provide enough examples of how every character might look. Plus, sometimes, characters look very similar, making it hard for a computer to recognise accurately.


3 Answers

You can try to use OpenCV for that. EmguCV is a good wrapper to OpenCV for .net. Watch for ShapeDetection demo (included in OpenCV)

like image 136
oddy Avatar answered Oct 21 '22 14:10

oddy


If you want to "roll your own" I would suggest the following steps:

First, skeletonize (thin out the image till all the lines are one pixel thick). There are many ways to do this, and it is a well studied problem. Google for more information.

Now, starting at a black pixel, go through and trace out the outline of the image, one pixel at a time. You add each of these segments to a list of segments outlining the shape (each segment will be a simple line from one pixel to its adjacent pixel). Now you have the outline of your shape as a many-sided polygon.

(Possible step at this point: smooth the outline by pulling each vertex closer to the average of its neighbors)

Now, you use a corner detection algorithm to find the corners (take a look here:http://visual.ipan.sztaki.hu/corner/node7.html).

This should be enough to identify the shapes you have listed.

If you want to get smarter, you can also identify the types of edges that exist between corners. If the segment between two corners stays within some threshold of the straight line between them, you treat it as a "straight line" edge. If it doesn't, you treat it as a curving edge.

With corners +straight/curving edge, you probably could detect any of the shapes you are looking for pretty well.

like image 36
Jeremy Salwen Avatar answered Oct 21 '22 14:10

Jeremy Salwen


I'd suggest using a neural network.

You could teach it what the shapes look like.

This is one library for example:

Neural Networks on C#

like image 1
Yochai Timmer Avatar answered Oct 21 '22 13:10

Yochai Timmer