To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / yetilab / feature / feature.yeti @ 225:8e04d298741b

History | View | Annotate | Download (642 Bytes)

1

    
2
module yetilab.feature.feature;
3

    
4
vec = load yetilab.vector.vector;
5
fr = load yetilab.stream.framer;
6

    
7
// Utility functions for feature extractors
8

    
9
magdiff frame1 frame2 =
10
    sum (map2 do a b: abs(a - b) done (vec.list frame1) (vec.list frame2));
11

    
12
emptyFrameFor frames =
13
    vec.zeros
14
        if empty? frames then 0
15
        else vec.length (head frames)
16
        fi;
17

    
18
features featureFunc frames =
19
   (featuresOf prev frames =
20
        case frames of
21
        frame::rest: featureFunc prev frame :. \(featuresOf frame rest);
22
         _: [];
23
        esac;
24
    featuresOf (emptyFrameFor frames) frames);
25

    
26
{ magdiff, emptyFrameFor, features };
27

    
28

    
29