matching.pl - sample use of gestures engine
1.
2.
3.
4.
5.
6.
7.
8.
STDOUT
(the strokes are named with numbers in order of recording)
This program is used to try out various normalization / segmentation / matching algorithms.
Look at the following for details on the algorithms themselves:
First of all, it creates a Tk window with a canvas and three buttons: "Match", "Record" and "Clear", with the following bindings:
"Match"
@knows_strokes
"Record"
@known_strokes
"Clear"
ButtonPress-1 on the canvas
B1-Motion on the canvas
ButtonRelease-1 on the canvas
Then it sets up the various parameters for the normalizer, the segmenter and the matcher, and finally calls Tk::MainLoop
.
Initializes @stroke
to the point of ButtonPress, and starts a line ($curline
) in the canvas
Adds the point to @stroke
and to the $curline
Adds the last point to @stroke
After having normalized and segmented the current stroke, calls sub Similarity1::similarity
for each @known_strokes
, printing scores, and keeping track of the "nearest" (i.e. the one with the lowest score).
At the end, prints the index of the best match.
Normalizes and segment the current stroke, and pushes it into @known_strokes
(adding the first point, since the segments are relative).
Just cleans up the canvas.
This code is copyright (C) 2002 Gianni Ceccarelli Released under the GNU LGPL, version 2.1