1 /*
2 * @(#)$Id: SampleBasedAlgorithm.java 736 2009-08-14 09:20:17Z kurmannu $
3 *
4 * Author : Ueli Kurmann, igesture@uelikurmann.ch
5 *
6 * Purpose : Implements methods used by sample based algorithms.
7 *
8 * -----------------------------------------------------------------------
9 *
10 * Revision Information:
11 *
12 * Date Who Reason
13 *
14 * Dec 26, 2006 ukurmann Initial Release
15 * Mar 15, 2007 bsigner Cleanup
16 *
17 * -----------------------------------------------------------------------
18 *
19 * Copyright 1999-2009 ETH Zurich. All Rights Reserved.
20 *
21 * This software is the proprietary information of ETH Zurich.
22 * Use is subject to license terms.
23 *
24 */
25
26 package org.ximtec.igesture.algorithm;
27
28 import java.util.List;
29
30 import org.ximtec.igesture.core.DefaultSampleDescriptor;
31 import org.ximtec.igesture.core.Gesture;
32 import org.ximtec.igesture.core.GestureClass;
33
34 /**
35 * This is an abstract base class for sample based recognition algorithms. All
36 * implementations of this class use samples during the training or recognition
37 * process.
38 *
39 * @version 1.0 Dec 2006
40 * @author Ueli Kurmann, igesture@uelikurmann.ch
41 * @author Beat Signer, signer@inf.ethz.ch
42 */
43 public abstract class SampleBasedAlgorithm extends DefaultAlgorithm {
44
45 /**
46 * Returns the list of samples of a given gesture class. The samples are
47 * extracted from the sample class descriptor.
48 *
49 * @param gestureClass
50 * the gesture class whose samples have to be returned.
51 * @return the samples for the given gesture class.
52 */
53 public <T> List<Gesture<T>> getSamples(GestureClass gestureClass, Class<? extends DefaultSampleDescriptor<T>> type) {
54 final DefaultSampleDescriptor<T> descriptor = gestureClass.getDescriptor(type);
55 return descriptor.getSamples();
56 } // getSamples
57
58 }