#Letter tracing

1 messages · Page 1 of 1 (latest)

wide sentinel
#

Hi yall !
I want to do a system like letter tracing, so the user click and draw something
And So i don't really know how to do it... I'm able to draw the path of the user drawing but dunno how to compare to a specific pattern, like how can i know the user draw a O,
My idea i think is to create like a container that will be like a big outline of the letter and if the user go out this container it reset but i don't really know how to do the container (maybe just a hard container with like an array of vector3) and how to compare the position of the mouse and the container...
Someone to help please ?

fluid shell
#

This is a pretty complicated problem if you do it properly

#

This is what it's called formally

wide sentinel
#

oh thanks i didn't know how to explain it easily 😅

fluid shell
#

The simple solution would be to have preset shapes that you've drawn in advance and then simplify the lines drawn by the user so that a point is created every time they turn more than x degrees, then compare the points to your original letter's points. Another approach could be to reduce the letter to a grid, then detect based on which grid squares are covered

#

But neither of those will accurately detect letter if the person's handwriting is weird

#

The grid approach example:

#

err

#

fill in those middle squares

#

whatever, you know what I mean

wide sentinel
#

I forget to precise it but i will not use the classic letter either it will be a unique alphabet... like for exemple an eclair will be a "a" for exemple

fluid shell
#

Another way would be to detect the sequence of turns made by the user's cursor. This would be more accurate and allow for irregular shaped letters but it's going to be pretty complicated to do

#

that's my thoughts

wide sentinel
#

Yea but for exemple if i want to recognize an O and the user draw a oval i want to say oh ok that's a O even if it's really unclear

fluid shell
#

yeah

#

exactly

#

If you do a custom algorithm for each glyph you could handle those cases though

#

Like an O could be a shape where the total angles made by all the turns the user's cursor made = 360

#

or close to it

wide sentinel
#

but if for exemple he does that

fluid shell
#

You can detect if the shape is convex or concave to prevent like a heart shape from detecting

#

just check if any turn is >180

#

If you're gonna do it properly it's gonna be a lot of fiddling by hand

wide sentinel
fluid shell
#

Simplify the line

wide sentinel
#

sry take a bit of time to upload ^^'

fluid shell
#

Only accept segments of a minimum length

#

stuff like that

wide sentinel
#

oh yea

#

i see

fluid shell
#

Combine segments that are sufficiently similar, etc

wide sentinel
#

i start to see how big the problem is...

fluid shell
#

yeaa

#

There's a whole industry based on this xD.

wide sentinel
#

see why xD

fluid shell
#

But I'm sure if you google optical character recognition you'll find some stuff on it

#

surely this is a well explored problem

wide sentinel
#

well anyway i will try to do something thanks

#

yea but i draw some symbol unique

fluid shell
#

you have the advantage of knowing the order and direction the lines were drawn in

#

It should make it way easier than if you were just parsing a 2d image into a shape

wide sentinel
#

and i don't think google can recognise a symbol that is not in his database

fluid shell
#

I'm not telling you to use an existing solution, just saying, there are probably articles written on how OCR works that should be useful knowledge if you're making up your own system