GestureRecognitionToolkit  Version: 0.1.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
ClassificationSample.cpp
1 /*
2 GRT MIT License
3 Copyright (c) <2012> <Nicholas Gillian, Media Lab, MIT>
4 
5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
6 and associated documentation files (the "Software"), to deal in the Software without restriction,
7 including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in all copies or substantial
12 portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15 LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 */
20 
21 #include "ClassificationSample.h"
22 
23 GRT_BEGIN_NAMESPACE
24 
25 ClassificationSample::ClassificationSample():numDimensions(0),classLabel(0){
26 }
27 
28 ClassificationSample::ClassificationSample(const UINT numDimensions){
29  this->numDimensions = numDimensions;
30  classLabel = 0;
31  sample.resize( numDimensions );
32 }
33 
34 ClassificationSample::ClassificationSample(const UINT classLabel,const VectorFloat &sample){
35  this->classLabel = classLabel;
36  this->sample = sample;
37  this->numDimensions = (UINT)sample.size();
38 }
39 
40 ClassificationSample::ClassificationSample(const ClassificationSample &rhs){
41  this->classLabel = rhs.classLabel;
42  this->sample = rhs.sample;
43  this->numDimensions = rhs.numDimensions;
44 }
45 
46 ClassificationSample::~ClassificationSample(){
47 }
48 
49 bool ClassificationSample::clear(){
50  numDimensions = 0;
51  classLabel = 0;
52  sample.clear();
53  return true;
54 }
55 
56 bool ClassificationSample::set(UINT classLabel,const VectorFloat &sample){
57  this->classLabel = classLabel;
58  this->sample = sample;
59  this->numDimensions = (UINT)sample.size();
60  return true;
61 }
62 
63 bool ClassificationSample::setClassLabel(const UINT classLabel){
64  this->classLabel = classLabel;
65  return true;
66 }
67 
68 bool ClassificationSample::setSample(const VectorFloat &sample){
69  this->sample = sample;
70  this->numDimensions = (UINT)sample.size();
71  return true;
72 }
73 
74 GRT_END_NAMESPACE
virtual bool resize(const unsigned int size)
Definition: Vector.h:133
This class stores the class label and raw data for a single labelled classification sample...