Improved character selector

Andreas Hartmetz ahartmetz at gmail.com
Wed Mar 28 13:11:14 BST 2007


On Wednesday 28 March 2007 12:26:01 Jos van den Oever wrote:
> 2007/3/27, Loïc Corbasson <loic.corbasson at gmail.com>:
> > An even better option would be full-text search, so typing '<', 'less
> > than', or 'math' would return a set of results including the '<' glyph,
> > IMHO.
>
> This is a case where search-by-drawing could shine.
>
That would be a cool feature, but:

Expect to spend a large amount of time figuring out a comparison algorithm...
What I came up with for mouse gestures can be found in 
kdelibs/kdeui/shortcuts/kgesture.cpp, KShapeGesture::distance(), and that is 
a simple case:
- in that application it's a feature to distinguish the directions in which 
lines are drawn.
- shapes are rather simple
- shapes are contiguous.

For glyphs (and reasonable performance), I could suggest
- fatten the lines of all glyphs, perhaps with fuzzy borders
- scale glyphs to fit into a standard box, but don't overdo it - you don't 
want to make a vertical line look like a rectangle
- scale the drawing to the size of glyphs, and also adjust the aspect ratio, 
but not too much.
- add resemblance points for every drawn pixel that lies on a glyph pixel
- subtract resemblance points for every drawn pixel that does not lie on a 
glyph pixel.
-add tweaks until it works, like auto-centering of drawing and glyph for 
glyphs/drawings that consist of a single line

That's not very elegant, and it might not work very well.

The Hough Transform is another, more elegant option (-> wikipedia), but it's 
resource hungry as I understand.

IMHO this problem alone does have the required difficulty for a gsoc project, 
and I'd be very interested in a solution.

> Cheers,
> Jos






More information about the kde-core-devel mailing list