Feature extraction algorithms.
Each algorithm works on the HandwrittenData class. They have to be applied like this:
>>> import features
>>> a = HandwrittenData(...)
>>> feature_list = [features.StrokeCount(),
features.ConstantPointCoordinates(strokes=4,
points_per_stroke=20,
fill_empty_with=0)
]
>>> x = a.feature_extraction(feature_list)
Aspect ratio of a recording as a 1 dimensional feature.
Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
Get a fixedsize bitmap of the recording.
Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
Center of mass of a recording as a 2 dimensional feature.
Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
strokes=4 strokes as features. This leads to \(2 \cdot \text{points_per_stroke} \cdot \text{strokes}\) features.
If points is set to 0, the first points_per_stroke point coordinates and the pen_down feature is used. This leads to \(3 \cdot \text{points_per_stroke}\) features.
Parameters:  strokes : int points_per_stroke : int fill_empty_with : float pen_down : boolean pixel_env : int


Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
Get the number of points which are left after applying the Douglas Peucker line simplification algorithm.
Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
Abstract class which defines which methods to implement for features.
Return the length of the list which __call__ will return.
Similar to the ConstantPointCoordinates feature, this feature takes the first n=81 point coordinates. It also has the fill_empty_with=0 to make sure that the dimension of this feature is always the same.
Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
Height of a recording as a a 1 dimensional feature.
Note
This is the current hight. So if the recording was scaled, this will not be the original height.
Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
Ink as a 1 dimensional feature. It gives a numeric value for the amount of ink this would eventually have consumed.
Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
Recurvature is a 1 dimensional, strokeglobal feature for a recording. It is the ratio \(\frac{\text{height}(s)}{\text{length}(s)}\). If length(s) == 0, then the recurvature is defined to be 1.
Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
Get the stroke center of mass coordinates as a 2 dimensional feature.
Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
Stroke count as a 1 dimensional recording.
Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
stroke1  stroke2  stroke3  
stroke1  0  1  0  ... 
stroke2  1  2  0  ... 
stroke3  0  0  0  ... 
...  ...  ...  ...  ... 
Returns values of upper triangular matrix (including diagonal) from left to right, top to bottom.
..warning
This method has an error. It should probably not be used.
Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
The time in milliseconds it took to create the recording. This is a 1 dimensional feature.
Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
Width of a recording as a 1 dimensional feature.
Note
This is the current width. So if the recording was scaled, this will not be the original width.
Get the dimension of the returned feature. This equals the number of elements in the returned list of numbers.
Get features from a list of dictionaries
Parameters:  model_description_features : list of dictionaries 

Examples
>>> l = [{'StrokeCount': None}, {'ConstantPointCoordinates': [{'strokes': 4}, {'points_per_stroke': 81}, {'fill_empty_with': 0}, {'pen_down': False}] } ]
>>> get_features(l)
[StrokeCount, ConstantPointCoordinates
 strokes: 4
 points per stroke: 81
 fill empty with: 0
 pen down feature: False
]
Print the feature_list in a humanreadable form.
Parameters:  feature_list : list

