aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.h
blob: 791ed9a7d973234f0ac74fda1e1eb2a7f64b15d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*****************************************************************************************
* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all 
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*****************************************************************************************/

/************************************************************************
 * SVN MACROS
 *
 * $LastChangedDate:  $
 * $Revision:  $
 * $Author:  $
 *
 ************************************************************************/
/************************************************************************
 * FILE DESCR: Definitions for SubStrokeShapeFeature  module
 *
 * CONTENTS:
 *
 * AUTHOR:     Tanmay Mondal
 *
 * DATE:       February 2009
 * CHANGE HISTORY:
 * Author      Date           Description of change
 ************************************************************************/
#ifndef __SUBSTROKESHAPEFEATURE_H
#define __SUBSTROKESHAPEFEATURE_H

#include "LTKShapeFeature.h"

#define NUMBER_OF_SLOPE 5


class SubStrokeShapeFeature : public LTKShapeFeature
{
	/** @name private data members */
	//@{

private:

	/** @brief slope value 
	m_slopeVector slop(five angle)  extracted from one substrokes*/
	vector<float> m_slopeVector;  
	
	/** @brief x value
	m_xComponentOfCenterOfGravity, normalised x - value (by width) of the center of gravity of substrokes*/
	float m_xComponentOfCenterOfGravity;
	
	 /**@brief y value
	 m_yComponentOfCenterOfGravity, normalised y - value (by height) of the center of gravity of substrokes*/
	float m_yComponentOfCenterOfGravity;

	/**  @brief length value 
	m_subStrokeLength, this is the ratio of the total length of the substrokes and the normalised height of the character*/
	float m_subStrokeLength;

	/** @brief Delimiter character  */
    string m_data_delimiter;
	//@}
	
public:
	
	/** @name Constructors and Destructor */
	//@{

	/**
	* Default Constructor.
	*/
	SubStrokeShapeFeature();

    /** Parameterized Constructor */
    SubStrokeShapeFeature(vector<float>& inSlopeVector,float inCgX,float inCgY,float inLength);
    
	/**
	* Default destructor.
	*/
	~SubStrokeShapeFeature();
	
	/**
	* Returns the value of SubStrokeShapeFeature:: m_slopeVector
	*/
	void getSlopeVector(vector<float>& outSlopeVector) const;

	/**
	* Returns the value of SubStrokeShapeFeature::m_subStrokeLength
	*/
	float getSubStrokeLength() const;

	/**
	*	Returns the value of SubStrokeShapeFeature::m_xComponentOfCenterOfGravity
	*/
	float getXcomponentOfCenterOfGravity() const;

	/**
	* Returns the value of SubStrokeShapeFeature::m_yComponentOfCenterOfGravity
	*/
	float getYcomponentOfCenterOfGravity() const;

	/**
	* Sets the value of SubStrokeShapeFeature::m_slopeVector
	*/	
	void setSlopeVector(const vector<float>& inSlopeVector);
	
	/**
	* Set the value of SubStrokeShapeFeature::m_subStrokeLength
	*/
	void setSubStrokeLength(float inSubStrokeLength);

	/**
	* Set the value of SubStrokeShapeFeature::m_xComponentOfCenterOfGravity
	*/
	void setXcomponentOfCenterOfGravity(float inX);

	/**
	* Set the value of SubStrokeShapeFeature::m_yComponentOfCenterOfGravity
	*/
	void setYcomponentOfCenterOfGravity(float inY);


	/**
	* @brief Initializes the SubStrokeShapeFeature from the string passed as parameter.
	*
	* <b>Semantics</b>
	*
	*	- Tokenize the input string on SubStrokeShapeFeature::m_data_delimiter using StringTokenizer::tokenizeString
	*	- Initialize the data members of the class with the tokens returned.
	*
	* @param initString : string& : Reference to the initialization string.
	*
	* @return FAILURE : If the initalization string contains more than two tokens (after tokenizing on AngleShapeFeature::m_data_delimiter)
	* @return SUCCESS : If initialization done without any errors.
	*	
	*/
	int initialize(const string& initString);

	int initialize(const floatVector& initFloatVector);

	/**
	* @brief  Gives the floating point representation of the SubStrokeShapeFeature instance
	*/	
	int toFloatVector(vector<float>& outFloatVec);

    /**
	* @brief  Gives the string representation of the SubStrokeShapeFeature instance
	*/	
	void toString(string& outStrFeat) const;
	

	LTKShapeFeaturePtr clone() const;

    /**
	* @brief  Gives the distance between two SubStrokeShapeFeature instance
	*/	
	void getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const;

		/**
	* @brief Adds two SubStrokeShapeFeature instances.
	*
	* @param secondFeature : LTKShapeFeature* : Base class pointer holding pointer to SubStrokeShapeFeature instance
	*
	* @return LTKShapeFeature* : Pointer to SubStrokeShapeFeature instance holding the result of addition.
	*	
	*/
	int addFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const ;

	/**
	* @brief Subtracts two SubStrokeShapeFeature instances.
	*
	* @param secondFeature : LTKShapeFeature* : Base class pointer holding pointer to SubStrokeShapeFeature instance
	*
	* @return LTKShapeFeature* : Pointer to SubStrokeShapeFeature instance holding the result of subtraction.
	*	
	*/
	int subtractFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const ;

	int scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const ;

	int getFeatureDimension();

	/**
	* Returns the value of the class data member SubStrokeShapeFeature::m_penUp
	*/
	bool isPenUp() const;
};

#endif //#ifndef __SUBSTROKESHAPEFEATURE_H