Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocos2d handwriting recognition....HOW...?

i am trying to make a game in which i am tying to implement handwriting recognition,

what i exactly want is that when the user slides his finger on the screen a line should be created wherever he slides the finger and when he lifts his finger i want to check that the image which he created matches to any alphabet(a,b,c...z)and if yes then to which alphabet.

i tried drawing the lines using CGSprites but it is leading to a huge fps drop and later crashing of the app if the user keeps sliding his finger,but i have no idea how to recognize it.

can anyone please till me if this is anyway possible,if yes can you please provide me with some idea of how to approach this.

Thanks in Advance

like image 706
user853676 Avatar asked Jul 20 '11 09:07

user853676


2 Answers

For the line drawing I would suggest using basic OpenGL calls to draw the line. Store the points however you want with every touch moved event and then in the draw function for your node you should setup OpenGL state to meet your line drawing needs...

glEnable(GL_LINE_SMOOTH);
glLineWidth(2.5f);

then iterate over your list of points and use something like

ccDrawLine(pA, pB);

to draw the line between those points.

As for using that data to detect letters, that's a very tricky problem. You might want to look for libraries to do that for you. If you're dead set on doing it yourself, then you should start with looking for research papers on handwriting recognition.

like image 99
Fraser Graham Avatar answered Oct 02 '22 11:10

Fraser Graham


For drawing the line you can also use CCRibbon define a CCRibbon and keep a reference to it you should use a proper image for ribbon

CCRibbon *line = [CCRibbon ribbonWithWidth: image: length: color: fade:];

then in your touch handler when touch moves add new points to CCRibbon

[line addPointAt: width:];

like image 35
Abbas Mousavi Avatar answered Oct 02 '22 11:10

Abbas Mousavi