aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor')
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeature.h224
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.cpp64
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.h102
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.cpp222
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.h94
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/common.pro9
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro13
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.cpp673
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.h267
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.cpp587
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.h112
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.cpp105
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.def3
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.h94
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.pro22
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp103
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def3
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h92
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp340
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h253
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp722
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h97
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro22
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.cpp106
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.def3
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.h110
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.cpp517
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.h199
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.cpp394
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.h70
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/pointfloat.pro22
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.cpp115
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.def3
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.h98
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.cpp675
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.h200
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.cpp1035
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.h139
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/substroke.pro22
39 files changed, 7931 insertions, 0 deletions
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeature.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeature.h
new file mode 100644
index 00000000..c233d3c5
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeature.h
@@ -0,0 +1,224 @@
+/*****************************************************************************************
+* 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: 2011-01-11 13:48:17 +0530 (Tue, 11 Jan 2011) $
+ * $Revision: 827 $
+ * $Author: mnab $
+ *
+ ************************************************************************/
+/************************************************************************
+ * FILE DESCR: function prototype for the LTKShapeFeature class
+ *
+ * CONTENTS:
+ *
+ * AUTHOR: Nidhi Sharma
+ *
+ * DATE: 07-FEB-2007
+ * CHANGE HISTORY:
+ * Author Date Description of change
+ ************************************************************************/
+
+#ifndef __LTKSHAPEFEATURE_H
+#define __LTKSHAPEFEATURE_H
+#include "LTKTypes.h"
+#include "LTKException.h"
+#include "LTKErrorsList.h"
+#include "LTKMacros.h"
+#include "LTKErrors.h"
+#include "LTKShapeFeatureMacros.h"
+
+/**
+ * \defgroup feature_extractor The feature extractor module
+ * <p>
+ * The feature extractor module consists of following directories
+ * - common
+ * - Builds as a static library called <b> featureextractorcommon.lib</b>
+ *
+ * - Various feature extractors viz PointFloatShapeFeatureExtractor
+ * - These feature extractor are built as DLLs
+ *
+ * User can specify the feature extractor name in the classifier config file
+ * and the corresponding extractor is instantiated at run-time.
+ *
+ * </p>
+ */
+
+/** @ingroup feature_extractor
+* @brief An abstract class that defines the interface for a class representing a feature.
+* @class LTKShapeFeature
+* The LTKShapeFeature is the abstract base class. Any class representing a shape feature
+* is derived from the LTKShapeFeature class.
+*/
+class LTKShapeFeature
+{
+public:
+ /** @name Constructors and Destructor */
+ //@{
+
+ /**
+ * Default Constructor.
+ */
+
+ LTKShapeFeature(){};
+
+ /**
+ * Virtual destructor.
+ */
+ virtual ~LTKShapeFeature()
+ {
+ };
+ //@}
+
+ /** @Purely cirtual functions */
+ //@{
+
+ /**
+ * <b>Responsibility</b><br>
+ * This function initializes the instance of type LTKShapeFeature using the initialization string
+ * passed as parameter.
+ *
+ * @param initString : string& : reference to the initialization string.
+ */
+
+ virtual int initialize(const string& initString)=0;
+
+ virtual int initialize(const floatVector& initFloatVector)=0;
+
+ virtual int initialize(floatVector::const_pointer initFloatData, size_t dataSize) { (void)initFloatData; (void)dataSize; return SUCCESS; }
+
+ /**
+ * <b>Responsibility</b><br>
+ * This function returns the character (char*) representation for the instance of type LTKShapeFeature.
+ *
+ * @param p1 : char* : Pointer to the character array.
+ */
+
+ virtual void toString(string& strFeat) const =0;
+
+ /**
+ * <b>Responsibility</b><br>
+ * Creates a new instance of type LTKShapeFeature and initializes it with the calling instance.
+ *
+ * @param none.
+ *
+ * @return LTKShapeFeature* Pointer to the LTKShapeFeature instance
+ */
+
+ virtual LTKShapeFeaturePtr clone() const =0;
+
+ /**
+ * <b>Responsibility</b><br>
+ * Returns the distance between two instances of LTKShapeFeature.
+ *
+ * @param shapeFeaturePtr : LTKShapeFeature* : Pointer to LTKShapeFeature
+ *
+ * @return distance (float) Distance between two instances of LTKShapeFeature class.
+ */
+
+ virtual void getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const = 0;
+
+ //@}
+
+ /**
+ * <b>Responsibility</b><br>
+ * Returns the representation of LTKShapeFeature instance as a vetor of floats.
+ *
+ * @param floatVec : vector<float>& : Reference to the vector of floats.
+ *
+ * @return FAILURE If no implementation is provided by the derived class
+ */
+ virtual int toFloatVector(vector<float>& floatVec) { return FAILURE; }
+
+ /**
+ * <b>Responsibility</b><br>
+ * Returns the representation of LTKShapeFeature instance as a vetor of integers.
+ *
+ *
+ * @param intVec : vector<float>& : Reference to the vector of integers.
+ *
+ * @return FAILURE If no implementation is provided by the derived class
+ */
+ virtual int toIntVector(vector<int>& intVec) { return FAILURE; }
+
+ //ADAPTATION REQUIREMENTS
+
+ /**
+ * <b>Responsibility</b><br>
+ * Adds two instances of type LTKShapeFeature.
+ *
+ * @param secondFeature : LTKShapeFeature* : Pointer to LTKShapeFeature
+ *
+ * @return LTKShapeFeature* : The pointer to LTKShapeFeature holding the result of adding
+ *
+ * @exception LTKErrorsList::EFTR_RPRCLASS_NOIMPLEMENTATION If no implementation is provided by the derived class
+ */
+
+ virtual int addFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const
+ {
+ LTKReturnError(EFTR_RPRCLASS_NOIMPLEMENTATION);
+ }
+
+ /**
+ * <b>Responsibility</b><br>
+ * Subtract two instances of LTKShapeFeature.
+ *
+ *
+ * @param secondFeature : LTKShapeFeature* : Pointer to LTKShapeFeature
+ *
+ * @return LTKShapeFeature* : The pointer to LTKShapeFeature holding the result of subtraction
+ *
+ * @exception LTKErrorsList::EFTR_RPRCLASS_NOIMPLEMENTATION If no implementation is provided by the derived class
+ */
+
+ virtual int subtractFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const
+ {
+ LTKReturnError(EFTR_RPRCLASS_NOIMPLEMENTATION);
+ }
+
+ /**
+ * <b>Responsibility</b><br>
+ * Scales the instance of LTKShapeFeature by the floating point number alpha passed as parameter.
+ *
+ *
+ * @param secondFeature : LTKShapeFeature* : Pointer to LTKShapeFeature
+ *
+ * @return LTKShapeFeature* : The pointer to scaled LTKShapeFeature
+ *
+ * @exception LTKErrorsList::EFTR_RPRCLASS_NOIMPLEMENTATION If no implementation is provided by the derived class
+ */
+
+ virtual int scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const
+ {
+ LTKReturnError(EFTR_RPRCLASS_NOIMPLEMENTATION);
+ }
+
+ virtual int getFeatureDimension() = 0;
+
+ virtual bool isPenUp() const
+ {
+ LTKReturnError(EFTR_RPRCLASS_NOIMPLEMENTATION);
+ }
+
+};
+
+
+#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.cpp
new file mode 100644
index 00000000..1b4e9532
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.cpp
@@ -0,0 +1,64 @@
+/*****************************************************************************************
+* 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: 2007-05-14 13:35:33 +0530 (Mon, 14 May 2007) $
+ * $Revision: 92 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+/************************************************************************
+ * FILE DESCR: Implementation of LTKShapeFeatureExtractor which would be used as
+ * a place holder in LTKShapeFeatureExtractor
+ * for anyone of the implemented feature extractor
+ * which is derived from this class
+ *
+ * CONTENTS:
+ *
+ * AUTHOR:
+ *
+ * DATE:
+ * CHANGE HISTORY:
+ * Author Date Description of change
+ ************************************************************************/
+
+#include "LTKShapeFeatureExtractor.h"
+#include "LTKErrorsList.h"
+
+/**********************************************************************************
+* AUTHOR : Tarun Madan
+* DATE : 07-Aug-2007
+* NAME : convertToTraceGroup
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+int LTKShapeFeatureExtractor::convertFeatVecToTraceGroup(
+ const vector<LTKShapeFeaturePtr>& shapeFeature,
+ LTKTraceGroup& outTraceGroup)
+{
+
+ return(EFTR_RPRCLASS_NOIMPLEMENTATION);
+
+} \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.h
new file mode 100644
index 00000000..51ab4b57
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.h
@@ -0,0 +1,102 @@
+/*****************************************************************************************
+* 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: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $
+ * $Revision: 556 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+/************************************************************************
+ * FILE DESCR: Function prototype for feature extraction module
+ *
+ * CONTENTS:
+ *
+ * AUTHOR: Nidhi Sharma
+ *
+ * DATE: 07-FEB-2007
+ * CHANGE HISTORY:
+ * Author Date Description of change
+ ************************************************************************/
+
+#ifndef __LTKFEATUREEXTRACTOR_H
+#define __LTKFEATUREEXTRACTOR_H
+
+
+#include "LTKTypes.h"
+#include "LTKShapeFeatureMacros.h"
+
+// Forward class declarations
+class LTKTraceGroup;
+class LTKShapeFeature;
+
+/**
+* @ingroup feature_extractor
+* @brief An abstract class which is extended by all the feature extractors.
+* @class LTKShapeFeatureExtractor
+*
+*/
+class LTKShapeFeatureExtractor
+{
+public:
+ /**
+ * <b>Responsibility</b><br>
+ * Extract features from the input TraceGroup passed a parameter.
+ *
+ * <b>Description</b>
+ * <p>
+ * Every feature representation class has a feature extractor associated with it. The feature extractor
+ * extracts the features from the trace group passed as parameter.
+ * </p>
+ *
+ * <p>This function is based on run-time polymorphism.
+ * The pointer to the derived class instances are stored in a vector of base class (<i>LTKShapeFeature</i>) pointers.
+ * </p>
+ *
+ * @return Pointer to the vector of LTKShapeFeature pointers.
+ */
+ virtual int extractFeatures(const LTKTraceGroup& inTraceGroup,
+ vector<LTKShapeFeaturePtr>& outFeatureVec)=0;
+
+ /**
+ * <b>Responsibility</b><br>
+ * Returns the instance of the shape feature class associated with the feature extractor.
+ *
+ * @return Pointer to the shape feature class.
+ *
+ */
+ virtual LTKShapeFeaturePtr getShapeFeatureInstance()=0;
+
+
+ /**
+ * <b>Responsibility</b><br>
+ * Constructs traceGroup based on input LTKShapeFeaturePtr
+ *
+ * @return Pointer to Trace Group.
+ *
+ */
+ virtual int convertFeatVecToTraceGroup(
+ const vector<LTKShapeFeaturePtr>& shapeFeature,
+ LTKTraceGroup& outTraceGroup);
+};
+
+
+#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.cpp
new file mode 100644
index 00000000..07fa2adc
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.cpp
@@ -0,0 +1,222 @@
+/*****************************************************************************************
+* 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: 2009-06-25 16:40:26 +0530 (Thu, 25 Jun 2009) $
+ * $Revision: 778 $
+ * $Author: mnab $
+ *
+ ************************************************************************/
+/************************************************************************
+* FILE DESCR: Implementation for LTKFeatureExtractor factory class
+*
+* CONTENTS:
+* createFeatureExtractor
+*
+* AUTHOR: Nidhi Sharma
+*
+* DATE: December 23, 2004
+* CHANGE HISTORY:
+* Author Date Description of LTKShapeFeatureExtractorFactory
+************************************************************************/
+#include "LTKShapeFeatureExtractorFactory.h"
+#include "LTKMacros.h"
+#include "LTKErrorsList.h"
+#include "LTKException.h"
+#include "LTKLoggerUtil.h"
+#include "LTKErrors.h"
+#include "LTKOSUtil.h"
+#include "LTKOSUtilFactory.h"
+
+/*************************************************************************
+* AUTHOR : Nidhi Sharma
+* DATE : 07-FEB-2007
+* NAME : createFeatureExtractor
+* DESCRIPTION : create method of a factory class
+* ARGUMENTS :
+* RETURNS : Pointer to the instance of LTKShapeFeatureExtractor
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of LTKFeatureExtractor
+*****************************************************************************/
+
+LTKShapeFeatureExtractorFactory::LTKShapeFeatureExtractorFactory()
+{
+}
+
+/***********************************************************************
+* AUTHOR : Nidhi Sharma
+* DATE : 07-FEB-2007
+* NAME : createFeatureExtractor
+* DESCRIPTION : create method of a factory class
+* ARGUMENTS :
+* RETURNS : Pointer to the instance of LTKShapeFeatureExtractor
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of LTKFeatureExtractor
+******************************************************************************/
+int LTKShapeFeatureExtractorFactory::createFeatureExtractor(
+ const string& featureExtractorName,
+ const string& lipiRootPath,
+ const string& lipiLibPath,
+ void** m_libHandlerFE,
+ const LTKControlInfo& controlInfo,
+ LTKShapeFeatureExtractor** outFeatureExtractor)
+{
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "LTKShapeFeatureExtractorFactory::createFeatureExtractor()" << endl;
+
+ string feName = "";
+
+ int errorCode = mapFeatureExtractor(featureExtractorName, feName);
+
+ if (errorCode != SUCCESS)
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR)
+ << getErrorMessage(errorCode)
+ << "LTKShapeFeatureExtractorFactory::createFeatureExtractor:"
+ << endl;
+
+ LTKReturnError(errorCode);
+ }
+
+ errorCode = getFeatureExtractorInst(lipiRootPath, lipiLibPath, feName, m_libHandlerFE,
+ controlInfo, outFeatureExtractor);
+
+ if ( errorCode != SUCCESS)
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR)
+ << getErrorMessage(errorCode) << ":" << feName
+ << "LTKShapeFeatureExtractorFactory::createFeatureExtractor:"
+ << endl;
+
+ LTKReturnError(errorCode);
+ }
+
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "LTKShapeFeatureExtractorFactory::createFeatureExtractor()" << endl;
+
+ return SUCCESS;
+}
+
+/**********************************************************************************
+* AUTHOR : Nidhi Sharma
+* DATE : 11-Dec-2007
+* NAME : getFeatureExtractorInst
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of LTKFeatureExtractor
+*************************************************************************************/
+int LTKShapeFeatureExtractorFactory::getFeatureExtractorInst(
+ const string& lipiRootPath,
+ const string& lipiLibPath,
+ const string& feName,
+ void** m_libHandlerFE,
+ const LTKControlInfo& controlInfo,
+ LTKShapeFeatureExtractor** outFeatureExtractor)
+{
+ FN_PTR_CREATE_SHAPE_FEATURE_EXTRACTOR createFeatureExtractorPtr;
+ void *functionHandle = NULL;
+
+ LTKOSUtil* utilPtr = LTKOSUtilFactory::getInstance();
+
+ int returnVal = utilPtr->loadSharedLib(lipiLibPath, feName, m_libHandlerFE);
+
+
+ if(returnVal != SUCCESS)
+ {
+ LTKReturnError(ELOAD_FEATEXT_DLL);
+ }
+
+ returnVal = utilPtr->getFunctionAddress(*m_libHandlerFE,
+ CREATE_SHAPE_FEATURE_EXTRACTOR,
+ &functionHandle);
+
+ if(returnVal != SUCCESS)
+ {
+ utilPtr->unloadSharedLib(m_libHandlerFE);
+ *m_libHandlerFE = NULL;
+
+ LTKReturnError(EDLL_FUNC_ADDRESS_CREATE_FEATEXT);
+ }
+
+ createFeatureExtractorPtr = (FN_PTR_CREATE_SHAPE_FEATURE_EXTRACTOR)functionHandle;
+
+ int errorCode = createFeatureExtractorPtr(controlInfo, outFeatureExtractor);
+
+ if (errorCode != SUCCESS)
+ {
+ LTKReturnError(errorCode);
+ }
+
+ delete utilPtr;
+ return SUCCESS;
+
+}
+
+/******************************************************************************
+ * AUTHOR : Saravanan
+ * DATE : 24-03-2007
+ * NAME : mapFeatureExtractor
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS :
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+int LTKShapeFeatureExtractorFactory::mapFeatureExtractor(const string& featureExtractorName,
+ string& outFEName)
+{
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "LTKShapeFeatureExtractorFactory::mapFeatureExtractor()" << endl;
+
+ int returnCode = SUCCESS;
+
+ if(LTKSTRCMP(featureExtractorName.c_str(), NAME_POINT_FLOAT_SHAPE_FEATURE_EXTRACTOR) == 0)
+ {
+ outFEName = POINT_FLOAT;
+ }
+ else if(LTKSTRCMP(featureExtractorName.c_str(), NAME_L7_SHAPE_FEATURE_EXTRACTOR) == 0)
+ {
+ outFEName = L7;
+ }
+ else if(LTKSTRCMP(featureExtractorName.c_str(),NAME_NPEN_SHAPE_FEATURE_EXTRACTOR) == 0)
+ {
+ outFEName = NPEN;
+ }
+ else if(LTKSTRCMP(featureExtractorName.c_str(),NAME_SUBSTROKE_SHAPE_FEATURE_EXTRACTOR) == 0)
+ {
+ outFEName = SUBSTROKE;
+ }
+ else
+ {
+ returnCode = EFTR_EXTR_NOT_EXIST;
+ }
+
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "LTKShapeFeatureExtractorFactory::mapFeatureExtractor()" << endl;
+
+ return returnCode;
+}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.h
new file mode 100644
index 00000000..d178d6ef
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.h
@@ -0,0 +1,94 @@
+/*****************************************************************************************
+* 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: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
+ * $Revision: 561 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+/************************************************************************
+ * FILE DESCR: Function prototype for the Factory class LTKShapeFeatureExtractorFactory
+ *
+ * CONTENTS:
+ *
+ * AUTHOR: Nidhi Sharma
+ *
+ * DATE: 07-FEB-2007
+ * CHANGE HISTORY:
+ * Author Date Description of change
+ ************************************************************************/
+
+#ifndef __LTKFEATUREEXTRACTORFACTORY_H
+#define __LTKFEATUREEXTRACTORFACTORY_H
+#include "LTKTypes.h"
+
+#ifndef _WIN32
+#include <dlfcn.h>
+#else
+#include <windows.h>
+#endif
+
+class LTKShapeFeatureExtractor;
+
+/**
+* @ingroup feature_extractor
+* @brief A factory class which return a pointer to the feature extractor.
+* @class LTKShapeFeatureExtractorFactory
+*
+*
+* <p>
+* A factory class which return a pointer to the feature extractor depending
+* on the featureExtractorType passed to it
+* </p>
+*/
+typedef int (*FN_PTR_CREATE_SHAPE_FEATURE_EXTRACTOR)
+ (const LTKControlInfo& controlInfo,
+ LTKShapeFeatureExtractor** outFeatureExtractor);
+
+class LTKShapeFeatureExtractorFactory
+{
+
+public:
+
+ LTKShapeFeatureExtractorFactory();
+
+ int createFeatureExtractor(const string& featureExtractorType,
+ const string& lipiRootPath,
+ const string& lipiLibPath,
+ void** m_libHandlerFE,
+ const LTKControlInfo& controlInfo,
+ LTKShapeFeatureExtractor** outFeatureExtractor);
+
+ int getFeatureExtractorInst(const string& lipiRootPath,
+ const string& lipiLibPath,
+ const string& feName,
+ void** m_libHandlerFE,
+ const LTKControlInfo& controlInfo,
+ LTKShapeFeatureExtractor** outFeatureExtractor);
+
+private:
+ int mapFeatureExtractor(const string& featureExtractorName,
+ string& outFECode);
+};
+
+
+#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/common.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/common.pro
new file mode 100644
index 00000000..ae6ce1d2
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/common.pro
@@ -0,0 +1,9 @@
+TARGET = featureextractorcommon
+include(../../../../lipilib.pri)
+
+INCLUDEPATH += \
+ ../../../../util/lib \
+
+SOURCES += \
+ LTKShapeFeatureExtractorFactory.cpp \
+ LTKShapeFeatureExtractor.cpp
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro
new file mode 100644
index 00000000..538b9f29
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro
@@ -0,0 +1,13 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ common \
+ l7 \
+ npen \
+ pointfloat \
+ substroke
+
+l7.depends = common
+npen.depends = common
+pointfloat.depends = common
+substroke.depends = common
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.cpp
new file mode 100644
index 00000000..16eaaca4
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.cpp
@@ -0,0 +1,673 @@
+/*****************************************************************************************
+* 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: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
+ * $Revision: 423 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+/************************************************************************
+ * FILE DESCR : Implementation of L7ShapeFeature class
+ * AUTHOR : Naveen Sundar G.
+ * DATE : August 30, 2005
+ * CHANGE HISTORY :
+ * Author Date Description of change
+ ************************************************************************/
+
+#include "L7ShapeFeature.h"
+#include "LTKStringUtil.h"
+#include <sstream>
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : L7ShapeFeature
+* DESCRIPTION : Constructor for the L7ShapeFeature class.
+* ARGUMENTS : none
+* RETURNS :
+* NOTES : Initializes the string delimiter used in writing feature values to a file.
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+L7ShapeFeature::L7ShapeFeature():
+m_data_delimiter(",")
+{
+}
+
+/***************************************************************************
+* AUTHOR : Nidhi Sharma
+* DATE : 12-Dec-2007
+* NAME : L7ShapeFeature
+* DESCRIPTION : Parameterized Constructor for the L7ShapeFeature class.
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*****************************************************************************/
+L7ShapeFeature::L7ShapeFeature(float inX, float inY, float inXFirstDerv,
+ float inYFirstDerv, float inXSecondDerv,
+ float inYSecondDerv, float inCurvature,
+ bool inPenUp):
+m_x(inX),
+m_y(inY),
+m_xFirstDerv(inXFirstDerv),
+m_yFirstDerv(inYFirstDerv),
+m_xSecondDerv(inXSecondDerv),
+m_ySecondDerv(inYSecondDerv),
+m_curvature(inCurvature),
+m_penUp(inPenUp),
+m_data_delimiter(",")
+{
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : ~L7ShapeFeature
+* DESCRIPTION : Destructor for the L7ShapeFeature class
+* ARGUMENTS : none
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+L7ShapeFeature::~L7ShapeFeature()
+{
+
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : getX
+* DESCRIPTION : Get method for the x co-ordinate value
+* ARGUMENTS : none
+* RETURNS : X co-ordinate of the shape feature
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+float L7ShapeFeature::getX() const
+{
+ return m_x;
+}
+
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : getY
+* DESCRIPTION : Get method for the y co-ordinate value
+* ARGUMENTS : none
+* RETURNS : Y co-ordinate of the shape feature
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+float L7ShapeFeature::getY() const
+{
+ return m_y;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : getXFirstDerv
+* DESCRIPTION : Get method for the first derivative value along the X axis
+* ARGUMENTS : none
+* RETURNS : First derivative value along the X axis.
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+float L7ShapeFeature::getXFirstDerv() const
+{
+ return m_xFirstDerv;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : getYFirstDerv
+* DESCRIPTION : Get method for the first derivative value along the Y axis
+* ARGUMENTS : none
+* RETURNS : First derivative value along the Y axis.
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+float L7ShapeFeature::getYFirstDerv() const
+{
+ return m_yFirstDerv;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : getXSecondDerv
+* DESCRIPTION : Get method for the second derivative value along the X axis.
+* ARGUMENTS : none
+* RETURNS : Second derivative value along the X axis.
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+float L7ShapeFeature::getXSecondDerv() const
+{
+ return m_xSecondDerv;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : getYSecondDerv
+* DESCRIPTION : Get method for the second derivative value along the Y axis.
+* ARGUMENTS : none
+* RETURNS : Second derivative value along the Y axis.
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+float L7ShapeFeature::getYSecondDerv() const
+{
+ return m_ySecondDerv;
+}
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : getCurvature
+* DESCRIPTION : Get method for the curvature
+* ARGUMENTS : none
+* RETURNS : The curvature value
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+float L7ShapeFeature::getCurvature() const
+{
+ return m_curvature;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : isPenUp
+* DESCRIPTION : Get method for the penUp
+* ARGUMENTS : none
+* RETURNS : The PenUp value
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+* Balaji MNA 01-July-2009 Rename getPenUp to isPenUp
+*************************************************************************************/
+bool L7ShapeFeature::isPenUp() const
+{
+ return m_penUp;
+
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : setX
+* DESCRIPTION : Set method for the X co-ordinate value
+* ARGUMENTS : X co-ordinate value to be set
+* RETURNS : none
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+void L7ShapeFeature::setX(float x)
+{
+ m_x = x;
+}
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : setY
+* DESCRIPTION : Set method for the Y co-ordinate value
+* ARGUMENTS : Y co-ordinate value to be set
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+void L7ShapeFeature::setY(float y)
+{
+ m_y = y;
+}
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : setXFirstDerv
+* DESCRIPTION : Set method for the first derivative along the X axis
+* ARGUMENTS : The first derivative value along the X axis
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+void L7ShapeFeature::setXFirstDerv(float xFirstDerv)
+{
+ m_xFirstDerv = xFirstDerv;
+}
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : setYFirstDerv
+* DESCRIPTION : Set method for the first derivative along the Y axis
+* ARGUMENTS : The first derivative value along the Y axis to be set
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+void L7ShapeFeature::setYFirstDerv(float yFirstDerv)
+{
+ m_yFirstDerv = yFirstDerv;
+}/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : setXSecondDerv
+* DESCRIPTION : Set method for the second derivative along the X axis
+* ARGUMENTS : The second derivative value along the X axis to be set
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+void L7ShapeFeature::setXSecondDerv(float xSecondDerv)
+{
+ m_xSecondDerv = xSecondDerv;
+}
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : setYSecondDerv
+* DESCRIPTION : Set method for the second derivative value along the y axis
+* ARGUMENTS : The second derivative value along the Y axis to be set
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+void L7ShapeFeature::setYSecondDerv(float ySecondDerv)
+{
+ m_ySecondDerv = ySecondDerv;
+}/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : setCurvature
+* DESCRIPTION : This method sets the curvature
+* ARGUMENTS : The curvature value to be set
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+void L7ShapeFeature::setCurvature(float curvature)
+{
+ m_curvature=curvature;
+}
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : setPenUp
+* DESCRIPTION : This method sets the penUp
+* ARGUMENTS : The penUp value to be set
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+void L7ShapeFeature::setPenUp(bool penUp)
+{
+ m_penUp=penUp;
+
+
+}
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : clone
+* DESCRIPTION : Clone method for an L7ShapeFeature object
+* ARGUMENTS : none
+* RETURNS : A copy of the invoking L7ShapeFeature object
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+LTKShapeFeaturePtr L7ShapeFeature::clone() const
+{
+ L7ShapeFeature* l7Inst = new L7ShapeFeature();
+
+ l7Inst->setX(this->getX());
+ l7Inst->setY(this->getY());
+ l7Inst->setXFirstDerv(this->getXFirstDerv());
+ l7Inst->setYFirstDerv(this->getYFirstDerv());
+ l7Inst->setXSecondDerv(this->getXSecondDerv());
+ l7Inst->setYSecondDerv(this->getYSecondDerv());
+ l7Inst->setCurvature(this->getCurvature());
+ l7Inst->setPenUp(this->isPenUp());
+
+ return (LTKShapeFeaturePtr)l7Inst;
+}
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : getDistance
+* DESCRIPTION : Returns the distance between two L7ShapeFeature objects
+* ARGUMENTS : An L7ShapeFeature object the distance of which is to be found from the invoking L7ShapeFeature object
+* RETURNS : The squared Euclidean distance
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+void L7ShapeFeature::getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const
+{
+ float xDiff = 0, yDiff = 0;
+ float xFirstDervDiff=0, yFirstDervDiff=0, xSecondDervDiff=0, ySecondDervDiff=0;
+ float curvatureDiff=0;
+
+ L7ShapeFeature *inFeature = (L7ShapeFeature*)(shapeFeaturePtr.operator ->());
+
+ xDiff = m_x - inFeature->getX();
+ yDiff = m_y - inFeature->getY();
+ xFirstDervDiff = m_xFirstDerv - inFeature->getXFirstDerv();
+ xFirstDervDiff = m_yFirstDerv - inFeature->getYFirstDerv();
+ xSecondDervDiff = m_xSecondDerv - inFeature->getXSecondDerv();
+ ySecondDervDiff = m_ySecondDerv - inFeature->getYSecondDerv();
+ curvatureDiff = m_curvature - inFeature->getCurvature();
+
+ outDistance = ( (xDiff * xDiff) + (yDiff * yDiff) );
+ outDistance += ( (xFirstDervDiff * xFirstDervDiff) + (yFirstDervDiff * yFirstDervDiff) );
+ outDistance += ( (xSecondDervDiff * xSecondDervDiff) + (ySecondDervDiff * ySecondDervDiff) );
+ outDistance += ( (curvatureDiff * curvatureDiff));
+}
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : initialize
+* DESCRIPTION : This method initializes an L7ShapeFeature object from a string
+* ARGUMENTS : The string containing the feature values
+* RETURNS : SUCCESS on successful completion
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+int L7ShapeFeature::initialize(const string& initString)
+{
+ stringVector tokens;
+
+ LTKStringUtil::tokenizeString(initString, m_data_delimiter, tokens);
+
+ //Token size must be eight
+ if(tokens.size() != 8)
+ return FAILURE; //Returning an error
+
+ m_x = LTKStringUtil::convertStringToFloat(tokens[0]);
+ m_y = LTKStringUtil::convertStringToFloat(tokens[1]);
+ m_xFirstDerv = LTKStringUtil::convertStringToFloat(tokens[2]);
+ m_yFirstDerv = LTKStringUtil::convertStringToFloat(tokens[3]);
+ m_xSecondDerv = LTKStringUtil::convertStringToFloat(tokens[4]);
+ m_ySecondDerv = LTKStringUtil::convertStringToFloat(tokens[5]);
+ m_curvature= LTKStringUtil::convertStringToFloat(tokens[6]);
+
+ if(atoi(tokens[7].c_str()) == 1)
+ m_penUp = true;
+ else
+ m_penUp = false;
+
+ return SUCCESS;
+}
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : toString
+* DESCRIPTION : This method prints the components of the feature object a string.
+* ARGUMENTS : pointer to char
+* RETURNS : The feature object in string format
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+void L7ShapeFeature::toString(string& strFeat) const
+{
+ ostringstream tempString;
+
+ tempString << m_x << m_data_delimiter << m_y << m_data_delimiter <<
+ m_xFirstDerv << m_data_delimiter <<
+ m_yFirstDerv << m_data_delimiter <<
+ m_xSecondDerv << m_data_delimiter <<
+ m_ySecondDerv << m_data_delimiter <<
+ m_curvature << m_data_delimiter <<
+ m_penUp ;
+
+
+ strFeat = tempString.str();
+
+}
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : addFeature
+* DESCRIPTION : This method adds the passed L7ShapeFeature object to the invoking L7ShapeFeature object
+* ARGUMENTS : The feature instance to be added
+* RETURNS : The result feature object
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+int L7ShapeFeature::addFeature(const LTKShapeFeaturePtr& secondFeature,
+ LTKShapeFeaturePtr& outResult ) const
+{
+ L7ShapeFeature* resultFeature = new L7ShapeFeature();
+
+ L7ShapeFeature *inFeature = (L7ShapeFeature*)(secondFeature.operator ->());
+
+ resultFeature->setX(m_x + inFeature->getX());
+ resultFeature->setY(m_y + inFeature->getY());
+ resultFeature->setXFirstDerv(m_xFirstDerv + inFeature->getXFirstDerv());
+ resultFeature->setYFirstDerv(m_yFirstDerv + inFeature->getYFirstDerv());
+ resultFeature->setXSecondDerv(m_xSecondDerv + inFeature->getXSecondDerv());
+ resultFeature->setYSecondDerv(m_ySecondDerv + inFeature->getYSecondDerv());
+ resultFeature->setCurvature(m_curvature + inFeature->getCurvature());
+ resultFeature->setPenUp(m_penUp);
+
+ outResult = LTKShapeFeaturePtr(resultFeature);
+
+ return SUCCESS;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : subtractFeature
+* DESCRIPTION : This method subtracts the elements of the passed L7ShapeFeature object from the invoking L7ShapeFeature object.
+* ARGUMENTS :
+* RETURNS : The result feature object
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+int L7ShapeFeature::subtractFeature(const LTKShapeFeaturePtr& secondFeature,
+ LTKShapeFeaturePtr& outResult ) const
+{
+ L7ShapeFeature* resultFeature = new L7ShapeFeature();
+
+ L7ShapeFeature *inFeature = (L7ShapeFeature*)(secondFeature.operator ->());
+
+ resultFeature->setX(m_x-inFeature->getX());
+ resultFeature->setY(m_y-inFeature->getY());
+ resultFeature->setXFirstDerv(m_xFirstDerv - inFeature->getXFirstDerv());
+ resultFeature->setYFirstDerv(m_yFirstDerv - inFeature->getYFirstDerv());
+ resultFeature->setXSecondDerv(m_xSecondDerv - inFeature->getXSecondDerv());
+ resultFeature->setYSecondDerv(m_ySecondDerv - inFeature->getYSecondDerv());
+ resultFeature->setCurvature(m_curvature - inFeature->getCurvature());
+ resultFeature->setPenUp(m_penUp);
+
+ outResult = LTKShapeFeaturePtr(resultFeature);
+
+ return SUCCESS;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : scaleFeature
+* DESCRIPTION : This method mulitplies the elements of the invoking L7ShapeFeature object by alpha.
+* ARGUMENTS : alpha which is the scaling factor
+* RETURNS : The scaled feature object
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+int L7ShapeFeature::scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const
+{
+ L7ShapeFeature* resultFeature = new L7ShapeFeature();
+
+ resultFeature->setX(m_x * alpha);
+ resultFeature->setY(m_y * alpha);
+ resultFeature->setXFirstDerv(m_xFirstDerv * alpha);
+ resultFeature->setYFirstDerv(m_yFirstDerv * alpha);
+ resultFeature->setXSecondDerv(m_xSecondDerv * alpha);
+ resultFeature->setYSecondDerv(m_ySecondDerv * alpha);
+ resultFeature->setCurvature(m_curvature * alpha);
+ resultFeature->setPenUp(m_penUp);
+
+ outResult = LTKShapeFeaturePtr(resultFeature);
+
+ return SUCCESS;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : toFloatVector
+* DESCRIPTION : This method converts the feature instance to a floatVector.
+* ARGUMENTS : The float vector passed by reference
+* RETURNS : 0 on success.
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+int L7ShapeFeature::toFloatVector(floatVector& floatVec)
+{
+ floatVec.push_back(m_x);
+ floatVec.push_back(m_y);
+ floatVec.push_back(m_xFirstDerv);
+ floatVec.push_back(m_yFirstDerv);
+ floatVec.push_back(m_xSecondDerv);
+ floatVec.push_back(m_ySecondDerv);
+ floatVec.push_back(m_curvature);
+
+ if(m_penUp == true)
+ floatVec.push_back(1.0);
+ else
+ floatVec.push_back(0.0);
+
+ return SUCCESS;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : toIntVector
+* DESCRIPTION : This method converts the feature instance to an intVector.
+* ARGUMENTS : The integer vector passed by reference
+* RETURNS : 0 on success.
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+int L7ShapeFeature::toIntVector(intVector& intVec)
+{
+ intVec.push_back(m_x);
+ intVec.push_back(m_y);
+ intVec.push_back(m_xFirstDerv);
+ intVec.push_back(m_yFirstDerv);
+ intVec.push_back(m_xSecondDerv);
+ intVec.push_back(m_ySecondDerv);
+ intVec.push_back(m_curvature);
+ intVec.push_back(m_penUp);
+
+ return SUCCESS;
+}
+
+/***************************************************************************
+* AUTHOR : Nidhi Sharma
+* DATE : 23-Apr-2008
+* NAME : initialize
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author: Date Description:
+
+*****************************************************************************/
+int L7ShapeFeature::initialize(const floatVector& initFloatVector)
+{
+
+ if (initFloatVector.size() == 0)
+ {
+ return FAILURE;
+ }
+
+ m_x = initFloatVector[0];
+ m_y = initFloatVector[1];
+ m_xFirstDerv = initFloatVector[2];
+ m_yFirstDerv = initFloatVector[3];
+ m_xSecondDerv = initFloatVector[4];
+ m_ySecondDerv = initFloatVector[5];
+ m_curvature = initFloatVector[6];
+
+ if(initFloatVector[7] == 1)
+ {
+ m_penUp = true;
+ }
+ else
+ {
+ m_penUp = false;
+ }
+
+ return SUCCESS;
+}
+
+/***************************************************************************
+* AUTHOR : Nidhi Sharma
+* DATE : 23-Apr-2008
+* NAME : getFeatureDimension
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author: Date Description:
+
+*****************************************************************************/
+
+int L7ShapeFeature::getFeatureDimension()
+{
+ return 8;
+}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.h
new file mode 100644
index 00000000..6c767112
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.h
@@ -0,0 +1,267 @@
+/*****************************************************************************************
+* 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: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
+ * $Revision: 423 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+#include "LTKShapeFeature.h"
+
+
+
+/** @ingroup L7ShapeFeatureExtractor
+* @brief The feature representation class for L7 features
+* This class represents X and Y coordinates, Normalized X and Y First Derivatives, Normalized X and Y Second Derivatives and the Curvature values of a point.
+* @class L7ShapeFeature
+*
+*/
+class L7ShapeFeature : public LTKShapeFeature
+{
+ /** @name private data members */
+ //@{
+
+private:
+ /** @brief X value */
+ float m_x;
+
+ /** @brief Y value */
+ float m_y;
+
+ /** @brief Normalized First Derivative w.r.t X */
+ float m_xFirstDerv;
+
+ /** @brief Normalized First Derivative w.r.t Y */
+ float m_yFirstDerv;
+
+ /** @brief Normalized Second Derivative w.r.t X */
+ float m_xSecondDerv;
+
+ /** @brief Normalized Second Derivative w.r.t Y */
+ float m_ySecondDerv;
+
+ /** @brief Curvature value */
+ float m_curvature;
+
+ /** @brief Pen-up information */
+ bool m_penUp;
+
+ /** @brief Delimiter character */
+ string m_data_delimiter;
+ //@}
+
+public:
+
+ /** @name Constructors and Destructor */
+ //@{
+
+ /**
+ * Default Constructor.
+ */
+ L7ShapeFeature();
+
+ /** parameterized constructor
+ */
+ L7ShapeFeature(float inX, float inY, float inXFirstDerv, float inYFirstDerv,
+ float inXSecondDerv, float inYSecondDerv, float inCurvature,
+ bool inPenUp);
+
+ /**
+ * Default destructor.
+ */
+ ~L7ShapeFeature();
+
+ /**
+ * Returns the value of the class data member L7ShapeFeature::m_x
+ */
+ float getX() const;
+
+ /**
+ * Returns the value of the class data member L7ShapeFeature::m_y
+ */
+ float getY() const;
+
+ /**
+ * Returns the value of the class data member L7ShapeFeature::m_xFirstDerv
+ */
+ float getXFirstDerv() const;
+
+ /**
+ * Returns the value of the class data member L7ShapeFeature::m_yFirstDerv
+ */
+ float getYFirstDerv() const;
+
+ /**
+ * Returns the value of the class data member L7ShapeFeature::m_xSecondDerv
+ */
+ float getXSecondDerv() const;
+
+ /**
+ * Returns the value of the class data member L7ShapeFeature::m_ySecondDerv
+ */
+ float getYSecondDerv() const;
+
+ /**
+ * Returns the value of the class data member L7ShapeFeature::m_curvature
+ */
+ float getCurvature() const;
+
+ /**
+ * Returns the value of the class data member L7ShapeFeature::m_penUp
+ */
+ bool isPenUp() const;
+
+ /**
+ * Sets the value of L7ShapeFeature::m_x
+ */
+ void setX(float x);
+
+ /**
+ * Sets the value of L7ShapeFeature::m_y
+ */
+ void setY(float y);
+
+ /**
+ * Sets the value of L7ShapeFeature::m_xFirstDerv
+ */
+ void setXFirstDerv(float xFirstDerv);
+
+ /**
+ * Sets the value of L7ShapeFeature::m_yFirstDerv
+ */
+
+ void setYFirstDerv(float yFirstDerv);
+ /**
+ * Sets the value of L7ShapeFeature::m_xSecondDerv
+ */
+ void setXSecondDerv(float xSecondDerv);
+
+ /**
+ * Sets the value of L7ShapeFeature::m_ySecondDerv
+ */
+ void setYSecondDerv(float ySecondDerv);
+
+ /**
+ * Sets the value of L7ShapeFeature::m_curvature
+ */
+ void setCurvature(float curvature);
+
+ /**
+ * Sets the value of L7ShapeFeature::m_penUp
+ */
+ void setPenUp(bool penUp);
+
+
+ /**
+ * @brief Initializes an instance of L7ShapeFeature from the string passed as parameter.
+ *
+ * <b>Semantics</b>
+ *
+ * - Tokenize the input string on L7ShapeFeature::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 or less than seven tokens (after tokenizing on L7ShapeFeature::m_data_delimiter)
+ * @return SUCCESS : If initialization done without any errors.
+ *
+ */
+
+ //see interface
+ int initialize(const string& initString);
+
+ int initialize(const floatVector& initFloatVector);
+
+ /**
+ * @brief Gives the string representation of the L7ShapeFeature instance
+ */
+ //see interface
+ void toString(string& strFeat) const;
+
+ /**
+ * This method implements the clone pattern and returns a cloned instance of the invoking L7ShapeFeature object
+ */
+ LTKShapeFeaturePtr clone() const;
+
+
+ /**
+ * @brief Computes the Euclidean Distance between two L7ShapeFeature instances.
+ * Computes the square root of ( (m_x-passed_x)^2 + (m_y-passed_y)^2+ (m_xFirstDerv-passed_x1)^2 +(m_yFirstDerv-passed_y1)^2+(m_xSecondDerv-passed_x2)^2+(m_ySecondDerv-passed_y2)^2+(m_curvature-passed_curvature)^2).
+ * @param f : LTKShapeFeature* : Base class pointer holding a pointer to L7ShapeFeature instance from which the distance to the invoking object is to be computed.
+ *
+ * @return float : Distance between two points in the LocalSeven feature representation
+ *
+ */
+ void getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const;
+
+ /**
+ * @brief Adds two L7ShapeFeature instances.
+ * Computes the sum of the member variables of the passed LTKShapeFeature object and the invoking LTKShapeFeature object. The new member variables are stored in a newly created L7ShapeFeature object. Neither the invoking nor the passed object object are changed.
+ * new_x=m_x+ (*secondFeature).m_x;
+ * @param secondFeature : LTKShapeFeature* : Base class pointer holding a pointer to the L7ShapeFeature instance which is to be added to the invoking L7ShapeFeature object.
+ *
+ * @return LTKShapeFeature* : Base class pointer to the L7ShapeFeature instance holding the result of the addition operation.
+ *
+ */
+ int addFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const;
+
+ /**
+ * @brief Subtracts two L7ShapeFeature instances.
+ * Subtracts the member variables of the passed LTKShapeFeature object from the invoking LTKShapeFeature object. The new member variables are stored in a newly created L7ShapeFeature object, which is returned. Neither the invoking nor the passed object object are changed.
+ * new_x=m_x-(*secondFeature).m_x;
+ *
+ * @param secondFeature : LTKShapeFeature* : Base class pointer holding a pointer to the L7ShapeFeature instance which is to be subtracted.
+ *
+ * @return LTKShapeFeature* : Base class pointer to the L7ShapeFeature instance holding the result of the subtraction operation.
+ *
+ */
+ int subtractFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const;
+
+ /**
+ * @brief Scales the L7ShapeFeature feature by a scalar (float value).
+ * Mulitplies all the member variables of the invoking L7ShapeFeature object by alpha. The new member variables are stored in a newly created L7ShapeFeature object, which is returned. The invoking LTKShapeFeature object is not changed.
+ * new_x=alpha*m_x
+ *
+ * @param alpha : float: The float value by which all the member variables should be multiplied.
+ * @return LTKShapeFeature* : Base class pointer to the L7ShapeFeature instance holding the result of the scaling operation .
+ *
+ */
+ int scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const;
+
+ /**
+ * Converts the LocalSeven feature instance into a float vector. The elements of the float vector are m_x,m_y,m_xFirstDerv,m_yFirstDerv,m_xSecondDerv,m_ySecondDerv and m_curvature in this order.
+ * @param floatVec: vector<float>&: The float vector which will contain the member values.
+ * @return int : returns SUCCESS or FAILURE
+ *
+ */
+ int toFloatVector(vector<float>& floatVec);
+
+ /**
+ * Converts the LocalSeven feature instance into a integer vector. The elements of the int vector are m_x,m_y,m_xFirstDerv,m_yFirstDerv,m_xSecondDerv,m_ySecondDerv and m_curvature in this order.
+ * @param intVec: vector<int>&: The int vector which will contain the member values.
+ * @return int : returns SUCCESS or FAILURE
+ *
+ */
+ int toIntVector(vector<int>& intVec);
+
+ int getFeatureDimension();
+};
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.cpp
new file mode 100644
index 00000000..19e6a9c1
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.cpp
@@ -0,0 +1,587 @@
+/*****************************************************************************************
+* 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: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
+ * $Revision: 423 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+/************************************************************************
+ * FILE DESCR: Implementation of RunShaperec tool
+ *
+ * CONTENTS:
+ * extractFeatures
+ * getShapeFeatureInstance
+ * clearFeatureVector
+ * computeDerivativeDenominator
+ * computeDerivative
+ *
+ * AUTHOR: Naveen Sundar G.
+ *
+ * DATE: August 30, 2005
+ * CHANGE HISTORY:
+ * Author Date Description of change
+ ************************************************************************/
+
+
+#include "L7ShapeFeatureExtractor.h"
+#include "L7ShapeFeature.h"
+#include "LTKTraceGroup.h"
+#include "LTKTrace.h"
+#include "LTKChannel.h"
+#include "LTKTraceFormat.h"
+#include "LTKConfigFileReader.h"
+#include "LTKMacros.h"
+#include "LTKException.h"
+#include "LTKErrors.h"
+#include "LTKLoggerUtil.h"
+
+/******************************************************************************
+* AUTHOR : Dinesh M
+* DATE : 1-Oct-2007
+* NAME : L7ShapeFeatureExtractor
+* DESCRIPTION : parameterized constructor
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date
+*******************************************************************************/
+L7ShapeFeatureExtractor::L7ShapeFeatureExtractor(const LTKControlInfo& controlInfo):
+m_radius(FEATEXTR_L7_DEF_RADIUS)
+{
+ string cfgFilePath = "";
+
+ // Config file
+ if ( ! ((controlInfo.lipiRoot).empty()) &&
+ ! ((controlInfo.projectName).empty()) &&
+ ! ((controlInfo.profileName).empty()) &&
+ ! ((controlInfo.cfgFileName).empty()))
+ {
+ // construct the cfg path using project and profile name
+ cfgFilePath = (controlInfo.lipiRoot) + PROJECTS_PATH_STRING +
+ (controlInfo.projectName) + PROFILE_PATH_STRING +
+ (controlInfo.profileName) + SEPARATOR +
+ (controlInfo.cfgFileName) + CONFIGFILEEXT;
+ }
+ else if ( ! ((controlInfo.cfgFilePath).empty() ))
+ {
+ cfgFilePath = controlInfo.cfgFilePath;
+ }
+ else
+ {
+ throw LTKException(EINVALID_PROJECT_NAME);
+ }
+
+ int returnVal = readConfig(cfgFilePath);
+
+ if (returnVal != SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
+ "Error: L7ShapeFeatureExtractor::L7ShapeFeatureExtractor()" <<endl;
+
+ throw LTKException(returnVal);
+ }
+
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "L7ShapeFeatureExtractor::L7ShapeFeatureExtractor()" << endl;
+
+}
+
+/**********************************************************************************
+* AUTHOR : Dinesh M
+* DATE : 1-Oct-2007
+* NAME : readConfig
+* DESCRIPTION : read the config values from cfg file and set member variables
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date
+*************************************************************************************/
+
+int L7ShapeFeatureExtractor::readConfig(const string& cfgFilePath)
+{
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "L7ShapeFeatureExtractor::readConfig()" << endl;
+
+ LTKConfigFileReader* configurableProperties = NULL;
+ string tempStringVar = "";
+
+ try
+ {
+ configurableProperties = new LTKConfigFileReader(cfgFilePath);
+
+ int errorCode = configurableProperties->getConfigValue(L7RADIUS, tempStringVar);
+
+ if( errorCode == SUCCESS)
+ {
+ if (setRadius(atoi((tempStringVar).c_str())) != SUCCESS)
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ ECONFIG_FILE_RANGE << " : " <<
+ getErrorMessage(ECONFIG_FILE_RANGE) <<
+ " L7ShapeFeatureExtractor::readConfig" <<endl;
+
+ throw LTKException(ECONFIG_FILE_RANGE);
+ }
+ }
+ }
+
+ catch(LTKException e)
+ {
+ delete configurableProperties;
+
+ int eCode = e.getErrorCode();
+
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << eCode <<
+ " : " << getErrorMessage(eCode) <<
+ " L7ShapeFeatureExtractor::readConfig" <<endl;
+
+ LTKReturnError(eCode);
+ }
+ delete configurableProperties;
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "L7ShapeFeatureExtractor::readConfig()" << endl;
+
+ return SUCCESS;
+
+}
+
+/**********************************************************************************
+* AUTHOR : Dinesh M
+* DATE : 1-Oct-2007
+* NAME : setRadius
+* DESCRIPTION : set the radius(the size of window) to compute L7 features
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date
+*************************************************************************************/
+int L7ShapeFeatureExtractor::setRadius(int radius)
+{
+ int returnVal = FAILURE;
+
+ if ( radius > 0 )
+ {
+ m_radius = radius;
+ returnVal = SUCCESS;
+ }
+
+ return returnVal;
+}
+
+/**********************************************************************************
+* AUTHOR : Nidhi Sharma
+* DATE : 15-Feb-2008
+* NAME : getRadius
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date
+*************************************************************************************/
+int L7ShapeFeatureExtractor::getRadius()
+{
+ return m_radius;
+}
+
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : extractFeatures
+* DESCRIPTION : Extracts L7 features from a trace group
+* ARGUMENTS : The trace group from which features have to be extracted
+* RETURNS : vector of L7ShapeFeature objects
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+int L7ShapeFeatureExtractor::extractFeatures(const LTKTraceGroup& inTraceGroup,
+ vector<LTKShapeFeaturePtr>& outFeatureVec)
+{
+
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "L7ShapeFeatureExtractor::extractFeatures()" << endl;
+
+ L7ShapeFeature* featurePtr = NULL;
+ float delta;
+ int currentStrokeSize;
+ int numPoints;
+
+ int numberOfTraces = inTraceGroup.getNumTraces();
+
+ if (numberOfTraces == 0 )
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error :" <<
+ EEMPTY_TRACE_GROUP << " : " << getErrorMessage(EEMPTY_TRACE_GROUP) <<
+ "L7ShapeFeatureExtractor::extractFeatures()" << endl;
+
+ LTKReturnError(EEMPTY_TRACE_GROUP);
+ }
+
+
+ LTKTraceVector allTraces = inTraceGroup.getAllTraces();
+ LTKTraceVector::iterator traceIter = allTraces.begin();
+ LTKTraceVector::iterator traceEnd = allTraces.end();
+
+ //the feature vector
+ vector<float> xVec;
+ vector<float> yVec;
+ vector<bool> penUp;
+
+ //concatentating the strokes
+ for (; traceIter != traceEnd ; ++traceIter)
+ {
+ floatVector tempxVec, tempyVec;
+
+ (*traceIter).getChannelValues("X", tempxVec);
+
+ (*traceIter).getChannelValues("Y", tempyVec);
+
+ currentStrokeSize = tempxVec.size();
+
+ if (currentStrokeSize == 0)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error :" <<
+ EEMPTY_TRACE<< " : " << getErrorMessage(EEMPTY_TRACE) <<
+ "L7ShapeFeatureExtractor::extractFeatures()" << endl;
+
+ LTKReturnError(EEMPTY_TRACE);
+ }
+
+ for(int point=0;point<currentStrokeSize;point++)
+ {
+ xVec.push_back(tempxVec[point]);
+ yVec.push_back(tempyVec[point]);
+
+ if(point == currentStrokeSize - 1 )
+ {
+ penUp.push_back(true);
+ }
+ else
+ {
+ penUp.push_back(false);
+ }
+ }
+ }
+ //concatentating the strokes
+
+ numPoints=xVec.size();
+
+ vector<float> normfirstderv_x(numPoints); // Array to store the first normalized derivative w.r.t x
+ vector<float> normfirstderv_y(numPoints); // Array to store the first normalized derivative w.r.t y
+ vector<float> normsecondderv_x(numPoints); // Array to store the second normalized derivative w.r.t x
+ vector<float> normsecondderv_y(numPoints); // Array to store the second normalized derivative w.r.t y
+ vector<float> curvature(numPoints); // Array to store the curvature
+
+ computeDerivative(xVec,yVec,normfirstderv_x,normfirstderv_y,m_radius);
+
+ computeDerivative(normfirstderv_x,normfirstderv_y,normsecondderv_x,normsecondderv_y,m_radius);
+
+ for(int i=0; i<numPoints; ++i)
+ {
+ //computing the curvature
+ delta= sqrt(pow(pow(normfirstderv_x[i],2)+pow(normfirstderv_y[i],2),3));
+ curvature[i]= ((normfirstderv_x[i]*normsecondderv_y[i]) - (normsecondderv_x[i]*normfirstderv_y[i]))/(delta+EPS);
+
+ featurePtr = new L7ShapeFeature(xVec[i], yVec[i],
+ normfirstderv_x[i], normfirstderv_y[i],
+ normsecondderv_x[i], normsecondderv_y[i],
+ curvature[i], penUp[i]);
+ //populating the feature vector
+ outFeatureVec.push_back(LTKShapeFeaturePtr(featurePtr));
+ featurePtr = NULL;
+ }
+
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "L7ShapeFeatureExtractor::extractFeatures()" << endl;
+
+ return SUCCESS;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : getShapeFeatureInstance
+* DESCRIPTION : Returns an L7ShapeFeature instance
+* ARGUMENTS :
+* RETURNS : An L7ShapeFeature instance
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+LTKShapeFeaturePtr L7ShapeFeatureExtractor::getShapeFeatureInstance()
+{
+ LTKShapeFeaturePtr tempPtr(new L7ShapeFeature);
+ return tempPtr;
+}
+
+
+/******************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : Sept-10-2007
+* NAME : convertFeatVecToTraceGroup
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+******************************************************************************/
+int L7ShapeFeatureExtractor::convertFeatVecToTraceGroup(
+ const vector<LTKShapeFeaturePtr>& shapeFeature,
+ LTKTraceGroup& outTraceGroup)
+{
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "L7ShapeFeatureExtractor::convertFeatVecToTraceGroup()" << endl;
+
+ vector<LTKChannel> channels; // channels of a trace
+
+ LTKChannel xChannel("X", DT_INT, true); // x-coordinate channel of the trace
+ LTKChannel yChannel("Y", DT_INT, true); // y-coordinate channel of the trace
+
+ //initializing the channels of the trace
+ channels.push_back(xChannel);
+ channels.push_back(yChannel);
+
+ // composing the trace format object
+ LTKTraceFormat traceFormat(channels);
+
+ vector<float> point; // a point of a trace
+
+ LTKTrace trace(traceFormat);
+
+ for(int count=0;count<(int)shapeFeature.size();count++)
+ {
+ float Xpoint, Ypoint;
+ bool penUp;
+
+ L7ShapeFeature* ptr = (L7ShapeFeature*)(shapeFeature[count].operator ->());
+ Xpoint = ptr->getX();
+ Ypoint = ptr->getY();
+ penUp = ptr->isPenUp();
+
+
+
+ point.push_back(Xpoint);
+ point.push_back(Ypoint);
+
+ trace.addPoint(point);
+ point.clear();
+
+
+ if(penUp == true) // end of a trace, clearing the trace now
+ {
+ outTraceGroup.addTrace(trace);
+ trace.emptyTrace();
+ LTKTrace tempTrace(traceFormat);
+ trace = tempTrace;
+ }
+ }
+
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "L7ShapeFeatureExtractor::convertFeatVecToTraceGroup()" << endl;
+ return SUCCESS;
+
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : computeDerivativeDenominator
+* DESCRIPTION : Computes the denominator to be used in the derivative computation
+* ARGUMENTS : The index used in derivative computation
+* RETURNS : The denominator
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+int L7ShapeFeatureExtractor::computeDerivativeDenominator(int index)
+{
+ int denominator=0;
+
+ for (int i=1;i<=index;i++)
+ {
+
+ denominator=denominator+i*i;
+ }
+ return 2*denominator;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 10-AUGUST-2007
+* NAME : computeDerivative
+* DESCRIPTION : Computes the derivative
+* ARGUMENTS : The input and output vectors. The output vectors are the derivatives of the input vectors
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+void L7ShapeFeatureExtractor::computeDerivative(const vector<float>& xVec,
+ const vector<float>& yVec,
+ vector<float>& dx,
+ vector<float>& dy,
+ int index)
+{
+ int size = xVec.size();
+ int denominator = computeDerivativeDenominator(index);
+ float x,y,diffx,diffy,delta;
+ float firstderv_x,firstderv_y;
+ int i,j;
+
+ if(index<size-index)
+ {
+ for(i=index; i<size-index; ++i)
+ {
+ x= xVec[i];
+ y= yVec[i];
+ diffx=0;
+ diffy=0;
+
+ for( j=1;j<=index;j++)
+ {
+ diffx = diffx + j*(xVec[i+j]-xVec[i-j]) ;
+ diffy = diffy + j*(yVec[i+j]-yVec[i-j]) ;
+ }
+
+ firstderv_x = diffx/denominator;
+ firstderv_y = diffy/denominator;
+ delta = sqrt(pow(firstderv_x,2)+pow(firstderv_y,2));
+ if(delta!=0)
+ {
+ dx[i] = firstderv_x/(delta);
+ dy[i] = firstderv_y/(delta);
+ }
+ else
+ {
+ dx[i] = 0;
+ dy[i] = 0;
+ }
+
+
+ }
+
+ for(i=0;i<index;i++)
+ {
+ x= xVec[i];
+ y= yVec[i];
+ diffx=0;
+ diffy=0;
+
+ for( j=1;j<=index;j++)
+ {
+ diffx = diffx + j*(xVec[i+j]-x) ;
+ diffy = diffy + j*(yVec[i+j]-y) ;
+ }
+ firstderv_x = diffx/denominator;
+ firstderv_y = diffy/denominator;
+ delta = sqrt(pow(firstderv_x,2)+pow(firstderv_y,2));
+ if(delta!=0)
+ {
+ dx[i] = firstderv_x/(delta);
+ dy[i] = firstderv_y/(delta);
+ }
+ else
+ {
+ dx[i] = 0;
+ dy[i] = 0;
+ }
+
+ }
+
+ for(i=size-index;i<=size-1;i++)
+ {
+ x= xVec[i];
+ y= yVec[i];
+ diffx=0;
+ diffy=0;
+
+ for( j=1;j<=index;j++)
+ {
+ diffx = diffx + j*(x-xVec[i-j]) ;
+ diffy = diffy + j*(y-yVec[i-j]) ;
+ }
+ firstderv_x = diffx/denominator;
+ firstderv_y = diffy/denominator;
+ delta = sqrt(pow(firstderv_x,2)+pow(firstderv_y,2));
+ if(delta!=0)
+ {
+ dx[i] = firstderv_x/(delta);
+ dy[i] = firstderv_y/(delta);
+ }
+ else
+ {
+ dx[i] = 0;
+ dy[i] = 0;
+ }
+ }
+ }
+ if(index>size-index)
+ {
+ for(i=0; i<size; ++i)
+ {
+ x= xVec[i];
+ y= yVec[i];
+ diffx=0;
+ diffy=0;
+ if((0<i+j)&(i+j<size))
+ {
+ for( j=1;j<=index;j++)
+ {
+ diffx = diffx + j*(xVec[i+j]-x) ;
+ diffy = diffy + j*(yVec[i+j]-y) ;
+ }
+ }
+ else
+ {
+ for(j=1;j<=index;j++)
+ {
+ diffx = diffx + j*(x-xVec[i-j]) ;
+ diffy = diffy + j*(y-yVec[i-j]) ;
+ }
+ }
+
+ firstderv_x = diffx/denominator;
+ firstderv_y = diffy/denominator;
+ delta = sqrt(pow(firstderv_x,2)+pow(firstderv_y,2));
+ if(delta!=0)
+ {
+ dx[i] = firstderv_x/(delta);
+ dy[i] = firstderv_y/(delta);
+ }
+ else
+ {
+ dx[i] = 0;
+ dy[i] = 0;
+ }
+
+ }
+ }
+}
+
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.h
new file mode 100644
index 00000000..9c48636d
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.h
@@ -0,0 +1,112 @@
+/*****************************************************************************************
+* 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: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
+ * $Revision: 423 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+#include "LTKShapeFeatureExtractor.h"
+/** @ingroup L7ShapeFeatureExtractor
+* @brief The feature extractor for L7 features.
+* @class L7ShapeFeatureExtractor
+*
+*/
+#define FEATEXTR_L7_DEF_RADIUS 2
+
+
+class L7ShapeFeatureExtractor : public LTKShapeFeatureExtractor
+{
+private:
+ int m_radius;
+
+public:
+ /** @brief Constructor for the L7 feature extractor
+ * Gets the cfg file path from the contorInfo
+ * Reads the cfg variables and poputlates the member variables
+ * @param controlInfo: LTKControlInfo : The control information
+ * @return no return value as it is a constructor
+ */
+ L7ShapeFeatureExtractor(const LTKControlInfo& controlInfo);
+
+ /** @brief Extracts L7 features from an LTKTraceGroup
+ * The XY Coordinate values are extracted from the trace gruoup.
+ * Using the coordinate values, normalized first derivatives are computed.
+ * After computing the first derivatives, the normalized second derivatives and the curvature are computed. The second derivative and curvature computation occur simultaneously.
+ * @param inTraceGroup: LTKTraceGroup& : The trace group from which local seven features have to be extracted
+ * @return LTKShapeFeaturePtr* : A vector of pointers to LTKShapeFeature objects. The pointers point to instances of the L7ShapeFeature class. The vector contains local-seven features extracted from the trace group.
+ */
+
+ int extractFeatures(const LTKTraceGroup& inTraceGroup,
+ vector<LTKShapeFeaturePtr>& outFeatureVec);
+
+ /** @brief Returns an instance of the L7ShapeFeature class
+ * @return LTKShapeFeature*: The returned empty L7ShapeFeature instance.
+ */
+ LTKShapeFeaturePtr getShapeFeatureInstance();
+
+ /** @brief Converts a feature vector to trace group
+ * @param shapeFeature : LTKShapeFeaturePtr* : The feature vector to be converted to a trace group.
+ * @param outTraceGroup : LTKTraceGroup& : The output trace group
+ */
+ //see interface
+ int convertFeatVecToTraceGroup(const vector<LTKShapeFeaturePtr>& shapeFeature,
+ LTKTraceGroup& outTraceGroup);
+
+ int getRadius();
+
+private:
+
+ /** @brief Computes the denominator for derivative calculation
+ * @param index : int: The index used in derivative computation
+ * @return int : The denominator used in derivative computation
+ */
+ int computeDerivativeDenominator(int index);
+
+ /** @brief Computes the derivative for two input sequences
+ * @param xVec : vector<float>&: Input x vector.
+ * @param yVec : vector<float>&: Input y vector.
+ * @param dx : vector<float>&: Derivative vector of x
+ * @param dy : vector<float>&: Derivative vector of y
+ * @param index : int : The window size used in derivative computation
+ *
+ */
+ void computeDerivative(const vector<float>& xVec,
+ const vector<float>& yVec,
+ vector<float>& dx,
+ vector<float>& dy,
+ int index);
+
+ /** @brief reads the cfg file and sets the member variables
+ * @param cfgFilePath : const string&: The path of the cfg file to be opened
+ * @return int : The sucess or failure of the function
+ */
+ int readConfig(const string& cfgFilePath);
+
+ /** @validates the value passed and sets the member variable
+ * @param radius : const int: The value of the variable to be set
+ * @return int : The sucess or failure of the function
+ */
+ int setRadius(int radius);
+
+
+};
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.cpp
new file mode 100644
index 00000000..eca6cf84
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.cpp
@@ -0,0 +1,105 @@
+/*****************************************************************************************
+* 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: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
+ * $Revision: 423 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+// l7.cpp : Defines the entry point for the DLL application.
+
+#include "l7.h"
+#include "L7ShapeFeatureExtractor.h"
+#include "LTKShapeFeatureExtractor.h"
+#include "L7ShapeFeature.h"
+#include "LTKErrors.h"
+
+
+#ifdef _WIN32
+#include <windows.h>
+BOOL APIENTRY DllMain( HANDLE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+#endif
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G
+* DATE : 10-Aug-2007
+* NAME : createFeatureExtractor
+* DESCRIPTION : Creates instance of type l7ShapeFeatureExtractor and retuns of type
+ LTKShapeFeatureExtractor. (Acts as a Factory Method).
+* ARGUMENTS :
+* RETURNS : returns an instace of type LTKShapeFeatureExtractor.
+* NOTES :
+* CHANGE HISTORY
+* Author Date Description
+*************************************************************************************/
+int createShapeFeatureExtractor(const LTKControlInfo& controlInfo,
+ LTKShapeFeatureExtractor** outFeatureExtractor)
+{
+ try
+ {
+ *outFeatureExtractor = new L7ShapeFeatureExtractor(controlInfo);
+ }
+ catch(LTKException e)
+ {
+ *outFeatureExtractor = NULL;
+
+ LTKReturnError(e.getErrorCode());
+ }
+
+ return SUCCESS;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G
+* DATE : 10-Aug-2007
+* NAME : deleteShapeFeatureExtractor
+* DESCRIPTION : Destroy the instance by taking the address as its argument.
+* ARGUMENTS : Address of LTKShapeRecognizerFeatureExtractor instnace.
+* RETURNS : Returns 0 on Success
+* NOTES :
+* CHANGE HISTORY
+* Author Date Description
+*************************************************************************************/
+int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *obj)
+{
+ if ( obj != NULL )
+ {
+ delete obj;
+ obj = NULL;
+ }
+
+ return SUCCESS;
+}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.def
new file mode 100644
index 00000000..9a185d39
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.def
@@ -0,0 +1,3 @@
+EXPORTS
+ createShapeFeatureExtractor @1
+ deleteShapeFeatureExtractor @2
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.h
new file mode 100644
index 00000000..c0f64a01
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.h
@@ -0,0 +1,94 @@
+/*****************************************************************************************
+* 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: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
+ * $Revision: 423 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the L7_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// L7_API functions as being imported from a DLL, wheras this DLL sees symbols
+// defined with this macro as being exported.
+#ifdef _WIN32
+#ifdef L7_EXPORTS
+#define L7_API __declspec(dllexport)
+#else
+#define L7_API __declspec(dllimport)
+#endif //ifdef L7_EXPORTS
+#else
+#define L7_API
+#endif //#ifdef _WIN32
+
+#include "LTKTypes.h"
+
+class LTKShapeFeatureExtractor;
+class LTKShapeFeature;
+
+/** @defgroup L7ShapeFeatureExtractor
+*@brief The L7ShapeFeatureExtractor
+*/
+
+/**
+* @ingroup L7ShapeFeatureExtractor
+* @file L7.cpp
+* <p>
+* The functions exported by the DLL
+* - ::createShapeFeatureExtractor
+* - ::deleteShapeFeatureExtractor
+* - ::getCurrentVersion
+* - ::deleteShapeFeaturePtr
+*/
+
+/**
+* @brief Returns a pointer to the instance of L7ShapeFeatureExtractor
+*
+* <p>
+* This function is based on run-time polymorphism. It creates an instance of
+* L7ShapeFeatureExtractor at run-time and returns it as a pointer to the base class <i>LTKShapeFeatureExtractor</i>
+* </p>
+*
+* @param none
+*
+* @return Pointer to LTKShapeFeatureExtractor
+*/
+//extern "C" L7_API int createShapeFeatureExtractor(const LTKControlInfo& controlInfo, LTKShapeFeatureExtractor**);
+extern "C" L7_API int createShapeFeatureExtractor(
+ const LTKControlInfo& controlInfo,
+ LTKShapeFeatureExtractor** outFeatureExtractor);
+
+/**
+* @brief Deletes the feature extractor instance.
+*
+* <p>
+* This function cleans up all the memory allocations done by the feature extractor by calling it's destructor.
+* </p>
+*
+* @param featureExtractorPtr - Pointer to LTKShapeFeatureExtractor.
+*
+* @return 0 on Success
+*/
+
+//smart pointer for LTKShapeFeatureExtractor??
+extern "C" L7_API int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *featureExtractorPtr);
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.pro
new file mode 100644
index 00000000..2372c2cf
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.pro
@@ -0,0 +1,22 @@
+LIPILIBS = ltkcommon ltkutil featureextractorcommon
+include(../../../../lipiplugin.pri)
+
+INCLUDEPATH += \
+ ../../../../util/lib \
+ ../common \
+
+HEADERS += \
+ l7.h \
+ L7ShapeFeature.h \
+ L7ShapeFeatureExtractor.h \
+
+SOURCES += \
+ l7.cpp \
+ L7ShapeFeature.cpp \
+ L7ShapeFeatureExtractor.cpp \
+
+win32 {
+ DEFINES += L7_EXPORTS
+ LIBS += Advapi32.lib
+ #DEF_FILE = l7.def
+}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp
new file mode 100644
index 00000000..1d142230
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp
@@ -0,0 +1,103 @@
+/*****************************************************************************************
+* 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 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: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
+ * $Revision: 423 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+// NPen.cpp : Defines the entry point for the DLL application.
+
+#include "NPen.h"
+#include "NPenShapeFeatureExtractor.h"
+#include "LTKShapeFeatureExtractor.h"
+#include "NPenShapeFeature.h"
+#include "LTKErrors.h"
+
+
+#ifdef _WIN32
+#include <windows.h>
+BOOL APIENTRY DllMain( HANDLE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+#endif
+
+/**********************************************************************************
+* AUTHOR : Bharath A
+* DATE : 12-Jun-2008
+* NAME : createFeatureExtractor
+* DESCRIPTION : Creates instance of type NPenShapeFeatureExtractor and retuns of type
+ LTKShapeFeatureExtractor. (Acts as a Factory Method).
+* ARGUMENTS :
+* RETURNS : returns an instace of type LTKShapeFeatureExtractor.
+* NOTES :
+* CHANGE HISTORY
+* Author Date Description
+*************************************************************************************/
+int createShapeFeatureExtractor(const LTKControlInfo& controlInfo,
+ LTKShapeFeatureExtractor** outFeatureExtractor)
+{
+ try
+ {
+ *outFeatureExtractor = new NPenShapeFeatureExtractor(controlInfo);
+ }
+ catch(LTKException e)
+ {
+ *outFeatureExtractor = NULL;
+
+ LTKReturnError(e.getErrorCode());
+ }
+
+ return SUCCESS;
+}
+
+/**********************************************************************************
+* AUTHOR : Bharath A
+* DATE : 12-Jun-2008
+* NAME : deleteShapeFeatureExtractor
+* DESCRIPTION : Destroy the instance by taking the address as its argument.
+* ARGUMENTS : Address of LTKShapeRecognizerFeatureExtractor instnace.
+* RETURNS : Returns 0 on Success
+* NOTES :
+* CHANGE HISTORY
+* Author Date Description
+*************************************************************************************/
+int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *obj)
+{
+ if ( obj != NULL )
+ {
+ delete obj;
+ obj = NULL;
+ }
+
+ return SUCCESS;
+}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def
new file mode 100644
index 00000000..9a185d39
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def
@@ -0,0 +1,3 @@
+EXPORTS
+ createShapeFeatureExtractor @1
+ deleteShapeFeatureExtractor @2
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h
new file mode 100644
index 00000000..c1a410d7
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h
@@ -0,0 +1,92 @@
+/*****************************************************************************************
+* 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 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: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
+ * $Revision: 423 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the NPen_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// NPen_API functions as being imported from a DLL, wheras this DLL sees symbols
+// defined with this macro as being exported.
+#ifdef _WIN32
+#ifdef NPen_EXPORTS
+#define NPen_API __declspec(dllexport)
+#else
+#define NPen_API __declspec(dllimport)
+#endif //ifdef NPen_EXPORTS
+#else
+#define NPen_API
+#endif //#ifdef _WIN32
+
+#include "LTKTypes.h"
+
+class LTKShapeFeatureExtractor;
+class LTKShapeFeature;
+
+/** @defgroup NPenShapeFeatureExtractor
+*@brief The NPenShapeFeatureExtractor
+*/
+
+/**
+* @ingroup NPenShapeFeatureExtractor
+* @file NPen.cpp
+* <p>
+* The functions exported by the DLL
+* - ::createShapeFeatureExtractor
+* - ::deleteShapeFeatureExtractor
+* - ::getCurrentVersion
+* - ::deleteShapeFeaturePtr
+*/
+
+/**
+* @brief Returns a pointer to the instance of NPenShapeFeatureExtractor
+*
+* <p>
+* This function is based on run-time polymorphism. It creates an instance of
+* NPenShapeFeatureExtractor at run-time and returns it as a pointer to the base class <i>LTKShapeFeatureExtractor</i>
+* </p>
+*
+* @param none
+*
+* @return Pointer to LTKShapeFeatureExtractor
+*/
+//extern "C" NPen_API int createShapeFeatureExtractor(const LTKControlInfo& controlInfo, LTKShapeFeatureExtractor**);
+extern "C" NPen_API int createShapeFeatureExtractor(
+ const LTKControlInfo& controlInfo,
+ LTKShapeFeatureExtractor** outFeatureExtractor);
+
+/**
+* @brief Deletes the feature extractor instance.
+*
+* <p>
+* This function cleans up all the memory allocations done by the feature extractor by calling it's destructor.
+* </p>
+*
+* @param featureExtractorPtr - Pointer to LTKShapeFeatureExtractor.
+*
+* @return 0 on Success
+*/
+
+//smart pointer for LTKShapeFeatureExtractor??
+extern "C" NPen_API int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *featureExtractorPtr);
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp
new file mode 100644
index 00000000..a05867be
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp
@@ -0,0 +1,340 @@
+#include "NPenShapeFeature.h"
+#include "LTKStringUtil.h"
+#include "LTKPreprocDefaults.h"
+
+#include <sstream>
+
+
+NPenShapeFeature::NPenShapeFeature():m_data_delimiter(",")
+ {
+
+ }
+
+
+ NPenShapeFeature::NPenShapeFeature(float inX, float inY, float cosAlpha, float inSinAlpha,
+ float inCosBeta, float inSinBeta, float inAspect, float inCurliness,
+ float inLinearity, float inSlope, bool isPenUp):m_data_delimiter(",")
+ {
+
+ }
+
+
+ NPenShapeFeature::~NPenShapeFeature()
+ {
+
+ }
+
+
+ float NPenShapeFeature::getX() const
+ {
+ return m_x;
+ }
+
+
+ float NPenShapeFeature::getY() const
+ {
+ return m_y;
+ }
+
+
+ float NPenShapeFeature::getCosAlpha() const
+ {
+ return m_cosAlpha;
+ }
+
+
+ float NPenShapeFeature::getSinAlpha() const
+ {
+ return m_sinAlpha;
+ }
+
+
+ float NPenShapeFeature::getCosBeta() const
+ {
+ return m_cosBeta;
+ }
+
+
+ float NPenShapeFeature::getSinBeta() const
+ {
+ return m_sinBeta;
+ }
+
+ float NPenShapeFeature::getAspect() const
+ {
+ return m_aspect;
+ }
+
+
+ float NPenShapeFeature::getCurliness() const
+ {
+ return m_curliness;
+ }
+
+
+ float NPenShapeFeature::getLinearity() const
+ {
+ return m_linearity;
+ }
+
+
+ float NPenShapeFeature::getSlope() const
+ {
+ return m_slope;
+ }
+
+
+ bool NPenShapeFeature::isPenUp() const
+ {
+ return m_isPenUp;
+ }
+
+
+ void NPenShapeFeature::setX(float x)
+ {
+ m_x = x;
+ }
+
+
+ void NPenShapeFeature::setY(float y)
+ {
+ m_y = y;
+ }
+
+
+ void NPenShapeFeature::setCosAlpha(float cosAlpha)
+ {
+ m_cosAlpha = cosAlpha;
+ }
+
+
+ void NPenShapeFeature::setSinAlpha(float sinAlpha)
+ {
+ m_sinAlpha = sinAlpha;
+ }
+
+
+ void NPenShapeFeature::setCosBeta(float cosBeta)
+ {
+ m_cosBeta = cosBeta;
+ }
+
+
+ void NPenShapeFeature::setSinBeta(float sinBeta)
+ {
+ m_sinBeta = sinBeta;
+ }
+
+
+ void NPenShapeFeature::setAspect(float aspect)
+ {
+ m_aspect = aspect;
+ }
+
+ void NPenShapeFeature::setCurliness(float curliness)
+ {
+ m_curliness = curliness;
+ }
+
+ void NPenShapeFeature::setLinearity(float linearity)
+ {
+ m_linearity = linearity;
+ }
+
+ void NPenShapeFeature::setSlope(float slope)
+ {
+ m_slope = slope;
+ }
+
+
+ void NPenShapeFeature::setPenUp(bool isPenUp)
+ {
+ m_isPenUp = isPenUp;
+ }
+
+
+
+ int NPenShapeFeature::initialize(const string& initString)
+ {
+ stringVector tokens;
+ LTKStringUtil::tokenizeString(initString,m_data_delimiter,tokens);
+
+ if(tokens.size() != 11)
+ {
+ return FAILURE;
+ }
+
+ m_x = LTKStringUtil::convertStringToFloat(tokens[0]);
+
+ m_y = LTKStringUtil::convertStringToFloat(tokens[1]);
+
+
+ m_cosAlpha = LTKStringUtil::convertStringToFloat(tokens[2]);
+
+ m_sinAlpha = LTKStringUtil::convertStringToFloat(tokens[3]);
+
+ m_cosBeta = LTKStringUtil::convertStringToFloat(tokens[4]);
+
+ m_sinBeta = LTKStringUtil::convertStringToFloat(tokens[5]);
+
+ m_aspect = LTKStringUtil::convertStringToFloat(tokens[6]);
+
+ m_curliness = LTKStringUtil::convertStringToFloat(tokens[7]);
+
+ m_linearity = LTKStringUtil::convertStringToFloat(tokens[8]);
+
+ m_slope = LTKStringUtil::convertStringToFloat(tokens[9]);
+
+ if(fabs(LTKStringUtil::convertStringToFloat(tokens[10]) - 1.0f) < EPS)
+ {
+ m_isPenUp = true;
+ }
+ else
+ {
+ m_isPenUp = false;
+ }
+
+ return SUCCESS;
+
+
+ }
+
+
+ void NPenShapeFeature::toString(string& strFeat) const
+ {
+ ostringstream tempString;
+
+ tempString << m_x << m_data_delimiter << m_y << m_data_delimiter <<
+ m_cosAlpha << m_data_delimiter <<
+ m_sinAlpha << m_data_delimiter <<
+ m_cosBeta << m_data_delimiter <<
+ m_sinBeta << m_data_delimiter <<
+ m_aspect << m_data_delimiter <<
+ m_curliness << m_data_delimiter <<
+ m_linearity << m_data_delimiter <<
+ m_slope << m_data_delimiter<<
+ m_isPenUp;
+
+ strFeat = tempString.str();
+
+
+ }
+
+
+ LTKShapeFeaturePtr NPenShapeFeature::clone() const
+ {
+ NPenShapeFeature* npenSF = new NPenShapeFeature();
+
+
+ npenSF->setX(this->getX());
+ npenSF->setY(this->getY());
+ npenSF->setCosAlpha(this->getCosAlpha());
+ npenSF->setSinAlpha(this->getSinAlpha());
+ npenSF->setCosBeta(this->getCosBeta());
+ npenSF->setSinBeta(this->getSinBeta());
+ npenSF->setAspect(this->getAspect());
+ npenSF->setCurliness(this->getCurliness());
+ npenSF->setLinearity(this->getLinearity());
+ npenSF->setSlope(this->getSlope());
+ npenSF->setPenUp(this->isPenUp());
+
+
+
+ return (LTKShapeFeaturePtr)npenSF;
+ }
+
+
+
+ void NPenShapeFeature::getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const
+ {
+ outDistance = 0.0;
+
+ NPenShapeFeature *inFeature = (NPenShapeFeature*)(shapeFeaturePtr.operator ->());
+
+ outDistance += (m_x - inFeature->getX())*(m_x - inFeature->getX());
+ outDistance += (m_y - inFeature->getY())*(m_y - inFeature->getY());
+ outDistance += (m_cosAlpha - inFeature->getCosAlpha())*(m_cosAlpha - inFeature->getCosAlpha());
+ outDistance += (m_sinAlpha - inFeature->getSinAlpha())*(m_sinAlpha - inFeature->getSinAlpha());
+ outDistance += (m_cosBeta - inFeature->getCosBeta())*(m_cosBeta - inFeature->getCosBeta());
+ outDistance += (m_sinBeta - inFeature->getSinBeta())*(m_sinBeta - inFeature->getSinBeta());
+ outDistance += (m_aspect - inFeature->getAspect())*(m_aspect - inFeature->getAspect());
+ outDistance += (m_curliness - inFeature->getCurliness())*(m_curliness - inFeature->getCurliness());
+ outDistance += (m_linearity - inFeature->getLinearity())*(m_linearity - inFeature->getLinearity());
+ outDistance += (m_slope - inFeature->getSlope())*(m_slope - inFeature->getSlope());
+ }
+
+
+ int NPenShapeFeature::toFloatVector(vector<float>& floatVec)
+ {
+ floatVec.push_back(m_x);
+ floatVec.push_back(m_y);
+ floatVec.push_back(m_cosAlpha);
+ floatVec.push_back(m_sinAlpha);
+ floatVec.push_back(m_cosBeta);
+ floatVec.push_back(m_sinBeta);
+ floatVec.push_back(m_aspect);
+ floatVec.push_back(m_curliness);
+ floatVec.push_back(m_linearity);
+ floatVec.push_back(m_slope);
+
+ if(isPenUp())
+ {
+ floatVec.push_back(1.0f);
+ }
+ else
+ {
+ floatVec.push_back(0.0f);
+ }
+
+ return SUCCESS;
+ }
+
+
+ int NPenShapeFeature::getFeatureDimension()
+ {
+
+ return 11;
+ }
+
+
+ int NPenShapeFeature::initialize(const floatVector& initFloatVector)
+ {
+
+
+ if(initFloatVector.size() != 11)
+ {
+ return FAILURE;
+ }
+
+ m_x = initFloatVector[0];
+
+ m_y = initFloatVector[1];
+
+
+ m_cosAlpha = initFloatVector[2];
+
+ m_sinAlpha = initFloatVector[3];
+
+ m_cosBeta = initFloatVector[4];
+
+ m_sinBeta = initFloatVector[5];
+
+ m_aspect = initFloatVector[6];
+
+ m_curliness = initFloatVector[7];
+
+ m_linearity = initFloatVector[8];
+
+ m_slope = initFloatVector[9];
+
+ if(fabs(initFloatVector[10] - 1.0f) < EPS)
+ {
+ m_isPenUp = true;
+ }
+ else
+ {
+ m_isPenUp = false;
+ }
+
+ return SUCCESS;
+ }
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h
new file mode 100644
index 00000000..1f9f5f08
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h
@@ -0,0 +1,253 @@
+/*****************************************************************************************
+* 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 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: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
+ * $Revision: 423 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+#include "LTKShapeFeature.h"
+
+#define DELIMITER_SIZE 5
+
+
+/** @ingroup NPenShapeFeatureExtractor
+* @brief The feature representation class for NPen features
+* This class represents NPen++ features such as X, Y, cos/sin alpha, cos/sin beta, aspect, curliness, linearity, slope and pen-up/down bit
+* @class NPenShapeFeature
+*
+*/
+class NPenShapeFeature : public LTKShapeFeature
+{
+ /** @name private data members */
+ //@{
+
+private:
+ /** @brief X value */
+ float m_x;
+
+ /** @brief Y value */
+ float m_y;
+
+
+ float m_cosAlpha;
+
+ float m_sinAlpha;
+
+ float m_cosBeta;
+
+ float m_sinBeta;
+
+ float m_aspect;
+
+ float m_curliness;
+
+ float m_linearity;
+
+ float m_slope;
+
+ bool m_isPenUp;
+
+
+ string m_data_delimiter;
+ //@}
+
+public:
+
+ /** @name Constructors and Destructor */
+ //@{
+
+ /**
+ * Default Constructor.
+ */
+ NPenShapeFeature();
+
+ /** parameterized constructor
+ */
+ NPenShapeFeature(float inX, float inY, float cosAlpha, float inSinAlpha,
+ float inCosBeta, float inSinBeta, float inAspect, float inCurliness,
+ float inLinearity, float inSlope, bool isPenUp);
+
+ /**
+ * Default destructor.
+ */
+ ~NPenShapeFeature();
+
+ /**
+ * Returns the value of the class data member NPenShapeFeature::m_x
+ */
+ float getX() const;
+
+ /**
+ * Returns the value of the class data member NPenShapeFeature::m_y
+ */
+ float getY() const;
+
+ /**
+ * Returns the value of the class data member NPenShapeFeature::m_cosAlpha
+ */
+ float getCosAlpha() const;
+
+ /**
+ * Returns the value of the class data member NPenShapeFeature::m_sinAlpha
+ */
+ float getSinAlpha() const;
+
+ /**
+ * Returns the value of the class data member NPenShapeFeature::m_cosBeta
+ */
+ float getCosBeta() const;
+
+ /**
+ * Returns the value of the class data member NPenShapeFeature::m_sinBeta
+ */
+ float getSinBeta() const;
+
+ /**
+ * Returns the value of the class data member NPenShapeFeature::m_aspect
+ */
+ float getAspect() const;
+
+ /**
+ * Returns the value of the class data member NPenShapeFeature::m_curliness
+ */
+ float getCurliness() const;
+
+ /**
+ * Returns the value of the class data member NPenShapeFeature::m_linearity
+ */
+ float getLinearity() const;
+
+ /**
+ * Returns the value of the class data member NPenShapeFeature::m_slope
+ */
+ float getSlope() const;
+
+ /**
+ * Returns the value of the class data member NPenShapeFeature::m_penUp
+ */
+ bool isPenUp() const;
+
+ /**
+ * Sets the value of NPenShapeFeature::m_x
+ */
+ void setX(float x);
+
+ /**
+ * Sets the value of NPenShapeFeature::m_y
+ */
+ void setY(float y);
+
+ /**
+ * Sets the value of NPenShapeFeature::m_cosAlpha
+ */
+ void setCosAlpha(float cosAlpha);
+
+ /**
+ * Sets the value of NPenShapeFeature::m_sinAlpha
+ */
+ void setSinAlpha(float sinAlpha);
+
+ /**
+ * Sets the value of NPenShapeFeature::m_cosBeta
+ */
+ void setCosBeta(float cosBeta);
+
+ /**
+ * Sets the value of NPenShapeFeature::m_sinBeta
+ */
+ void setSinBeta(float sinBeta);
+
+ /**
+ * Sets the value of NPenShapeFeature::m_aspect
+ */
+ void setAspect(float aspect);
+
+ /**
+ * Sets the value of NPenShapeFeature::m_curliness
+ */
+ void setCurliness(float curliness);
+
+ /**
+ * Sets the value of NPenShapeFeature::m_linearity
+ */
+ void setLinearity(float linearity);
+
+ /**
+ * Sets the value of NPenShapeFeature::m_slope
+ */
+ void setSlope(float slope);
+
+ /**
+ * Sets the value of NPenShapeFeature::m_penUp
+ */
+ void setPenUp(bool penUp);
+
+
+ /**
+ * @brief Initializes an instance of NPenShapeFeature from the string passed as parameter.
+ *
+ * <b>Semantics</b>
+ *
+ * - Tokenize the input string on NPenShapeFeature::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 or less than seven tokens (after tokenizing on NPenShapeFeature::m_data_delimiter)
+ * @return SUCCESS : If initialization done without any errors.
+ *
+ */
+
+ //see interface
+ int initialize(const string& initString);
+
+ /**
+ * @brief Gives the string representation of the NPenShapeFeature instance
+ */
+ //see interface
+ void toString(string& strFeat) const;
+
+ /**
+ * This method implements the clone pattern and returns a cloned instance of the invoking NPenShapeFeature object
+ */
+ LTKShapeFeaturePtr clone() const;
+
+
+
+ void getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const;
+
+ /**
+ * Converts the local feature instance into a float vector. The elements of the float vector are m_x, m_y, m_cosAlpha, m_sinAlpha, m_cosBeta, m_sinBeta, m_aspect, m_curliness, m_linearity, m_slope and m_isPenUp in the order.
+ * @param floatVec: vector<float>&: The float vector which will contain the member values.
+ * @return int : returns SUCCESS or FAILURE
+ *
+ */
+ int toFloatVector(vector<float>& floatVec);
+
+
+ int getFeatureDimension();
+
+
+
+ int initialize(const floatVector& initFloatVector);
+
+
+};
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp
new file mode 100644
index 00000000..e20b63dc
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp
@@ -0,0 +1,722 @@
+/*****************************************************************************************
+* 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 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: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
+ * $Revision: 423 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+/************************************************************************
+ * FILE DESCR: Implementation of RunShaperec tool
+ *
+ * CONTENTS:
+ * extractFeatures
+ * getShapeFeatureInstance
+ * clearFeatureVector
+ *
+ * AUTHOR: Bharath A
+ *
+ * DATE: June 11, 2008
+ * CHANGE HISTORY:
+ * Author Date Description of change
+ ************************************************************************/
+
+
+#include "NPenShapeFeatureExtractor.h"
+#include "NPenShapeFeature.h"
+#include "LTKTraceGroup.h"
+#include "LTKTrace.h"
+#include "LTKChannel.h"
+#include "LTKTraceFormat.h"
+#include "LTKConfigFileReader.h"
+#include "LTKMacros.h"
+#include "LTKException.h"
+#include "LTKErrors.h"
+#include "LTKLoggerUtil.h"
+#include "LTKPreprocDefaults.h"
+
+/******************************************************************************
+* AUTHOR : Dinesh M
+* DATE : 1-Oct-2007
+* NAME : NPenShapeFeatureExtractor
+* DESCRIPTION : parameterized constructor
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date
+*******************************************************************************/
+NPenShapeFeatureExtractor::NPenShapeFeatureExtractor(const LTKControlInfo& controlInfo):
+m_windowSize(FEATEXTR_NPEN_DEF_WINDOW_SIZE)
+{
+ string cfgFilePath = "";
+
+ // Config file
+ if ( ! ((controlInfo.lipiRoot).empty()) &&
+ ! ((controlInfo.projectName).empty()) &&
+ ! ((controlInfo.profileName).empty()) &&
+ ! ((controlInfo.cfgFileName).empty()))
+ {
+ // construct the cfg path using project and profile name
+ cfgFilePath = (controlInfo.lipiRoot) + PROJECTS_PATH_STRING +
+ (controlInfo.projectName) + PROFILE_PATH_STRING +
+ (controlInfo.profileName) + SEPARATOR +
+ (controlInfo.cfgFileName) + CONFIGFILEEXT;
+ }
+ else if ( ! ((controlInfo.cfgFilePath).empty() ))
+ {
+ cfgFilePath = controlInfo.cfgFilePath;
+ }
+ else
+ {
+ throw LTKException(EINVALID_PROJECT_NAME);
+ }
+
+
+ int returnVal = readConfig(cfgFilePath);
+
+ if (returnVal != SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
+ "Error: NPenShapeFeatureExtractor::NPenShapeFeatureExtractor()" <<endl;
+
+ throw LTKException(returnVal);
+ }
+
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "NPenShapeFeatureExtractor::NPenShapeFeatureExtractor()" << endl;
+
+}
+
+/**********************************************************************************
+* AUTHOR : Dinesh M
+* DATE : 1-Oct-2007
+* NAME : readConfig
+* DESCRIPTION : read the config values from cfg file and set member variables
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date
+*************************************************************************************/
+
+int NPenShapeFeatureExtractor::readConfig(const string& cfgFilePath)
+{
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "NPenShapeFeatureExtractor::readConfig()" << endl;
+
+ LTKConfigFileReader* configurableProperties = NULL;
+ string tempStringVar = "";
+
+ try
+ {
+ configurableProperties = new LTKConfigFileReader(cfgFilePath);
+
+ int errorCode = configurableProperties->getConfigValue(NPEN_WINDOW_SIZE, tempStringVar);
+
+ if( errorCode == SUCCESS)
+ {
+ if (setWindowSize(atoi((tempStringVar).c_str())) != SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ ECONFIG_FILE_RANGE << " : " <<
+ getErrorMessage(ECONFIG_FILE_RANGE) <<
+ " NPenShapeFeatureExtractor::readConfig" <<endl;
+
+ LTKReturnError(ECONFIG_FILE_RANGE);
+ }
+ }
+ }
+
+ catch(LTKException e)
+ {
+ delete configurableProperties;
+
+ int eCode = e.getErrorCode();
+
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << eCode <<
+ " : " << getErrorMessage(eCode) <<
+ " NPenShapeFeatureExtractor::readConfig" <<endl;
+
+ LTKReturnError(eCode);
+ }
+ delete configurableProperties;
+
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "NPenShapeFeatureExtractor::readConfig()" << endl;
+
+ return SUCCESS;
+
+}
+
+/**********************************************************************************
+* AUTHOR : Dinesh M
+* DATE : 1-Oct-2007
+* NAME : setRadius
+* DESCRIPTION : set the radius(the size of window) to compute NPen features
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date
+*************************************************************************************/
+int NPenShapeFeatureExtractor::setWindowSize(int windowSize)
+{
+ int returnVal = FAILURE;
+
+ if ( windowSize > 0 && (windowSize%2 == 1))
+ {
+ m_windowSize = windowSize;
+ returnVal = SUCCESS;
+ }
+
+ return returnVal;
+}
+
+/**********************************************************************************
+* AUTHOR : Nidhi Sharma
+* DATE : 15-Feb-2008
+* NAME : getRadius
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date
+*************************************************************************************/
+int NPenShapeFeatureExtractor::getWindowSize()
+{
+ return m_windowSize;
+}
+
+
+/**********************************************************************************
+* AUTHOR : Bharath A
+* DATE : 12-Jun-2008
+* NAME : extractFeatures
+* DESCRIPTION : Extracts NPen features from a trace group
+* ARGUMENTS : The trace group from which features have to be extracted
+* RETURNS : vector of NPenShapeFeature objects
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+int NPenShapeFeatureExtractor::extractFeatures(const LTKTraceGroup& inTraceGroup,
+ vector<LTKShapeFeaturePtr>& outFeatureVec)
+{
+
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "NPenShapeFeatureExtractor::extractFeatures()" << endl;
+
+ NPenShapeFeature* featurePtr = NULL;
+
+ vector<vector<float> > floatFeatureValues;
+
+
+
+ int errorCode;
+
+ if(inTraceGroup.getNumTraces() == 0)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)
+ <<"Error: FeatureExtractor::findAllFeatures"<<endl;
+
+ LTKReturnError(EEMPTY_TRACE_GROUP);
+ }
+
+
+ vector<vector<float> > concatenatedCoord;
+ int currPenUpPointIndex = -1;
+ vector<int> penUpPointsIndices;
+
+
+ int halfWindowSize = m_windowSize/2;
+
+ if(halfWindowSize==0)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)
+ <<"Error: FeatureExtractor::findAllFeatures"<<endl;
+
+ LTKReturnError(EINVALID_NUM_OF_POINTS);
+ }
+
+
+ for(int t=0;t<inTraceGroup.getNumTraces();++t)
+ {
+
+ LTKTrace eachTrace;
+ inTraceGroup.getTraceAt(t,eachTrace);
+
+ if(eachTrace.isEmpty())
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)
+ <<"Error: FeatureExtractor::findAllFeatures"<<endl;
+
+ LTKReturnError(EEMPTY_TRACE);
+
+ }
+
+ vector<float> xVec;
+ vector<float> yVec;
+
+ eachTrace.getChannelValues(X_CHANNEL_NAME,xVec);
+ eachTrace.getChannelValues(Y_CHANNEL_NAME,yVec);
+
+ if(t==0)
+ {
+ vector<float> firstPoint;
+ firstPoint.push_back(xVec[0]);
+ firstPoint.push_back(yVec[0]);
+
+ concatenatedCoord.insert(concatenatedCoord.begin(),halfWindowSize,firstPoint);
+ }
+
+ for(int p=0;p<xVec.size();++p)
+ {
+ vector<float> point;
+ point.push_back(xVec[p]);
+ point.push_back(yVec[p]);
+
+ concatenatedCoord.push_back(point);
+
+ }
+
+ currPenUpPointIndex += xVec.size();
+
+ penUpPointsIndices.push_back(currPenUpPointIndex);
+
+ if(t==(inTraceGroup.getNumTraces()-1))
+ {
+ vector<float> lastPoint;
+ lastPoint.push_back(xVec[xVec.size()-1]);
+ lastPoint.push_back(yVec[yVec.size()-1]);
+
+ concatenatedCoord.insert(concatenatedCoord.end(),halfWindowSize,lastPoint);
+ }
+
+ }
+
+
+
+ /* 0 - normalized x
+ 1 - normalized y
+ 2 - cos alpha
+ 3 - sin alpha
+ 4 - cos beta
+ 5 - sin beta
+ 6 - aspect
+ 7 - curliness
+ 8 - linearity
+ 9 - slope
+ 10 - pen-up / pen-down stroke (0 for pen-down and 1 for pen-up)*/
+
+ float deltaX=0;
+ float deltaY=0;
+ float hypotenuse=0;
+
+
+ float cosalpha=0;
+ float sinalpha=0;
+ float cosbeta=0;
+ float sinbeta=0;
+ float ispenup=0;
+ float aspect=0;
+ float curliness=0;
+ float linearity=0;
+ float slope=0;
+
+
+ float xMin,yMin,xMax,yMax; //for vicnity bounding box;
+ float bbWidth,bbHeight;
+ float maxOfWidthHeight;
+
+
+
+ currPenUpPointIndex = 0;
+
+
+ for(int f=halfWindowSize;f<(concatenatedCoord.size()-halfWindowSize);++f)
+ {
+
+ vector<float> eachPointFeature;
+
+ eachPointFeature.push_back(concatenatedCoord[f][0]); //x
+ eachPointFeature.push_back(concatenatedCoord[f][1]); //y
+
+ deltaX = concatenatedCoord[f-1][0] - concatenatedCoord[f+1][0];
+ deltaY = concatenatedCoord[f-1][1] - concatenatedCoord[f+1][1];
+
+ hypotenuse = sqrt((deltaX*deltaX)+(deltaY*deltaY));
+
+ if(hypotenuse < EPS)
+ {
+ cosalpha = 1;
+ sinalpha = 0;
+ }
+ else
+ {
+ cosalpha = deltaX / hypotenuse;
+ sinalpha = deltaY / hypotenuse;
+ }
+
+ eachPointFeature.push_back(cosalpha);
+ eachPointFeature.push_back(sinalpha);
+
+ eachPointFeature.push_back(cosbeta); //creating empty spaces for cosine and sine betas for future assignment
+ eachPointFeature.push_back(sinbeta);
+
+ vector<vector<float> > vicinity;
+
+ float vicinityTrajLen = 0.0f;
+
+ for(int v=f-halfWindowSize;v<=f+halfWindowSize;++v)
+ {
+ vicinity.push_back(concatenatedCoord[v]);
+
+ if(v<(f+halfWindowSize))
+ {
+ vicinityTrajLen += (sqrt(((concatenatedCoord[v+1][1]-concatenatedCoord[v][1])*(concatenatedCoord[v+1][1]-concatenatedCoord[v][1]))+((concatenatedCoord[v+1][0]-concatenatedCoord[v][0])*(concatenatedCoord[v+1][0]-concatenatedCoord[v][0]))));
+ }
+ }
+
+ findVicinityBoundingBox(vicinity,xMin,yMin,xMax,yMax);
+
+ bbWidth = xMax - xMin;
+
+ bbHeight = yMax - yMin;
+
+ if(fabs(bbHeight+bbWidth)<EPS)
+ {
+ aspect = 0.0;
+ }
+ else
+ {
+ aspect = (bbHeight-bbWidth)/(bbHeight+bbWidth);
+ }
+
+
+ eachPointFeature.push_back(aspect);
+
+
+ maxOfWidthHeight = ( bbWidth > bbHeight) ? bbWidth : bbHeight;
+
+ if(fabs(maxOfWidthHeight) < EPS)
+ {
+ curliness = 0.0f;
+ }
+ else
+ {
+ curliness = (vicinityTrajLen / maxOfWidthHeight) - 2;
+ }
+
+ eachPointFeature.push_back(curliness);
+
+ computeLinearityAndSlope(vicinity,linearity,slope);
+
+ eachPointFeature.push_back(linearity);
+ eachPointFeature.push_back(slope);
+
+ if(penUpPointsIndices[currPenUpPointIndex] == (f-halfWindowSize))
+ {
+ ispenup = 1;
+ ++currPenUpPointIndex;
+ }
+ else
+ {
+ ispenup = 0;
+ }
+ eachPointFeature.push_back(ispenup); //currently assuming pen-up strokes are not resampled
+
+ floatFeatureValues.push_back(eachPointFeature);
+
+ }
+
+
+ //duplicating first and last features
+ vector<float> firstFeaturePoint = floatFeatureValues[0];
+
+ floatFeatureValues.insert(floatFeatureValues.begin(),1,firstFeaturePoint);
+
+ vector<float> lastFeaturePoint = floatFeatureValues[floatFeatureValues.size()-1];
+
+ floatFeatureValues.insert(floatFeatureValues.end(),1,lastFeaturePoint);
+
+
+ for(int ff=1;ff<(floatFeatureValues.size()-1);++ff)
+ {
+
+ floatFeatureValues[ff][4] = (floatFeatureValues[ff-1][2]*floatFeatureValues[ff+1][2]) + (floatFeatureValues[ff-1][3]*floatFeatureValues[ff+1][3]);
+ floatFeatureValues[ff][5] = (floatFeatureValues[ff-1][2]*floatFeatureValues[ff+1][3]) - (floatFeatureValues[ff-1][3]*floatFeatureValues[ff+1][2]);
+
+ }
+
+ //removing the extraneous feature points at the beginning and end
+ floatFeatureValues.erase(floatFeatureValues.begin(),floatFeatureValues.begin()+1);
+ floatFeatureValues.pop_back();
+
+
+ for(int a=0;a<floatFeatureValues.size();++a)
+ {
+ NPenShapeFeature* ptrFeature = new NPenShapeFeature();
+ ptrFeature->setX(floatFeatureValues[a][0]);
+ ptrFeature->setY(floatFeatureValues[a][1]);
+ ptrFeature->setCosAlpha((1+floatFeatureValues[a][2])*((float)PREPROC_DEF_NORMALIZEDSIZE/2.0));
+ ptrFeature->setSinAlpha((1+floatFeatureValues[a][3])*((float)PREPROC_DEF_NORMALIZEDSIZE/2.0));
+ ptrFeature->setCosBeta((1+floatFeatureValues[a][4])*((float)PREPROC_DEF_NORMALIZEDSIZE/2.0));
+ ptrFeature->setSinBeta((1+floatFeatureValues[a][5])*((float)PREPROC_DEF_NORMALIZEDSIZE/2.0));
+ ptrFeature->setAspect(floatFeatureValues[a][6]);
+ ptrFeature->setCurliness(floatFeatureValues[a][7]);
+ ptrFeature->setLinearity(floatFeatureValues[a][8]);
+ ptrFeature->setSlope((1+floatFeatureValues[a][9])*((float)PREPROC_DEF_NORMALIZEDSIZE/2.0));
+
+ if(fabs(floatFeatureValues[a][10]-1.0f) < EPS)
+ {
+ ptrFeature->setPenUp(true);
+ }
+ else
+ {
+ ptrFeature->setPenUp(false);
+ }
+
+ outFeatureVec.push_back(LTKShapeFeaturePtr(ptrFeature));
+
+ ptrFeature = NULL;
+
+ }
+
+
+
+
+
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "NPenShapeFeatureExtractor::extractFeatures()" << endl;
+
+ return SUCCESS;
+}
+
+/**********************************************************************************
+* AUTHOR : Bharath A
+* DATE : 12-Jun-2008
+* NAME : getShapeFeatureInstance
+* DESCRIPTION : Returns an NPenShapeFeature instance
+* ARGUMENTS :
+* RETURNS : An NPenShapeFeature instance
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+LTKShapeFeaturePtr NPenShapeFeatureExtractor::getShapeFeatureInstance()
+{
+ LTKShapeFeaturePtr tempPtr(new NPenShapeFeature);
+ return tempPtr;
+}
+
+
+/******************************************************************************
+* AUTHOR : Bharath A
+* DATE : 12-Jun-2008
+* NAME : convertFeatVecToTraceGroup
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+******************************************************************************/
+int NPenShapeFeatureExtractor::convertFeatVecToTraceGroup(
+ const vector<LTKShapeFeaturePtr>& shapeFeature,
+ LTKTraceGroup& outTraceGroup)
+{
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "NPenShapeFeatureExtractor::convertFeatVecToTraceGroup()" << endl;
+
+ vector<LTKChannel> channels; // channels of a trace
+
+ LTKChannel xChannel("X", DT_FLOAT, true); // x-coordinate channel of the trace
+ LTKChannel yChannel("Y", DT_FLOAT, true); // y-coordinate channel of the trace
+
+ //initializing the channels of the trace
+ channels.push_back(xChannel);
+ channels.push_back(yChannel);
+
+ // composing the trace format object
+ LTKTraceFormat traceFormat(channels);
+
+ vector<float> point; // a point of a trace
+
+ LTKTrace trace(traceFormat);
+
+ for(int count=0;count<(int)shapeFeature.size();count++)
+ {
+ float Xpoint, Ypoint;
+ bool penUp;
+
+ NPenShapeFeature* ptr = (NPenShapeFeature*)(shapeFeature[count].operator ->());
+ Xpoint = ptr->getX();
+ Ypoint = ptr->getY();
+ penUp = ptr->isPenUp();
+
+
+
+ point.push_back(Xpoint);
+ point.push_back(Ypoint);
+
+ trace.addPoint(point);
+ point.clear();
+
+
+ if(penUp == true) // end of a trace, clearing the trace now
+ {
+ outTraceGroup.addTrace(trace);
+ trace.emptyTrace();
+ LTKTrace tempTrace(traceFormat);
+ trace = tempTrace;
+ }
+ }
+
+ LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "NPenShapeFeatureExtractor::convertFeatVecToTraceGroup()" << endl;
+ return SUCCESS;
+
+}
+
+
+void NPenShapeFeatureExtractor::findVicinityBoundingBox(vector<vector<float> >& inputXYCoords, float& xMin, float& yMin, float& xMax, float& yMax)
+ {
+ xMin = FLT_MAX;
+ yMin = FLT_MAX;
+
+ xMax = -FLT_MAX;
+ yMax = -FLT_MAX;
+
+ for(int i=0;i<inputXYCoords.size();++i)
+ {
+ if(inputXYCoords[i][0] < xMin)
+ {
+ xMin = inputXYCoords[i][0];
+ }
+
+ if(inputXYCoords[i][0] > xMax)
+ {
+ xMax = inputXYCoords[i][0];
+ }
+
+ if(inputXYCoords[i][1] < yMin)
+ {
+ yMin = inputXYCoords[i][1];
+ }
+
+ if(inputXYCoords[i][1] > yMax)
+ {
+ yMax = inputXYCoords[i][1];
+ }
+ }
+
+ }
+
+
+
+int NPenShapeFeatureExtractor::computeLinearityAndSlope(const vector<vector<float> >& vicinity,float& linearity,float& slope)
+ {
+ if(vicinity.size()<3)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)
+ <<"Error: FeatureExtractor::computeLinearity"<<endl;
+
+ LTKReturnError(FAILURE);
+ }
+
+ float x1 = vicinity[0][0];
+ float y1 = vicinity[0][1];
+
+ float x2 = vicinity[vicinity.size()-1][0];
+ float y2 = vicinity[vicinity.size()-1][1];
+
+ float avgX = 0.0f;
+ float avgY = 0.0f;
+
+ float denominator = sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));
+
+ /*if(denominator < EPS)
+ {
+ linearity = 0.0f;
+ slope = 1.0f;
+
+ return SUCCESS;
+ }*/
+
+ if(denominator < EPS)
+ {
+ slope = 1.0f;
+
+
+ //considering the case of loop where the end points are the same
+ avgX = (x1+x2)/2.0f;
+ avgY = (y1+y2)/2.0f;
+ }
+ else if(fabs(x2-x1) < EPS)
+ {
+ slope = 0.0f;
+ }
+ else
+ {
+ slope = cos(atan((y2-y1)/(x2-x1)));
+ }
+
+
+ float x0 = 0.0f;
+ float y0 = 0.0f;
+
+ float distance = 0.0f;
+
+
+ linearity = 0.0f;
+
+ for(int v=1; v<(vicinity.size()-1); ++v)
+ {
+
+ if(vicinity[v].size() < 2)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)
+ <<"Error: FeatureExtractor::computeLinearity"<<endl;
+
+ LTKReturnError(FAILURE);
+ }
+
+ x0 = vicinity[v][0];
+ y0 = vicinity[v][1];
+
+ if(denominator < EPS)
+ {
+ distance = sqrt(((avgX-x0)*(avgX-x0))+((avgY-y0)*(avgY-y0)));
+ }
+ else
+ {
+ distance = fabs(((x2-x1)*(y1-y0))-((x1-x0)*(y2-y1))) / denominator;
+ }
+
+ linearity += (distance*distance);
+
+ }
+
+ linearity /= (vicinity.size()-2); // 2 to exclude the end points of vicinity while computing average squared distance
+
+ return SUCCESS;
+ }
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h
new file mode 100644
index 00000000..18ca347e
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h
@@ -0,0 +1,97 @@
+/*****************************************************************************************
+* 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 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: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
+ * $Revision: 423 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+#include "LTKShapeFeatureExtractor.h"
+/** @ingroup NPenShapeFeatureExtractor
+* @brief The feature extractor for NPen features.
+* @class NPenShapeFeatureExtractor
+*
+*/
+#define FEATEXTR_NPEN_DEF_WINDOW_SIZE 5
+
+class LTKLoggerInterface;
+
+class NPenShapeFeatureExtractor : public LTKShapeFeatureExtractor
+{
+private:
+ int m_windowSize;
+ LTKLoggerInterface* m_ptrLog;
+
+public:
+ /** @brief Constructor for the NPen feature extractor
+ * Gets the cfg file path from the contorInfo
+ * Reads the cfg variables and poputlates the member variables
+ * @param controlInfo: LTKControlInfo : The control information
+ * @return no return value as it is a constructor
+ */
+ NPenShapeFeatureExtractor(const LTKControlInfo& controlInfo);
+
+ /** @brief Extracts NPen features from an LTKTraceGroup
+ * The XY Coordinate values are extracted from the trace gruoup.
+ * Using the coordinate values, normalized first derivatives are computed.
+ * After computing the first derivatives, the normalized second derivatives and the curvature are computed. The second derivative and curvature computation occur simultaneously.
+ * @param inTraceGroup: LTKTraceGroup& : The trace group from which local seven features have to be extracted
+ * @return LTKShapeFeaturePtr* : A vector of pointers to LTKShapeFeature objects. The pointers point to instances of the NPenShapeFeature class. The vector contains local-seven features extracted from the trace group.
+ */
+
+ int extractFeatures(const LTKTraceGroup& inTraceGroup,
+ vector<LTKShapeFeaturePtr>& outFeatureVec);
+
+ /** @brief Returns an instance of the NPenShapeFeature class
+ * @return LTKShapeFeature*: The returned empty NPenShapeFeature instance.
+ */
+ LTKShapeFeaturePtr getShapeFeatureInstance();
+
+ /** @brief Converts a feature vector to trace group
+ * @param shapeFeature : LTKShapeFeaturePtr* : The feature vector to be converted to a trace group.
+ * @param outTraceGroup : LTKTraceGroup& : The output trace group
+ */
+ //see interface
+ int convertFeatVecToTraceGroup(const vector<LTKShapeFeaturePtr>& shapeFeature,
+ LTKTraceGroup& outTraceGroup);
+
+ int getWindowSize();
+
+private:
+
+
+ /** @brief reads the cfg file and sets the member variables
+ * @param cfgFilePath : const string&: The path of the cfg file to be opened
+ * @return int : The sucess or failure of the function
+ */
+ int readConfig(const string& cfgFilePath);
+
+ /** @validates the value passed and sets the member variable
+ * @param radius : const int: The value of the variable to be set
+ * @return int : The sucess or failure of the function
+ */
+ int setWindowSize(int radius);
+
+
+ void findVicinityBoundingBox(vector<vector<float> >& inputXYCoords, float& xMin, float& yMin, float& xMax, float& yMax);
+
+ int computeLinearityAndSlope(const vector<vector<float> >& vicinity,float& linearity,float& slope);
+
+};
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro
new file mode 100644
index 00000000..dacec369
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro
@@ -0,0 +1,22 @@
+LIPILIBS = ltkcommon ltkutil featureextractorcommon
+include(../../../../lipiplugin.pri)
+
+INCLUDEPATH += \
+ ../../../../util/lib \
+ ../common \
+
+HEADERS += \
+ NPen.h \
+ NPenShapeFeature.h \
+ NPenShapeFeatureExtractor.h \
+
+SOURCES += \
+ NPen.cpp \
+ NPenShapeFeature.cpp \
+ NPenShapeFeatureExtractor.cpp \
+
+win32 {
+ DEFINES += NPEN_EXPORTS
+ LIBS += Advapi32.lib
+ #DEF_FILE = NPen.def
+}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.cpp
new file mode 100644
index 00000000..81678e45
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.cpp
@@ -0,0 +1,106 @@
+/*****************************************************************************
+* 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: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
+ * $Revision: 561 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+// pointFloat.cpp : Defines the entry point for the DLL application.
+
+#include "PointFloat.h"
+#include "PointFloatShapeFeatureExtractor.h"
+#include "LTKShapeFeatureExtractor.h"
+#include "PointFloatShapeFeature.h"
+#include "LTKErrors.h"
+
+
+#ifdef _WIN32
+#include <windows.h>
+BOOL APIENTRY DllMain( HANDLE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+#endif
+
+/***************************************************************************
+* AUTHOR : Saravanan R
+* DATE : 15-Mar-2007
+* NAME : createFeatureExtractor
+* DESCRIPTION : Creates instance of type PointFloatShapeFeatureExtractor and retuns of type
+ LTKShapeFeatureExtractor. (Acts as a Factory Method).
+* ARGUMENTS :
+* RETURNS : returns an instace of type LTKShapeFeatureExtractor.
+* NOTES :
+* CHANGE HISTORY
+* Author Date Description
+*******************************************************************************/
+int createShapeFeatureExtractor(const LTKControlInfo& controlInfo,
+ LTKShapeFeatureExtractor** outFeatureExtractor)
+{
+ try
+ {
+ *outFeatureExtractor = new PointFloatShapeFeatureExtractor(controlInfo);
+ }
+ catch(LTKException e)
+ {
+ *outFeatureExtractor = NULL;
+
+ LTKReturnError(e.getErrorCode());
+ }
+
+ return SUCCESS;
+}
+
+/****************************************************************************
+* AUTHOR : Nidhi Sharma
+* DATE : 15-Mar-2007
+* NAME : deleteShapeFeatureExtractor
+* DESCRIPTION : Destroy the instance by taking the address as its argument.
+* ARGUMENTS : Address of LTKShapeRecognizerFeatureExtractor instnace.
+* RETURNS : Returns 0 on Success
+* NOTES :
+* CHANGE HISTORY
+* Author Date Description
+*****************************************************************************/
+int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *obj)
+{
+ if ( obj != NULL )
+ {
+ delete obj;
+ obj = NULL;
+ }
+
+ return 0;
+}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.def
new file mode 100644
index 00000000..9a185d39
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.def
@@ -0,0 +1,3 @@
+EXPORTS
+ createShapeFeatureExtractor @1
+ deleteShapeFeatureExtractor @2
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.h
new file mode 100644
index 00000000..91ee5e6b
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.h
@@ -0,0 +1,110 @@
+/*****************************************************************************************
+* 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: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
+ * $Revision: 561 $
+ * $Author: sharmnid $
+ *
+ ************************************************************************/
+/************************************************************************
+* FILE DESCR: Definitions for PointFloat dll exporting functions.
+*
+* CONTENTS:
+*
+* AUTHOR: Vijayakumara M.
+*
+* DATE: 28-July-2005
+* CHANGE HISTORY:
+* Author Date Description
+************************************************************************/
+#ifndef __POINTFLOAT_H__
+#define __POINTFLOAT_H__
+
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the POINTFLOAT_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// POINTFLOAT_API functions as being imported from a DLL, wheras this DLL sees symbols
+// defined with this macro as being exported.
+#ifdef _WIN32
+#ifdef POINTFLOAT_EXPORTS
+#define POINTFLOAT_API __declspec(dllexport)
+#else
+#define POINTFLOAT_API __declspec(dllimport)
+#endif //ifdef POINTFLOAT_EXPORTS
+#else
+#define POINTFLOAT_API
+#endif //#ifdef _WIN32
+
+
+#include "LTKTypes.h"
+#include "LTKLoggerUtil.h"
+
+class LTKShapeFeatureExtractor;
+class LTKShapeFeature;
+
+/** @defgroup PointFloatShapeFeatureExtractor
+*@brief The PointFloatShapeFeatureExtractor
+*/
+
+/**
+* @ingroup PointFloatShapeFeatureExtractor
+* @file PointFloat.cpp
+* <p>
+* The functions exported by the DLL
+* - ::createShapeFeatureExtractor
+* - ::deleteShapeFeatureExtractor
+* - ::getCurrentVersion
+* - ::deleteShapeFeaturePtr
+*/
+
+/**
+* @brief Returns a pointer to the instance of PointFloatShapeFeatureExtractor
+*
+* <p>
+* This function is based on run-time polymorphism. It creates an instance of
+* PointFloatShapeFeatureExtractor at run-time and returns it as a pointer to the base class <i>LTKShapeFeatureExtractor</i>
+* </p>
+*
+* @param none
+*
+* @return Pointer to LTKShapeFeatureExtractor
+*/
+extern "C" POINTFLOAT_API int createShapeFeatureExtractor(
+ const LTKControlInfo& controlInfo,
+ LTKShapeFeatureExtractor** outFeatureExtractor);
+
+/**
+* @brief Deletes the feature extractor instance.
+*
+* <p>
+* This function cleans up all the memory allocations done by the feature extractor by calling it's destructor.
+* </p>
+*
+* @param featureExtractorPtr - Pointer to LTKShapeFeatureExtractor.
+*
+* @return 0 on Success
+*/
+extern "C" POINTFLOAT_API int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *featureExtractorPtr);
+
+#endif //#ifndef __POINTFLOAT_H__
+
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.cpp
new file mode 100644
index 00000000..02e5c9c7
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.cpp
@@ -0,0 +1,517 @@
+/*****************************************************************************************
+* 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: 2009-07-01 20:12:22 +0530 (Wed, 01 Jul 2009) $
+ * $Revision: 784 $
+ * $Author: mnab $
+ *
+ ************************************************************************/
+#include "PointFloatShapeFeature.h"
+#include "LTKStringUtil.h"
+#include <sstream>
+
+const string PointFloatShapeFeature::m_data_delimiter = ",";
+
+/**********************************************************************************
+* AUTHOR : Saravanan R.
+* DATE : 15-Mar-2007
+* NAME : Default Constructor
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+*************************************************************************************/
+PointFloatShapeFeature::PointFloatShapeFeature()
+{
+}
+
+/******************************************************************************
+* AUTHOR : Nidhi Sharma
+* DATE : 10-Dec-2007
+* NAME : Parameterized Constructor
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+******************************************************************************/
+PointFloatShapeFeature::PointFloatShapeFeature(float inX, float inY,
+ float inSinTheta, float inCosTheta, bool inPenUp):
+m_x(inX),
+m_y(inY),
+m_sinTheta(inSinTheta),
+m_cosTheta(inCosTheta),
+m_penUp(inPenUp)
+{
+}
+
+/*****************************************************************************
+* AUTHOR : Saravanan R.
+* DATE : 15-Mar-2007
+* NAME : Default Constructor
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+******************************************************************************/
+PointFloatShapeFeature::~PointFloatShapeFeature()
+{
+}
+
+/**********************************************************************************
+* AUTHOR : Saravanan R.
+* DATE : 15-Mar-2007
+* NAME : getX
+* DESCRIPTION :
+* ARGUMENTS : none
+* RETURNS : float : x value
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+*************************************************************************************/
+float PointFloatShapeFeature::getX() const
+{
+ return m_x;
+}
+
+/**********************************************************************************
+* AUTHOR : Saravanan R.
+* DATE :15-Mar-2007
+* NAME : getY
+* DESCRIPTION :
+* ARGUMENTS : none
+* RETURNS : float : y value
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+*************************************************************************************/
+float PointFloatShapeFeature::getY() const
+{
+ return m_y;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE :13-Sept-2007
+* NAME : getSinTheta
+* DESCRIPTION :
+* ARGUMENTS : none
+* RETURNS : float : sintheta value
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+*************************************************************************************/
+float PointFloatShapeFeature::getSinTheta() const
+{
+ return m_sinTheta;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE :13-Sept-2007
+* NAME : getCosTheta
+* DESCRIPTION :
+* ARGUMENTS : none
+* RETURNS : float : costheta value
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+*************************************************************************************/
+float PointFloatShapeFeature::getCosTheta() const
+{
+ return m_cosTheta;
+}
+
+/***************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE :13-Sept-2007
+* NAME : isPenUp
+* DESCRIPTION :
+* ARGUMENTS : none
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+* Balaji MNA 01-July-2009 Rename getPenUp to isPenUp
+******************************************************************************/
+bool PointFloatShapeFeature::isPenUp() const
+{
+ return m_penUp;
+}
+
+/**********************************************************************************
+* AUTHOR : Saravanan R.
+* DATE : 15-Mar-2007
+* NAME : setX
+* DESCRIPTION :
+* ARGUMENTS : float : x value
+* RETURNS : none
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+*************************************************************************************/
+void PointFloatShapeFeature::setX(float x)
+{
+ m_x = x;
+}
+
+/**********************************************************************************
+* AUTHOR : Saravanan R.
+* DATE : 15-Mar-2007
+* NAME : setY
+* DESCRIPTION :
+* ARGUMENTS : float : y value
+* RETURNS : none
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+*************************************************************************************/
+void PointFloatShapeFeature::setY(float y)
+{
+ m_y = y;
+}
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 13-Sept_2007
+* NAME : setSinTheta
+* DESCRIPTION :
+* ARGUMENTS : float : sintheta value
+* RETURNS : none
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+*************************************************************************************/
+void PointFloatShapeFeature::setSinTheta(float sintheta)
+{
+ m_sinTheta = sintheta;
+}
+
+/**********************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 13-Sept_2007
+* NAME : setTheta
+* DESCRIPTION :
+* ARGUMENTS : float : costheta value
+* RETURNS : none
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+*************************************************************************************/
+void PointFloatShapeFeature::setCosTheta(float costheta)
+{
+ m_cosTheta = costheta;
+}
+
+/**************************************************************************
+* AUTHOR : Naveen Sundar G.
+* DATE : 13-Sept_2007
+* NAME : setPenUp
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description
+*****************************************************************************/
+void PointFloatShapeFeature::setPenUp(bool penUp)
+{
+ m_penUp = penUp;
+}
+
+/**********************************************************************************
+* AUTHOR : Saravanan R.
+* DATE : 15-Mar-2007
+* NAME : clone
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
+*************************************************************************************/
+LTKShapeFeaturePtr PointFloatShapeFeature::clone() const
+{
+ PointFloatShapeFeature* pointInst = new PointFloatShapeFeature();
+
+ pointInst->setX(this->getX());
+ pointInst->setY(this->getY());
+ pointInst->setSinTheta(this->getSinTheta());
+ pointInst->setCosTheta(this->getCosTheta());
+ pointInst->setPenUp(this->isPenUp());
+
+ return (LTKShapeFeaturePtr)pointInst;
+}
+
+/**********************************************************************************
+* AUTHOR : Saravanan R.
+* DATE : 15-Mar-2007
+* NAME : getDistance
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
+*************************************************************************************/
+void PointFloatShapeFeature::getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr,
+ float& outDistance) const
+{
+ PointFloatShapeFeature *inPointFloatFeature = (PointFloatShapeFeature*)(shapeFeaturePtr.operator ->());
+
+ float xDiff = (m_x) - inPointFloatFeature->m_x;
+
+ float yDiff = (m_y) - inPointFloatFeature->m_y;
+
+ float sinthetaDiff = (m_sinTheta) - inPointFloatFeature->m_sinTheta;
+
+ float costhetaDiff = (m_cosTheta) - inPointFloatFeature->m_cosTheta;
+
+ outDistance = ( (xDiff * xDiff) + (yDiff * yDiff) +
+ (sinthetaDiff * sinthetaDiff) + (costhetaDiff * costhetaDiff) );
+}
+
+/**********************************************************************************
+* AUTHOR : Saravanan R.
+* DATE : 15-Mar-2007
+* NAME : initialize
+* DESCRIPTION : To convert the string to xy value
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
+*************************************************************************************/
+int PointFloatShapeFeature::initialize(const string& initString)
+{
+ stringVector tokens;
+
+ LTKStringUtil::tokenizeString(initString, m_data_delimiter, tokens);
+
+ //Token size must be 4
+// if(tokens.size() != 4)
+ if(tokens.size() != 5)
+ return FAILURE; //Returning an error
+
+ m_x = LTKStringUtil::convertStringToFloat(tokens[0]);
+ m_y = LTKStringUtil::convertStringToFloat(tokens[1]);
+ m_sinTheta = LTKStringUtil::convertStringToFloat(tokens[2]);
+ m_cosTheta = LTKStringUtil::convertStringToFloat(tokens[3]);
+
+ if(atoi(tokens[4].c_str()) == 1)
+ {
+ m_penUp = true;
+ }
+ else
+ {
+ m_penUp = false;
+ }
+
+ return SUCCESS;
+}
+
+/**********************************************************************************
+* AUTHOR : Saravanan R.
+* DATE : 15-Mar-2007
+* NAME : toString
+* DESCRIPTION : To convert the points to a string
+* ARGUMENTS : string : holds the string value of xy points
+* RETURNS : none
+* NOTES :
+* CHANGE HISTROY
+* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
+*************************************************************************************/
+void PointFloatShapeFeature::toString(string& strFeat) const
+{
+ ostringstream tempString;
+
+ tempString << m_x << m_data_delimiter << m_y << m_data_delimiter <<
+ m_sinTheta << m_data_delimiter << m_cosTheta <<
+ m_data_delimiter << m_penUp;
+
+ strFeat = tempString.str();
+}
+
+/**********************************************************************************
+* AUTHOR : Saravanan R.
+* DATE : 30-Mar-2007
+* NAME : addFeature
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
+*************************************************************************************/
+int PointFloatShapeFeature::addFeature(const LTKShapeFeaturePtr& secondFeature,
+ LTKShapeFeaturePtr& outResult ) const
+{
+ PointFloatShapeFeature* resultFeature = new PointFloatShapeFeature();
+
+ PointFloatShapeFeature *inFeature = (PointFloatShapeFeature*)(secondFeature.operator ->());
+
+ resultFeature->setX(m_x + inFeature->getX());
+ resultFeature->setY (m_y + inFeature->getY());
+ resultFeature->setSinTheta (m_sinTheta + inFeature->getSinTheta());
+ resultFeature->setCosTheta (m_cosTheta + inFeature->getCosTheta());
+ resultFeature->setPenUp (m_penUp);
+
+ outResult = LTKShapeFeaturePtr(resultFeature);
+
+ return SUCCESS;
+}
+
+/**********************************************************************************
+* AUTHOR : Saravanan R.
+* DATE : 30-Mar-2007
+* NAME : subtractFeature
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
+*************************************************************************************/
+int PointFloatShapeFeature::subtractFeature(const LTKShapeFeaturePtr& secondFeature,
+ LTKShapeFeaturePtr& outResult ) const
+{
+ PointFloatShapeFeature* resultFeature=new PointFloatShapeFeature();
+
+ PointFloatShapeFeature *inFeature = (PointFloatShapeFeature*)(secondFeature.operator ->());
+
+ resultFeature->setX (m_x - inFeature->getX());
+ resultFeature->setY (m_y - inFeature->getY());
+ resultFeature->setSinTheta (m_sinTheta - inFeature->getSinTheta());
+ resultFeature->setCosTheta (m_cosTheta - inFeature->getCosTheta());
+ resultFeature->setPenUp (m_penUp);
+
+ outResult = LTKShapeFeaturePtr(resultFeature);
+
+ return SUCCESS;
+}
+
+/**********************************************************************************
+* AUTHOR : Saravanan R.
+* DATE : 30-Mar-2007
+* NAME : scaleFeature
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
+*************************************************************************************/
+int PointFloatShapeFeature::scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const
+{
+ PointFloatShapeFeature* resultFeature=new PointFloatShapeFeature();
+
+ resultFeature->setX (m_x * alpha);
+ resultFeature->setY (m_y * alpha);
+ resultFeature->setSinTheta (m_sinTheta * alpha);
+ resultFeature->setCosTheta (m_cosTheta * alpha);
+ resultFeature->setPenUp(m_penUp);
+
+ outResult = LTKShapeFeaturePtr(resultFeature);
+
+ return SUCCESS;
+}
+
+/***************************************************************************
+* AUTHOR : Saravanan R.
+* DATE : 30-Mar-2007
+* NAME : scaleFeature
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author: Naveen Sundar G. Date: 13-Sept-2007 Description:
+ Implemented Support for theta
+*****************************************************************************/
+int PointFloatShapeFeature::toFloatVector(floatVector& floatVec)
+{
+ floatVec.push_back(m_x);
+ floatVec.push_back(m_y);
+ floatVec.push_back(m_sinTheta);
+ floatVec.push_back(m_cosTheta);
+ if(m_penUp == true)
+ floatVec.push_back(1.0);
+ else
+ floatVec.push_back(0.0);
+
+ return SUCCESS;
+}
+
+/***************************************************************************
+* AUTHOR : Nidhi Sharma
+* DATE : 23-Apr-2008
+* NAME : initialize
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author: Date Description:
+
+*****************************************************************************/
+int PointFloatShapeFeature::initialize(const floatVector& initFloatVector)
+{
+ return initialize(initFloatVector.data(), initFloatVector.size());
+}
+
+int PointFloatShapeFeature::initialize(floatVector::const_pointer initFloatData, size_t dataSize)
+{
+ if (dataSize < 5)
+ {
+ return FAILURE;
+ }
+
+ m_x = *(initFloatData++);
+ m_y = *(initFloatData++);
+ m_sinTheta = *(initFloatData++);
+ m_cosTheta = *(initFloatData++);
+ m_penUp = *(initFloatData++) != 0;
+
+ return SUCCESS;
+}
+
+/***************************************************************************
+* AUTHOR : Nidhi Sharma
+* DATE : 23-Apr-2008
+* NAME : getFeatureDimension
+* DESCRIPTION :
+* ARGUMENTS :
+* RETURNS :
+* NOTES :
+* CHANGE HISTROY
+* Author: Date Description:
+
+*****************************************************************************/
+
+int PointFloatShapeFeature::getFeatureDimension()
+{
+ return 5;
+}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.h
new file mode 100644
index 00000000..4e05a0ca
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.h
@@ -0,0 +1,199 @@
+/*****************************************************************************************
+* 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: 2009-07-01 20:12:22 +0530 (Wed, 01 Jul 2009) $
+ * $Revision: 784 $
+ * $Author: mnab $
+ *
+ ************************************************************************/
+#ifndef __POINTFLOATSHAPEFEATURE_H
+#define __POINTFLOATSHAPEFEATURE_H
+
+#include "LTKShapeFeature.h"
+
+
+/** @defgroup PointFloatShapeFeatureExtractor
+*/
+
+/** @ingroup PointFloatShapeFeatureExtractor
+* @brief The feature representation class for X, Y features (float)
+* @class PointFloatShapeFeature
+*
+*/
+class PointFloatShapeFeature : public LTKShapeFeature
+{
+ /** @name private data members */
+ //@{
+
+private:
+ /** @brief X value */
+ float m_x;
+
+ /** @brief Y value */
+ float m_y;
+
+ /** @brief sin theta value */
+ float m_sinTheta;
+
+ /** @brief cos theta value */
+ float m_cosTheta;
+
+ /** @brief Pen-up information */
+ bool m_penUp;
+
+ /** @brief Delimiter character */
+ static const string m_data_delimiter;
+ //@}
+
+public:
+
+ /** @name Constructors and Destructor */
+ //@{
+
+ /**
+ * Default Constructor.
+ */
+ PointFloatShapeFeature();
+
+ /** Parameterized Constructor */
+ PointFloatShapeFeature(float inX, float inY, float inSinTheta,
+ float inCosTheta, bool inPenUp);
+
+ /**
+ * Default destructor.
+ */
+ ~PointFloatShapeFeature();
+
+ /**
+ * Returns the value of class data member PointFloatShapeFeature::m_x
+ */
+ float getX() const;
+
+ /**
+ * Returns the value of PointFloatShapeFeature::m_y
+ */
+ float getY() const;
+
+ /**
+ * Returns the value of PointFloatShapeFeature::m_sinTheta
+ */
+ float getSinTheta() const;
+
+ /**
+ * Returns the value of PointFloatShapeFeature::m_cosTheta
+ */
+ float getCosTheta() const;
+
+ bool isPenUp() const;
+
+
+ /**
+ * Sets the value of PointFloatShapeFeature::m_x
+ */
+
+ void setX(float x);
+
+ /**
+ * Sets the value of PointFloatShapeFeature::m_y
+ */
+ void setY(float y);
+
+ /**
+ * Sets the value of PointFloatShapeFeature::m_sinTheta
+ */
+
+ //int setSinTheta(float y);
+ void setSinTheta(float y);
+
+
+ /**
+ * Sets the value of PointFloatShapeFeature::m_cosTheta
+ */
+ //int setCosTheta(float y);
+ void setCosTheta(float y);
+
+
+ void setPenUp(bool penUp);
+ /**
+ * @brief Initializes the PointFloatShapeFeature from the string passed as parameter.
+ *
+ * <b>Semantics</b>
+ *
+ * - Tokenize the input string on PointFloatShapeFeature::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 PointFloatShapeFeature::m_data_delimiter)
+ * @return SUCCESS : If initialization done without any errors.
+ *
+ */
+ int initialize(const string& initString);
+
+ int initialize(const floatVector& initFloatVector);
+
+ int initialize(floatVector::const_pointer initFloatData, size_t dataSize);
+
+ int toFloatVector(vector<float>& floatVec);
+
+ /**
+ * @brief Gives the string representation of the PointFloatShapeFeature instance
+ */
+ void toString(string& strFeat) const;
+ /**
+ * This method sets the value of x
+ */
+
+ LTKShapeFeaturePtr clone() const;
+
+ void getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const;
+
+
+
+ /**
+ * @brief Adds two PoinFloatShapeFeature instances.
+ *
+ * @param secondFeature : LTKShapeFeature* : Base class pointer holding pointer to PointFloatShapeFeature instance
+ *
+ * @return LTKShapeFeature* : Pointer to PointFloatShapeFeature instance holding the result of addition.
+ *
+ */
+ int addFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const ;
+
+ /**
+ * @brief Subtracts two PoinFloatShapeFeature instances.
+ *
+ * @param secondFeature : LTKShapeFeature* : Base class pointer holding pointer to PointFloatShapeFeature instance
+ *
+ * @return LTKShapeFeature* : Pointer to PointFloatShapeFeature instance holding the result of subtraction.
+ *
+ */
+ int subtractFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const ;
+
+ int scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const ;
+
+ int getFeatureDimension();
+
+};
+
+#endif
+//#ifndef __POINTFLOATSHAPEFEATURE_H
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.cpp
new file mode 100644
index 00000000..49260852
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.cpp
@@ -0,0 +1,394 @@
+/*****************************************************************************************
+ * 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: 2009-07-01 20:12:22 +0530 (Wed, 01 Jul 2009) $
+ * $Revision: 784 $
+ * $Author: mnab $
+ *
+ ************************************************************************/
+/************************************************************************
+ * FILE DESCR: Implementation for PointFloat Shape FeatureExtractor module
+ *
+ * CONTENTS:
+ *
+ * AUTHOR: Saravanan R.
+ *
+ * DATE: March 15, 2007
+ * CHANGE HISTORY:
+ * Author Date Description of change
+ ************************************************************************/
+
+#include "PointFloatShapeFeatureExtractor.h"
+#include "PointFloatShapeFeature.h"
+#include "LTKTraceGroup.h"
+#include "LTKTrace.h"
+#include "LTKChannel.h"
+#include "LTKTraceFormat.h"
+#include "LTKConfigFileReader.h"
+#include "LTKMacros.h"
+#include "LTKPreprocDefaults.h"
+#include "LTKException.h"
+#include "LTKErrors.h"
+#include "LTKLoggerUtil.h"
+
+
+/**********************************************************************************
+ * AUTHOR : Naveen Sundar G
+ * DATE : 1-Oct-2007
+ * NAME : PointFloatShapeFeatureExtractor
+ * DESCRIPTION : parameterized constructor
+ * ARGUMENTS :
+ * RETURNS :
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date
+ *************************************************************************************/
+PointFloatShapeFeatureExtractor::PointFloatShapeFeatureExtractor(
+ const LTKControlInfo& controlInfo)
+{
+ string cfgFilePath = "";
+
+ // Config file
+ if ( ! ((controlInfo.lipiRoot).empty()) &&
+ ! ((controlInfo.projectName).empty()) &&
+ ! ((controlInfo.profileName).empty()) &&
+ ! ((controlInfo.cfgFileName).empty()))
+ {
+ // construct the cfg path using project and profile name
+ cfgFilePath = (controlInfo.lipiRoot) + PROJECTS_PATH_STRING +
+ (controlInfo.projectName) + PROFILE_PATH_STRING +
+ (controlInfo.profileName) + SEPARATOR +
+ (controlInfo.cfgFileName) + CONFIGFILEEXT;
+ }
+ else if ( ! ((controlInfo.cfgFilePath).empty() ))
+ {
+ cfgFilePath = controlInfo.cfgFilePath;
+ }
+ else
+ {
+ throw LTKException(EINVALID_PROJECT_NAME);
+ }
+
+ int returnVal = readConfig(cfgFilePath);
+
+ if (returnVal != SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
+ "Error: PointFloatShapeFeatureExtractor::PointFloatShapeFeatureExtractor()"
+ << endl;
+
+ throw LTKException(returnVal);
+ }
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "PointFloatShapeFeatureExtractor::PointFloatShapeFeatureExtractor()" << endl;
+}
+
+/**********************************************************************************
+ * AUTHOR : Naveen Sundar G
+ * DATE : 1-Oct-2007
+ * NAME : readConfig
+ * DESCRIPTION : read the config values from cfg file and set member variables
+ * ARGUMENTS :
+ * RETURNS :
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date
+ *************************************************************************************/
+
+int PointFloatShapeFeatureExtractor::readConfig(const string& cfgFilePath)
+{
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "PointFloatShapeFeatureExtractor::readConfig()" << endl;
+
+ LTKConfigFileReader* configurableProperties = NULL;
+ string tempStringVar = "";
+
+ try
+ {
+ configurableProperties = new LTKConfigFileReader(cfgFilePath);
+ }
+
+ catch(LTKException e)
+ {
+ delete configurableProperties;
+
+ int eCode = e.getErrorCode();
+
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << eCode <<
+ " : " << getErrorMessage(eCode) <<
+ " PointFloatShapeFeatureExtractor::readConfig" <<endl;
+
+ LTKReturnError(eCode);
+ }
+
+ delete configurableProperties;
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "PointFloatShapeFeatureExtractor::readConfig()" << endl;
+ return SUCCESS;
+
+}
+
+/**************************************************************************
+ * AUTHOR : Naveen Sundar G
+ * DATE :
+ * NAME :
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS :
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date
+ ****************************************************************************/
+
+int PointFloatShapeFeatureExtractor::extractFeatures(const LTKTraceGroup& inTraceGroup,
+ vector<LTKShapeFeaturePtr>& outFeatureVec)
+{
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "PointFloatShapeFeatureExtractor::extractFeatures()" << endl;
+
+ PointFloatShapeFeature *featurePtr = NULL;
+ float x,y,deltax;
+ int numPoints=0; // number of pts
+ int count=0;
+ int currentStrokeSize;
+ float sintheta, costheta,sqsum;
+ int i;
+
+ int numberOfTraces = inTraceGroup.getNumTraces();
+
+ if (numberOfTraces == 0 )
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ EEMPTY_TRACE_GROUP << " : " << getErrorMessage(EEMPTY_TRACE_GROUP)<<
+ " PointFloatShapeFeatureExtractor::extractFeatures" <<endl;
+
+ LTKReturnError(EEMPTY_TRACE_GROUP);
+ }
+
+ LTKTraceVector allTraces = inTraceGroup.getAllTraces();
+ LTKTraceVector::iterator traceIter = allTraces.begin();
+ LTKTraceVector::iterator traceEnd = allTraces.end();
+
+
+ //***CONCATENTATING THE STROKES***
+ for (; traceIter != traceEnd ; ++traceIter)
+ {
+ floatVector tempxVec, tempyVec;
+
+ (*traceIter).getChannelValues("X", tempxVec);
+
+ (*traceIter).getChannelValues("Y", tempyVec);
+
+ // Number of points in the stroke
+ numPoints = numPoints + tempxVec.size();
+ }
+
+ //***THE CONCATENATED FULL STROKE***
+ floatVector xVec(numPoints);
+ floatVector yVec(numPoints);
+
+
+ traceIter = allTraces.begin();
+ traceEnd = allTraces.end();
+
+ boolVector penUp;
+ // Add the penUp here
+ for (; traceIter != traceEnd ; ++traceIter)
+ {
+ floatVector tempxVec, tempyVec;
+
+ (*traceIter).getChannelValues("X", tempxVec);
+
+ (*traceIter).getChannelValues("Y", tempyVec);
+
+ currentStrokeSize = tempxVec.size();
+
+ if (currentStrokeSize == 0)
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ EEMPTY_TRACE << " : " << getErrorMessage(EEMPTY_TRACE) <<
+ " PointFloatShapeFeatureExtractor::extractFeatures" <<endl;
+
+ LTKReturnError(EEMPTY_TRACE);
+ }
+
+ for( int point=0; point < currentStrokeSize ; point++ )
+ {
+ xVec[count] = tempxVec[point];
+ yVec[count] = tempyVec[point];
+ count++;
+
+ if(point == currentStrokeSize - 1 )
+ {
+ penUp.push_back(true);
+ }
+ else
+ {
+ penUp.push_back(false);
+ }
+ }
+
+ }
+ //***CONCATENTATING THE STROKES***
+
+ vector<float> theta(numPoints);
+ vector<float> delta_x(numPoints-1);
+ vector<float> delta_y(numPoints-1);
+
+ for(i=0; i<numPoints-1; ++i)
+ {
+ delta_x[i]=xVec[i+1]-xVec[i];
+ delta_y[i]=yVec[i+1]-yVec[i];
+
+ }
+
+ //Add the controlInfo here
+ sqsum = sqrt( pow(xVec[0],2)+ pow(yVec[0],2))+ EPS;
+
+ sintheta = (1+yVec[0]/sqsum)*PREPROC_DEF_NORMALIZEDSIZE/2;
+
+ costheta = (1+xVec[0]/sqsum)*PREPROC_DEF_NORMALIZEDSIZE/2;
+
+ featurePtr = new PointFloatShapeFeature(xVec[0],
+ yVec[0],
+ sintheta,
+ costheta,
+ penUp[0]);
+
+ outFeatureVec.push_back(LTKShapeFeaturePtr(featurePtr));
+ featurePtr = NULL;
+
+
+ for( i=1; i<numPoints; ++i)
+ {
+
+ //Add the controlInfo here
+
+ sqsum = sqrt(pow(delta_x[i-1],2) + pow(delta_y[i-1],2))+EPS;
+ sintheta = (1+delta_y[i-1]/sqsum)*PREPROC_DEF_NORMALIZEDSIZE/2;
+ costheta = (1+delta_x[i-1]/sqsum)*PREPROC_DEF_NORMALIZEDSIZE/2;
+
+ featurePtr = new PointFloatShapeFeature(xVec[i],
+ yVec[i],
+ sintheta,
+ costheta,
+ penUp[i]);
+ //***POPULATING THE FEATURE VECTOR***
+ outFeatureVec.push_back(LTKShapeFeaturePtr(featurePtr));
+ featurePtr = NULL;
+
+ }
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "PointFloatShapeFeatureExtractor::extractFeatures()" << endl;
+
+ return SUCCESS;
+}
+
+/**************************************************************************
+ * AUTHOR : Naveen Sundar G
+ * DATE :
+ * NAME :
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS :
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date
+ ****************************************************************************/
+LTKShapeFeaturePtr PointFloatShapeFeatureExtractor::getShapeFeatureInstance()
+{
+ LTKShapeFeaturePtr tempPtr(new PointFloatShapeFeature);
+ return tempPtr;
+}
+
+
+/******************************************************************************
+ * AUTHOR : Tarun Madan
+ * DATE : Aug-07-2007
+ * NAME : convertToTraceGroup
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS :
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+int PointFloatShapeFeatureExtractor::convertFeatVecToTraceGroup(
+ const vector<LTKShapeFeaturePtr>& shapeFeature,
+ LTKTraceGroup& outTraceGroup)
+{
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "PointFloatShapeFeatureExtractor::convertFeatVecToTraceGroup()" << endl;
+
+ vector<LTKChannel> channels; // channels of a trace
+
+ LTKChannel xChannel("X", DT_INT, true); // x-coordinate channel of the trace
+ LTKChannel yChannel("Y", DT_INT, true); // y-coordinate channel of the trace
+
+ //initializing the channels of the trace
+ channels.push_back(xChannel);
+ channels.push_back(yChannel);
+
+ // composing the trace format object
+ LTKTraceFormat traceFormat(channels);
+
+ vector<float> point; // a point of a trace
+
+ LTKTrace trace(traceFormat);
+ int featureVectorSize = shapeFeature.size();
+
+ for(int count=0; count < featureVectorSize; count++)
+ {
+ float Xpoint, Ypoint;
+ bool penUp;
+
+ PointFloatShapeFeature* ptr = (PointFloatShapeFeature*)(shapeFeature[count].operator ->());
+ Xpoint = ptr->getX();
+ Ypoint = ptr->getY();
+ penUp = ptr->isPenUp();
+
+
+
+ point.push_back(Xpoint);
+ point.push_back(Ypoint);
+
+ trace.addPoint(point);
+ point.clear();
+
+
+ if(penUp == true) // end of a trace, clearing the trace now
+ {
+ outTraceGroup.addTrace(trace);
+ trace.emptyTrace();
+ LTKTrace tempTrace(traceFormat);
+ trace = tempTrace;
+ }
+ }
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "PointFloatShapeFeatureExtractor::convertFeatVecToTraceGroup()" << endl;
+
+ return SUCCESS;
+}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.h
new file mode 100644
index 00000000..59f14e20
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.h
@@ -0,0 +1,70 @@
+/*****************************************************************************************
+* 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: 2009-07-01 16:41:37 +0530 (Wed, 01 Jul 2009) $
+ * $Revision: 783 $
+ * $Author: mnab $
+ *
+ ************************************************************************/
+#ifndef __POINTFLOATSHAPEFEATUREEXTRACTOR_H
+#define __POINTFLOATSHAPEFEATUREEXTRACTOR_H
+
+#define SUPPORTED_MIN_VERSION "4.0.0"
+#define FEATEXTR_POINTFLOAT_DEF_SIZE 10
+
+#include "LTKShapeFeatureExtractor.h"
+
+
+class PointFloatShapeFeatureExtractor : public LTKShapeFeatureExtractor
+{
+public:
+ /** @brief Constructor for the PointFloata feature extractor
+ * Gets the cfg file path from the contorInfo
+ * Reads the cfg variables and poputlates the member variables
+ * @param controlInfo: LTKControlInfo : The control information
+ * @return no return value as it is a constructor
+ */
+
+ PointFloatShapeFeatureExtractor(const LTKControlInfo& controlInfo);
+
+ int extractFeatures(const LTKTraceGroup& inTraceGroup,
+ vector<LTKShapeFeaturePtr>& outFeatureVec);
+
+ LTKShapeFeaturePtr getShapeFeatureInstance();
+
+
+ int convertFeatVecToTraceGroup(const vector<LTKShapeFeaturePtr>& shapeFeature,
+ LTKTraceGroup& outTraceGroup);
+
+private:
+ /** @brief reads the cfg file and sets the member variables
+ * @param cfgFilePath : const string&: The path of the cfg file to be opened
+ * @return int : The sucess or failure of the function
+ */
+ //int readConfigFile(const string& cfgFilePath);
+ int readConfig(const string& cfgFilePath);
+
+};
+
+
+#endif
+//#ifndef __POINTFLOATSHAPEFEATUREEXTRACTOR_H
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/pointfloat.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/pointfloat.pro
new file mode 100644
index 00000000..39eff0ee
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/pointfloat.pro
@@ -0,0 +1,22 @@
+LIPILIBS = ltkcommon ltkutil featureextractorcommon
+include(../../../../lipiplugin.pri)
+
+INCLUDEPATH += \
+ ../../../../util/lib \
+ ../common \
+
+HEADERS += \
+ PointFloat.h \
+ PointFloatShapeFeature.h \
+ PointFloatShapeFeatureExtractor.h \
+
+SOURCES += \
+ PointFloat.cpp \
+ PointFloatShapeFeature.cpp \
+ PointFloatShapeFeatureExtractor.cpp \
+
+win32 {
+ DEFINES += POINTFLOAT_EXPORTS
+ LIBS += Advapi32.lib
+ #DEF_FILE = PointFloat.def
+}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.cpp
new file mode 100644
index 00000000..8484b39d
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.cpp
@@ -0,0 +1,115 @@
+/*****************************************************************************************
+* 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: $
+ *
+ ************************************************************************/
+// SubStroke.cpp : Defines the entry point for the DLL application.
+
+#include "SubStroke.h"
+#include "SubStrokeShapeFeatureExtractor.h"
+#include "LTKShapeFeatureExtractor.h"
+#include "SubStrokeShapeFeature.h"
+#include "LTKErrors.h"
+
+
+#ifdef _WIN32
+#include <windows.h>
+BOOL APIENTRY DllMain(HANDLE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+#endif
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : createShapeFeatureExtractor
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS : int:
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+int createShapeFeatureExtractor(const LTKControlInfo& controlInfo,
+ LTKShapeFeatureExtractor** outFeatureExtractor)
+{
+ try
+ {
+ *outFeatureExtractor = new SubStrokeShapeFeatureExtractor(controlInfo);
+ }
+ catch(LTKException e)
+ {
+ *outFeatureExtractor = NULL;
+
+ LTKReturnError(e.getErrorCode());
+ }
+
+ return SUCCESS;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : deleteShapeFeatureExtractor
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS : int:
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *obj)
+{
+ if ( obj != NULL )
+ {
+ delete obj;
+ obj = NULL;
+ }
+
+ return 0;
+}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.def
new file mode 100644
index 00000000..c35a826e
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.def
@@ -0,0 +1,3 @@
+EXPORTS
+ createShapeFeatureExtractor @1
+ deleteShapeFeatureExtractor @2 \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.h
new file mode 100644
index 00000000..125ab5ae
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.h
@@ -0,0 +1,98 @@
+/*****************************************************************************************
+* 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: $
+ *
+ ************************************************************************/
+
+#ifndef __SUBSTROKE_H__
+#define __SUBSTROKE_H__
+
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the SUBSTROKE_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// SUBSTROKE_API functions as being imported from a DLL, wheras this DLL sees symbols
+// defined with this macro as being exported.
+#ifdef _WIN32
+#ifdef SUBSTROKE_EXPORTS
+#define SUBSTROKE_API __declspec(dllexport)
+#else
+#define SUBSTROKE_API __declspec(dllimport)
+#endif //ifdef SUBSTROKE_EXPORTS
+#else
+#define SUBSTROKE_API
+#endif //#ifdef _WIN32
+
+
+#include "LTKTypes.h"
+#include "LTKLoggerUtil.h"
+
+class LTKShapeFeatureExtractor;
+class LTKShapeFeature;
+
+/** @defgroup SubStrokeShapeFeatureExtractor
+*@brief The SubStrokeShapeFeatureExtractor
+*/
+
+/**
+* @ingroup SubStrokeShapeFeatureExtractor
+* @file SubStroke.cpp
+* <p>
+* The functions exported by the DLL
+* - ::createShapeFeatureExtractor
+* - ::deleteShapeFeatureExtractor
+*/
+
+/**
+* @brief Returns a pointer to the instance of SubStrokeShapeFeatureExtractor
+*
+* <p>
+* This function is based on run-time polymorphism. It creates an instance of
+* SubStrokeShapeFeatureExtractor at run-time and returns it as a pointer to the base class <i>LTKShapeFeatureExtractor</i>
+* </p>
+*
+* @param none
+*
+* @return Pointer to LTKShapeFeatureExtractor
+*/
+extern "C" SUBSTROKE_API int createShapeFeatureExtractor(
+ const LTKControlInfo& controlInfo,
+ LTKShapeFeatureExtractor** outFeatureExtractor);
+
+/**
+* @brief Deletes the feature extractor instance.
+*
+* <p>
+* This function cleans up all the memory allocations done by the feature extractor by calling it's destructor.
+* </p>
+*
+* @param featureExtractorPtr - Pointer to LTKShapeFeatureExtractor.
+*
+* @return 0 on Success
+*/
+extern "C" SUBSTROKE_API int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *featureExtractorPtr);
+
+#endif //#ifndef __SUBSTROKE_H__ \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.cpp
new file mode 100644
index 00000000..fb282d31
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.cpp
@@ -0,0 +1,675 @@
+/*****************************************************************************************
+* 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: Implementation for SubStrokeShapeFeature module
+ *
+ * CONTENTS:
+ *
+ * AUTHOR: Tanmay Mondal
+ *
+ * DATE: February 2009
+ * CHANGE HISTORY:
+ * Author Date Description of change
+ ************************************************************************/
+#include "SubStrokeShapeFeature.h"
+#include "LTKStringUtil.h"
+#include <sstream>
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : Default Constructor
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS :
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+SubStrokeShapeFeature::SubStrokeShapeFeature():
+m_data_delimiter(",")
+{
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : Parameterized Constructor
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS :
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+SubStrokeShapeFeature::SubStrokeShapeFeature(vector<float>& inSlopeVector,float inCgX,float inCgY,float inLength):
+m_slopeVector(inSlopeVector),
+m_xComponentOfCenterOfGravity(inCgX),
+m_yComponentOfCenterOfGravity(inCgY),
+m_subStrokeLength(inLength),
+m_data_delimiter(",")
+{
+}
+
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : Default Destructor
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS :
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+SubStrokeShapeFeature::~SubStrokeShapeFeature()
+{
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : clone
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS :
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+LTKShapeFeaturePtr SubStrokeShapeFeature::clone() const
+{
+ SubStrokeShapeFeature* pointInst = new SubStrokeShapeFeature();
+
+ //set the value of the tan theta
+ vector<float> tempSlopeVector;
+
+ this->getSlopeVector(tempSlopeVector);
+
+ pointInst->setSlopeVector(tempSlopeVector);
+
+ //set the value of center of gravity
+ pointInst->setXcomponentOfCenterOfGravity(this->getXcomponentOfCenterOfGravity());
+ pointInst->setYcomponentOfCenterOfGravity(this->getYcomponentOfCenterOfGravity());
+
+ //set the value of the length
+ pointInst->setSubStrokeLength(this->getSubStrokeLength());
+
+ return (LTKShapeFeaturePtr)pointInst;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : getDistance
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS : int
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+void SubStrokeShapeFeature::getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr,
+ float& outDistance) const
+{
+
+ float xDiff = 0.0, yDiff =0.0;
+
+ float sumSlopeDiff = 0.0;
+
+ int slopeIndex = 0;
+
+ int numSlope = 0;
+
+ float slopeDiff = 0.0, tempSlopeDiff1 = 0.0, tempSlopeDiff2 = 0.0;
+
+ float lengthDiff = 0.0;
+
+ floatVector featureVector;
+
+ SubStrokeShapeFeature *inSubStrokeFeature = (SubStrokeShapeFeature*)(shapeFeaturePtr.operator ->());
+
+ inSubStrokeFeature->getSlopeVector(featureVector);
+
+ numSlope = featureVector.size();
+
+ // feature vector dimension for each substroke is 8 (NUMBER_OF_SLOPE + 3)
+ // The constant 3 in the above corresponds to x,y coordinates of center of gravity of the substroke and its length
+
+ if(numSlope != (inSubStrokeFeature->getFeatureDimension()-3))
+ {
+ //write log
+ return; // error
+ }
+
+ // compute the distance between the slope vectors of two instances of SubStrokeShapeFeature
+ for(slopeIndex = 0; slopeIndex < numSlope; ++slopeIndex)
+ {
+ // difference between two slope components
+ tempSlopeDiff1 = fabs((m_slopeVector[slopeIndex]) - featureVector[slopeIndex]);
+
+ tempSlopeDiff2 = fabs((360.0 - tempSlopeDiff1));
+
+ // take the minimum of the above two differences to take care of the circular nature of slope function
+ if(tempSlopeDiff1 > tempSlopeDiff2)
+ slopeDiff = tempSlopeDiff2;
+ else
+ slopeDiff = tempSlopeDiff1;
+
+ sumSlopeDiff += slopeDiff;
+
+ }
+
+ // compute the distance between the center of gravity of two instances of SubStrokeShapeFeature
+ xDiff = fabs((m_xComponentOfCenterOfGravity) - inSubStrokeFeature->getXcomponentOfCenterOfGravity());
+
+ yDiff = fabs((m_yComponentOfCenterOfGravity) - inSubStrokeFeature->getYcomponentOfCenterOfGravity());
+
+ // compute the difference between the length of two instances of SubStrokeShapeFeature
+ lengthDiff = fabs((m_subStrokeLength) - inSubStrokeFeature->getSubStrokeLength());
+
+ outDistance = (sumSlopeDiff + (xDiff * xDiff) + (yDiff * yDiff) + lengthDiff);
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : initialize
+ * DESCRIPTION : initialize the feature instance from string
+ * ARGUMENTS : string: initString
+ * RETURNS : int:
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+int SubStrokeShapeFeature::initialize(const string& initString)
+{
+
+ int index;
+
+ stringVector tokens;
+
+ LTKStringUtil::tokenizeString(initString, m_data_delimiter, tokens);
+
+ int tokensSize = tokens.size();
+
+ //code for converting the string feature in to value and initialised the feature vector
+ if(tokensSize != getFeatureDimension())
+ {
+ //write log
+ //invalide size of feature vector
+ return FAILURE; //returning an error
+ }
+
+ for( index = 0; index < tokensSize - 3; ++index )
+ {
+ m_slopeVector.push_back(LTKStringUtil::convertStringToFloat(tokens[index]));
+ }
+
+ m_xComponentOfCenterOfGravity = LTKStringUtil::convertStringToFloat(tokens[index]);
+
+ m_yComponentOfCenterOfGravity = LTKStringUtil::convertStringToFloat(tokens[index+1]);
+
+ m_subStrokeLength = LTKStringUtil::convertStringToFloat(tokens[index+2]);
+
+ return SUCCESS;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : initialize
+ * DESCRIPTION : initialize the feature instance
+ * ARGUMENTS : floatVector: initFloatVector
+ * RETURNS : int:
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+int SubStrokeShapeFeature::initialize(const floatVector& initFloatVector)
+{
+
+ int index;
+
+ int vectorSize = initFloatVector.size();
+
+ if(vectorSize != getFeatureDimension() )
+ {
+ //write log
+ //invalide size of feature vector
+ return FAILURE; //returning an error
+ }
+
+ for( index = 0; index < vectorSize - 3; ++index )
+ {
+ m_slopeVector.push_back(initFloatVector[index]);
+ }
+
+ m_xComponentOfCenterOfGravity = initFloatVector[index];
+
+ m_yComponentOfCenterOfGravity = initFloatVector[index+1];
+
+ m_subStrokeLength = initFloatVector[index+2];
+
+ return SUCCESS;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : toFloatVector
+ * DESCRIPTION : To convert feature to a float vector
+ * ARGUMENTS : vector<float>: holds the floating point value of feature
+ * RETURNS : int
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+int SubStrokeShapeFeature::toFloatVector(vector<float>& outFloatVec)
+{
+
+ int slopeIndex;
+
+ int numSlope = m_slopeVector.size();
+
+ if(numSlope != (getFeatureDimension() - 3))
+ {
+ //write log
+ //invalide size of angle vector
+ return FAILURE; //returning an error
+ }
+
+ for( slopeIndex = 0; slopeIndex < numSlope; ++slopeIndex)
+ {
+ outFloatVec.push_back(m_slopeVector[slopeIndex]);
+ }
+
+ outFloatVec.push_back(m_xComponentOfCenterOfGravity);
+
+ outFloatVec.push_back(m_yComponentOfCenterOfGravity);
+
+ outFloatVec.push_back(m_subStrokeLength);
+
+ return SUCCESS;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : toString
+ * DESCRIPTION : To convert the feature to a string
+ * ARGUMENTS : string : holds the string value of feature
+ * RETURNS : NONE
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+void SubStrokeShapeFeature::toString(string& outStrFeat) const
+{
+
+ ostringstream tempString;
+
+ int slopeIndex;
+
+ int numSlope = m_slopeVector.size();
+
+ if(numSlope != NUMBER_OF_SLOPE)
+ {
+ //write log
+ //invalide size of angle vector
+ return; //returning an error
+ }
+
+ //convert the value of the feture vector to string
+ for( slopeIndex = 0; slopeIndex < numSlope; slopeIndex++)
+ {
+ tempString << m_slopeVector[slopeIndex] << m_data_delimiter;
+ }
+
+ tempString << m_xComponentOfCenterOfGravity << m_data_delimiter
+ << m_yComponentOfCenterOfGravity << m_data_delimiter
+ << m_subStrokeLength;
+
+
+ outStrFeat = tempString.str();
+
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : getSlopeVector
+ * DESCRIPTION :
+ * ARGUMENTS : vector<float>: outSlopeVector
+ * RETURNS : none
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+void SubStrokeShapeFeature::getSlopeVector(vector<float>& outSlopeVector) const
+{
+ outSlopeVector = m_slopeVector;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : getSubStrokeLength
+ * DESCRIPTION : Ratio of the length and normalised height
+ * ARGUMENTS : none
+ * RETURNS : float: m_subStrokeLength
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+float SubStrokeShapeFeature::getSubStrokeLength() const
+{
+ return m_subStrokeLength;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : getXcomponentOfCenterOfGravity
+ * DESCRIPTION : X co-ordinate of CG
+ * ARGUMENTS : none
+ * RETURNS : float: m_xComponentOfCenterOfGravity
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+float SubStrokeShapeFeature::getXcomponentOfCenterOfGravity() const
+{
+ return m_xComponentOfCenterOfGravity;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : getYcomponentOfCenterOfGravity
+ * DESCRIPTION : Y co-ordinate of CG
+ * ARGUMENTS : none
+ * RETURNS : float: m_yComponentOfCenterOfGravity
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+float SubStrokeShapeFeature::getYcomponentOfCenterOfGravity() const
+{
+ return m_yComponentOfCenterOfGravity;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : setSlopeVector
+ * DESCRIPTION : set the slope vector of substroke
+ * ARGUMENTS : vector<float>: inSlopeVector
+ * RETURNS : none
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+void SubStrokeShapeFeature::setSlopeVector(const vector<float>& inSlopeVector)
+{
+ m_slopeVector = inSlopeVector;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : setSubStrokeLength
+ * DESCRIPTION : set the length of the substroke
+ * ARGUMENTS : float: length
+ * RETURNS : none
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+void SubStrokeShapeFeature::setSubStrokeLength(float inSubStrokeLength)
+{
+ m_subStrokeLength = inSubStrokeLength;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : setXcomponentOfCenterOfGravity
+ * DESCRIPTION :
+ * ARGUMENTS : float: x value
+ * RETURNS : none
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+void SubStrokeShapeFeature::setXcomponentOfCenterOfGravity(float inX)
+{
+ m_xComponentOfCenterOfGravity = inX;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : setYcomponentOfCenterOfGravity
+ * DESCRIPTION :
+ * ARGUMENTS : float: y value
+ * RETURNS : none
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+void SubStrokeShapeFeature::setYcomponentOfCenterOfGravity(float inY)
+{
+ m_yComponentOfCenterOfGravity = inY;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : addFeature
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS : int
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+int SubStrokeShapeFeature::addFeature(const LTKShapeFeaturePtr& secondFeature,
+ LTKShapeFeaturePtr& outResult ) const
+{
+ return SUCCESS;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : subtractFeature
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS : int
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+int SubStrokeShapeFeature::subtractFeature(const LTKShapeFeaturePtr& secondFeature,
+ LTKShapeFeaturePtr& outResult ) const
+{
+ return SUCCESS;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : scaleFeature
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS : int
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+int SubStrokeShapeFeature::scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const
+{
+ return SUCCESS;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : getFeatureDimension
+ * DESCRIPTION :
+ * ARGUMENTS : none
+ * RETURNS : int: dimension of the feature
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+int SubStrokeShapeFeature::getFeatureDimension()
+{
+ // The constant 3 in the above corresponds to x,y coordinates of center of gravity of the substroke and its length
+ return (NUMBER_OF_SLOPE + 3);
+}
+/**********************************************************************************
+* AUTHOR : Balaji MNA.
+* DATE : 01-July-2009
+* NAME : isPenUp
+* DESCRIPTION : Get method for the penUp
+* ARGUMENTS : none
+* RETURNS : The PenUp value
+* NOTES :
+* CHANGE HISTROY
+* Author Date Description of change
+*************************************************************************************/
+bool SubStrokeShapeFeature::isPenUp() const
+{
+ return 0;
+
+}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.h
new file mode 100644
index 00000000..791ed9a7
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.h
@@ -0,0 +1,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
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.cpp
new file mode 100644
index 00000000..87e0cd05
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.cpp
@@ -0,0 +1,1035 @@
+/*****************************************************************************************
+* 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: Implementation for SubStroke feature extractor module
+ *
+ * CONTENTS:
+ *
+ * AUTHOR: Tanmay Mondal
+ *
+ * DATE: February 2009
+ * CHANGE HISTORY:
+ * Author Date Description of change
+ ************************************************************************/
+
+#include "SubStrokeShapeFeatureExtractor.h"
+#include "SubStrokeShapeFeature.h"
+#include "LTKTraceGroup.h"
+#include "LTKTrace.h"
+#include "LTKChannel.h"
+#include "LTKTraceFormat.h"
+#include "LTKConfigFileReader.h"
+#include "LTKMacros.h"
+#include "LTKPreprocDefaults.h"
+#include "LTKException.h"
+#include "LTKErrors.h"
+#include "LTKLoggerUtil.h"
+
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : SubStrokeShapeFeatureExtractor
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS :
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+SubStrokeShapeFeatureExtractor::SubStrokeShapeFeatureExtractor(const LTKControlInfo& controlInfo)
+{
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "SubStrokeShapeFeatureExtractor::SubStrokeShapeFeatureExtractor()" << endl;
+
+ string cfgFilePath = "";
+
+ // Config file
+ if ( ! ((controlInfo.lipiRoot).empty()) &&
+ ! ((controlInfo.projectName).empty()) &&
+ ! ((controlInfo.profileName).empty()) &&
+ ! ((controlInfo.cfgFileName).empty()))
+ {
+ cfgFilePath = (controlInfo.lipiRoot) + PROJECTS_PATH_STRING +
+ (controlInfo.projectName) + PROFILE_PATH_STRING +
+ (controlInfo.profileName) + SEPARATOR +
+ (controlInfo.cfgFileName) + CONFIGFILEEXT;
+ }
+ else if ( ! ((controlInfo.cfgFilePath).empty() ))
+ {
+ cfgFilePath = controlInfo.cfgFilePath;
+ }
+ else
+ {
+ throw LTKException(EINVALID_PROJECT_NAME);
+ }
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "SubStrokeShapeFeatureExtractor::SubStrokeShapeFeatureExtractor()" << endl;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : getShapeFeatureInstance
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS :
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+LTKShapeFeaturePtr SubStrokeShapeFeatureExtractor::getShapeFeatureInstance()
+{
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "SubStrokeShapeFeatureExtractor::getShapeFeatureInstance()" << endl;
+
+ LTKShapeFeaturePtr tempPtr(new SubStrokeShapeFeature);
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "SubStrokeShapeFeatureExtractor::getShapeFeatureInstance()" << endl;
+
+ return tempPtr;
+}
+
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : extractFeatures
+ * DESCRIPTION : calculate the feature of the Ink file
+ * ARGUMENTS :
+ * RETURNS : int
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+int SubStrokeShapeFeatureExtractor::extractFeatures(const LTKTraceGroup& inTraceGroup,
+ vector<LTKShapeFeaturePtr>& outFeatureVec)
+{
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "SubStrokeShapeFeatureExtractor::extractFeatures()" << endl;
+
+ int numberOfTraces = inTraceGroup.getNumTraces();
+
+ //validating inTraceGroup
+ if (numberOfTraces == 0 )
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ EEMPTY_TRACE_GROUP << " : " << getErrorMessage(EEMPTY_TRACE_GROUP)<<
+ " SubStrokeShapeFeatureExtractor::extractFeatures" <<endl;
+
+ LTKReturnError(EEMPTY_TRACE_GROUP);
+ }
+
+ SubStrokeShapeFeature *featurePtr = NULL;
+
+ int numberOfSubstrokes = 0; // number of substrokes from a trace group
+
+ int slopeIndex = 0; // index of the point
+
+ int totalNumberOfSlopeValues = 0; // total number of slope values for input tracegroup
+
+ int lengthIndex=0; // index of the substroke length vector
+
+ int cgIndex = 0; // index of the center of gravity vector
+
+ float maxX=0.0,maxY=0.0,minX=0.0,minY=0.0;
+
+ float subStokeLength = 0.0; // length of one substroke
+
+ float centerOfGravityX = 0.0; // x component of center of gravity of one substroke
+
+ float centerOfGravityY = 0.0; // y component of center of gravity of one substroke
+
+ vector<float> subStrokeSlopeVector; // slope values obtained from all the substrokes
+
+ vector<float> subStrokeLengthVector; // lengths of all substrokes
+
+ vector<float> subStrokeCenterOfGravityVector; // center of gravity of all substrokes
+
+ vector<float> tempSlope; // slope values of one substroke
+
+ vector<struct subStrokePoint> subStrokeVec; // store all the sub-strokes
+
+ // extract the substrokes from input trace group, and populate subStrokeVec
+ int errorCode = extractSubStrokesFromInk(inTraceGroup, subStrokeVec);
+
+ if( errorCode != SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
+ " SubStrokeShapeFeatureExtractor::extractFeatures" <<endl;
+
+ LTKReturnError(errorCode);
+ }
+
+ // compute the features from each substroke in subStrokeVec
+ errorCode = extractFeaturesFromSubStroke(subStrokeVec,subStrokeSlopeVector,subStrokeLengthVector,subStrokeCenterOfGravityVector);
+
+ if(errorCode != SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
+ " SubStrokeShapeFeatureExtractor::extractFeatures" <<endl;
+
+ LTKReturnError(errorCode);
+ }
+
+ inTraceGroup.getBoundingBox(minX,minY,maxX,maxY);
+
+ //computing size of subStrokeSlopeVector
+ totalNumberOfSlopeValues = subStrokeSlopeVector.size();
+
+ if(totalNumberOfSlopeValues == 0)
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ EEMPTY_SLOPE_VECTOR << " : " << getErrorMessage(EEMPTY_SLOPE_VECTOR)<<
+ " SubStrokeShapeFeatureExtractor::extractFeatures" <<endl;
+
+ LTKReturnError(EEMPTY_SLOPE_VECTOR);
+ }
+
+
+ //populating outFeatureVec with the features computed
+ for(slopeIndex=0; slopeIndex < totalNumberOfSlopeValues; ++slopeIndex)
+ {
+ if(subStrokeSlopeVector.at(slopeIndex) == SUBSTROKES_ANGLE_DELIMITER)
+ {
+ if(tempSlope.size() != NUMBER_OF_SLOPE)
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ EINVALID_SLOPE_VECTOR_DIMENSION << " : " << getErrorMessage(EINVALID_SLOPE_VECTOR_DIMENSION)<<
+ " SubStrokeShapeFeatureExtractor::extractFeatures" <<endl;
+
+ return FAILURE;
+ }
+
+ centerOfGravityX = ((subStrokeCenterOfGravityVector.at(cgIndex) / (maxX - minX)) * 100.0);
+
+ centerOfGravityY = ((subStrokeCenterOfGravityVector.at((cgIndex + 1)) / (maxY - minY)) * 100.0);
+
+ subStokeLength = ((subStrokeLengthVector.at(lengthIndex) / (maxY - minY)) * 100.0);
+
+ featurePtr = new SubStrokeShapeFeature(tempSlope,centerOfGravityX ,centerOfGravityY,subStokeLength);
+
+ //***FEATURE VECTOR***
+
+ outFeatureVec.push_back(LTKShapeFeaturePtr(featurePtr));
+
+ featurePtr = NULL;
+
+ ++numberOfSubstrokes;
+
+ tempSlope.clear();
+
+ ++lengthIndex;
+
+ cgIndex += 2;
+
+ continue;
+ }
+ tempSlope.push_back(subStrokeSlopeVector.at(slopeIndex));
+ }
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "SubStrokeShapeFeatureExtractor::extractFeatures()" << endl;
+
+ return SUCCESS;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : computeSlope
+ * DESCRIPTION : calculate slope of the line joining given two points
+ * ARGUMENTS :
+ * RETURNS : float
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+int SubStrokeShapeFeatureExtractor::computeSlope(const float inDeltaX, const float inDeltaY, float& outSlope)
+{
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "SubStrokeShapeFeatureExtractor::computeSlope()" << endl;
+
+ outSlope = -1.0;
+
+ if(inDeltaX == 0.0)
+ {
+ if(inDeltaY > 0.0)
+ {
+ outSlope = 90.0;
+ }
+ if(inDeltaY < 0.0)
+ {
+ outSlope = 270.0;
+ }
+ if(inDeltaY == 0.0)
+ {
+ outSlope = 0.0;
+ }
+ }
+
+ if(inDeltaX > 0.0)
+ {
+ outSlope = (((atan(inDeltaY/inDeltaX)) * PI_DEGREE) / PI);
+
+ if(outSlope < 0.0)
+ {
+ outSlope += (2 * PI_DEGREE);
+ }
+ }
+
+ if(inDeltaX < 0.0)
+ {
+ outSlope = (((atan(inDeltaY/inDeltaX)) * PI_DEGREE) / PI);
+
+ outSlope += PI_DEGREE;
+ }
+
+ if(outSlope < 0.0)
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ EINVALID_SLOPE << " : " << getErrorMessage(EINVALID_SLOPE)<<
+ " SubStrokeShapeFeatureExtractor::computeSlope" <<endl;
+
+ LTKReturnError(EINVALID_SLOPE);
+ }
+
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "SubStrokeShapeFeatureExtractor::computeSlope()" << endl;
+
+ return SUCCESS;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : extractSubStrokesFromInk
+ * DESCRIPTION : extract substroke from the Ink
+ * ARGUMENTS :
+ * RETURNS : int
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+int SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk(const LTKTraceGroup& inTraceGroup, vector<struct subStrokePoint>& outSubStrokeVector)
+{
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk()" << endl;
+
+ int numberOfTraces = inTraceGroup.getNumTraces();
+
+ if (numberOfTraces == 0 )
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ EEMPTY_TRACE_GROUP << " : " << getErrorMessage(EEMPTY_TRACE_GROUP)<<
+ " SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk" <<endl;
+
+ LTKReturnError(EEMPTY_TRACE_GROUP);
+ }
+
+ int errorCode = -1;
+
+ int dimension = 0; // stores the number of points in each trace of the inTraceGroup
+
+ int landMarkPoint = 0; // first point of each sub-stroke
+
+ float landMarkSlope = 0.0; // slope of the line joining the land mark point and the following point
+
+ float nextSlope = 0.0; // slope of the line joining the consicutive two points
+
+ struct subStrokePoint tempSubStroke; // stores sub-stroke
+
+ vector<struct subStrokePoint> subStrokeVec; // stores all the sub-strokes
+
+ vector<float> slopeVector; // stores the angle made with x-axis for each point of trace
+
+ bool segment; // true if stroke segment into substroke
+
+ LTKTraceVector allTraces = inTraceGroup.getAllTraces();
+
+ LTKTraceVector::iterator traceIter = allTraces.begin();
+ LTKTraceVector::iterator traceEnd = allTraces.end();
+
+ // Segmenting inTraceGroup into substrokes
+ for (; traceIter != traceEnd ; ++traceIter)
+ {
+ floatVector tempxVec, tempyVec;
+
+ //compute all the slope values from points on the trace
+ if( (errorCode = getSlopeFromTrace(*traceIter,slopeVector)) != SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
+ " SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk" <<endl;
+
+ LTKReturnError(errorCode);
+ }
+
+ // computing total number of points present in a trace
+ dimension = (*traceIter).getNumberOfPoints();
+
+ // Validating the slopeVector, its size should be equal to one less than number of points in trace
+ if((dimension-1) != slopeVector.size())
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ EINVALID_SLOPE_VECTOR_DIMENSION << " : " << getErrorMessage(EINVALID_SLOPE_VECTOR_DIMENSION)<<
+ " SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk" <<endl;
+
+ LTKReturnError(EINVALID_SLOPE_VECTOR_DIMENSION);
+ }
+
+ (*traceIter).getChannelValues("X", tempxVec);
+
+ (*traceIter).getChannelValues("Y", tempyVec);
+
+ // initialised landmark point for next stroke, assume that the first point is
+ // landmark point for every stroke
+ landMarkPoint = 0;
+
+
+ int pointIndex = 0;
+ for( pointIndex = 0; pointIndex < (dimension - 1); ++pointIndex)
+ {
+
+ //for the first point in the trace, landMarkSlope and
+ //nextSlope will be the same
+ landMarkSlope = slopeVector[landMarkPoint];
+
+ nextSlope = slopeVector[pointIndex];
+
+ //check of the trace can be segmented at the current point
+ if( (errorCode = canSegmentStrokes(landMarkSlope,nextSlope, segment)) != SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
+ " SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk" <<endl;
+
+ LTKReturnError(errorCode);
+ }
+
+ if( segment )
+ {
+ // Segment the stroke into substroke
+ outSubStrokeVector[outSubStrokeVector.size() - 1].penUp = true;
+
+ // set new landmark point for next substrokes of stroke
+ landMarkPoint = pointIndex;
+
+ } // end if ( segment )
+
+ //substrokes continue
+ tempSubStroke.X = tempxVec[pointIndex];
+ tempSubStroke.Y = tempyVec[pointIndex];
+ tempSubStroke.penUp = false;
+
+ outSubStrokeVector.push_back(tempSubStroke);
+
+
+ } // end for
+
+ // terminal point of a stroke
+ tempSubStroke.X = tempxVec[pointIndex];
+ tempSubStroke.Y = tempyVec[pointIndex];
+ tempSubStroke.penUp = true;
+
+ outSubStrokeVector.push_back(tempSubStroke);
+
+ } // end traceItr
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk()" << endl;
+
+
+ return SUCCESS;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : extractFeatureFromSubStroke
+ * DESCRIPTION :
+ * ARGUMENTS : extract feature vector of dimension (NUMBER_OF_THETA+3) from a given substroke
+ * RETURNS : int
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+
+ int SubStrokeShapeFeatureExtractor::extractFeaturesFromSubStroke(const vector<struct subStrokePoint>& inSubStrokeVector, vector<float>& outSlope, vector<float>& outLength, vector<float>& outCenterOfGravity)
+{
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "SubStrokeShapeFeatureExtractor::extractFeatureFromSubStroke()" << endl;
+
+ int numSubStrokesPoints = 0;
+
+ //total number of points present in all substrokes
+ numSubStrokesPoints = inSubStrokeVector.size();
+
+ //validating inSubStrokeVector
+ if( numSubStrokesPoints <= 0 )
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ ENO_SUBSTROKE << " : " << getErrorMessage(ENO_SUBSTROKE)<<
+ " SubStrokeShapeFeatureExtractor::extractFeaturesFromSubStroke" <<endl;
+
+ LTKReturnError(ENO_SUBSTROKE);
+ }
+
+ int ptIndex = 0; // index of point in a trace
+
+ int pointIndex = 0; // counter variable to loop over the points in a trace
+
+ int currentPointIndex =0; // index of the current point
+
+ int startIndxOfSubStrokes = 0; // starting index of the substroke
+
+ float x = 0.0; // value of x-coordinate
+
+ float y = 0.0; // value of y-coordinate
+
+ float slope = 0.0; // store slope value
+
+ float xDiff = 0.0; // difference in x-direction
+
+ float yDiff = 0.0; // difference in y-direction
+
+ float xTemp = 0.0; // temporary variable for x-coordinate
+
+ float yTemp = 0.0; // temporary variable for y-coordinate
+
+ float unitLength = 0.0; // length of each substroke after resampling
+
+ float pointDistance = 0.0; // distance detween two consecutive point
+
+ float residualDistance = 0.0; // distance between the last resampled point and the next original sample point
+
+ float cumulativeDistance = 0.0; // sum of distances between consecutive points
+
+ float segmentRatioLeft = 0.0, segmentRatioRight = 0.0; // ratio for segmenting the line joining two points
+
+ float dx = 0.0, dy = 0.0;
+
+ floatVector distanceVec; // vector to store distances between points
+
+ struct subStrokePoint tempStroke;
+
+ //vector to store all the substrokes
+ vector<struct subStrokePoint> subStrokeVec;
+
+ //*************************************************************************//
+ // represent each extracted substroke from ink by six equidistant points
+ //*************************************************************************//
+ for(int ptIdx = 0; ptIdx < numSubStrokesPoints; ++ptIdx)
+ {
+ if(inSubStrokeVector[ptIdx].penUp)
+ {
+ // ignore substrokes whose length are less than thresold value
+ if(unitLength < SUBSTROKES_LENGTH_REJECT_THRESHOLD)
+ {
+ // initialised for next substroke
+ unitLength = 0.0;
+
+ residualDistance = 0.0;
+
+ ptIndex = 0;
+
+ distanceVec.clear();
+
+ //starting index of the next substroke
+ startIndxOfSubStrokes = ptIdx+1;
+
+ continue;
+ }
+
+ // length of the extracted sub-strokes(curve length)
+ outLength.push_back(unitLength);
+
+ // dividing to get NUMBER_OF_SLOPE number of points on each substroke
+ unitLength /= (NUMBER_OF_SLOPE);
+
+ // adding x of first point
+ x = inSubStrokeVector[startIndxOfSubStrokes].X;
+
+ // adding y of first point
+ y = inSubStrokeVector[startIndxOfSubStrokes].Y;
+
+ tempStroke.X = x;
+ tempStroke.Y = y;
+ tempStroke.penUp = false;
+
+ // pushing back the first point to subStrokeVec
+ subStrokeVec.push_back(tempStroke);
+
+ // Genareting four equidistant points
+ for(pointIndex = 1; pointIndex < (NUMBER_OF_SLOPE); ++pointIndex)
+ {
+ cumulativeDistance = residualDistance;
+
+ while(cumulativeDistance < unitLength)
+ {
+ cumulativeDistance += distanceVec.at(ptIndex++);
+
+ if(ptIndex == 1)
+ {
+ currentPointIndex = (startIndxOfSubStrokes + ptIndex);
+ }
+ else
+ {
+ currentPointIndex++;
+ }
+ }
+
+ if(ptIndex < 1) ptIndex = 1;
+
+ segmentRatioRight = cumulativeDistance - unitLength;
+
+ segmentRatioLeft = distanceVec.at(ptIndex -1) - segmentRatioRight;
+
+ //interpolating to get equidistant points
+ if( fabs(segmentRatioLeft+segmentRatioRight) > EPS)
+ {
+ xTemp = (segmentRatioLeft* inSubStrokeVector[currentPointIndex].X + segmentRatioRight* inSubStrokeVector[currentPointIndex - 1].X)/(segmentRatioLeft+segmentRatioRight);
+
+ yTemp = (segmentRatioLeft* inSubStrokeVector[currentPointIndex].Y + segmentRatioRight* inSubStrokeVector[currentPointIndex - 1].Y)/(segmentRatioLeft+segmentRatioRight);
+ }
+ else
+ {
+ xTemp = inSubStrokeVector[currentPointIndex].X;
+
+ yTemp = inSubStrokeVector[currentPointIndex].Y;
+ }
+
+ tempStroke.X = xTemp;
+ tempStroke.Y = yTemp;
+ tempStroke.penUp = false;
+
+ subStrokeVec.push_back(tempStroke);
+
+ residualDistance = segmentRatioRight;
+ }
+
+ // adding x of the last point of the substroke
+ x = inSubStrokeVector[ptIdx].X;
+
+ // adding y of the last point of the substroke
+ y = inSubStrokeVector[ptIdx].Y;
+
+ tempStroke.X = x;
+ tempStroke.Y = y;
+ tempStroke.penUp = true;
+
+ subStrokeVec.push_back(tempStroke);
+
+ // initialised for next substroke
+ unitLength = 0.0;
+
+ residualDistance = 0.0;
+
+ ptIndex = 0;
+
+ distanceVec.clear();
+
+ //starting index of the next substroke
+ startIndxOfSubStrokes = ptIdx+1;
+ }
+ else
+ {
+
+ xDiff = (inSubStrokeVector[ptIdx].X - inSubStrokeVector[ptIdx + 1].X);
+
+ yDiff = (inSubStrokeVector[ptIdx].Y - inSubStrokeVector[ptIdx + 1].Y);
+
+ //distance between points.
+ pointDistance = (float) (sqrt(xDiff*xDiff + yDiff*yDiff));
+
+ // finding the length of a substroke.
+ unitLength += pointDistance;
+
+ //storing distances between every two consecutive points in a substroke.
+ distanceVec.push_back(pointDistance);
+ }
+ }
+
+
+ //************************************************************************************************//
+ // compute the feature vector for each substroke after representing them by six equidistant points
+ //************************************************************************************************//
+
+ // total number of points in all substrokes after genarating equidistant points
+ numSubStrokesPoints = 0;
+
+ numSubStrokesPoints = subStrokeVec.size();
+
+ if( numSubStrokesPoints <= 0 )
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ ENO_SUBSTROKE << " : " << getErrorMessage(ENO_SUBSTROKE)<<
+ " SubStrokeShapeFeatureExtractor::extractFeaturesFromSubStroke" <<endl;
+
+ LTKReturnError(ENO_SUBSTROKE);
+ }
+
+
+ int errorCode = -1;
+
+ float sumOfX = 0.0;
+ float sumOfY = 0.0;
+
+ //computing slopes and center of gravity values from the equidistant points extracted from each substroke
+ for(pointIndex = 0; pointIndex < numSubStrokesPoints; ++pointIndex)
+ {
+ if(!subStrokeVec[pointIndex].penUp)
+ {
+
+ // Compute slope of line joining consecutive points in a substrokes
+ dx = (subStrokeVec[pointIndex + 1].X - subStrokeVec[pointIndex].X);
+ dy = (subStrokeVec[pointIndex + 1].Y - subStrokeVec[pointIndex].Y);
+
+ if( (errorCode = computeSlope(dx,dy,slope)) != SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
+ " SubStrokeShapeFeatureExtractor::extractFeaturesFromSubStroke" <<endl;
+
+ LTKReturnError(errorCode);
+ }
+
+
+ outSlope.push_back(slope);
+
+ sumOfX += subStrokeVec[pointIndex].X;
+
+ sumOfY += subStrokeVec[pointIndex].Y;
+
+ }
+ else
+ {
+ int div = (NUMBER_OF_SLOPE + 1);
+
+ sumOfX += subStrokeVec[pointIndex].X;
+
+ sumOfY += subStrokeVec[pointIndex].Y;
+
+ sumOfX = sumOfX / (float)div;
+
+ sumOfY = sumOfY / (float)div;
+
+ outCenterOfGravity.push_back(sumOfX);
+
+ outCenterOfGravity.push_back(sumOfY);
+
+ outSlope.push_back(SUBSTROKES_ANGLE_DELIMITER);
+
+ sumOfX = 0.0;
+
+ sumOfY = 0.0;
+
+ }
+ }
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "SubStrokeShapeFeatureExtractor::extractFeatureFromSubStroke()" << endl;
+
+ return SUCCESS;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : getDirectionCode
+ * DESCRIPTION : quantize the slope
+ * ARGUMENTS :
+ * RETURNS : int
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+ int SubStrokeShapeFeatureExtractor::getDirectionCode(const float inSlope, int& outDirectionCode)
+{
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "SubStrokeShapeFeatureExtractor::getDirectionCode()" << endl;
+
+ //Validating inSlope
+ if(inSlope < 0.0)
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ EINVALID_SLOPE << " : " << getErrorMessage(EINVALID_SLOPE)<<
+ " SubStrokeShapeFeatureExtractor::getDirectionCode" <<endl;
+
+ LTKReturnError(EINVALID_SLOPE);
+ }
+
+ outDirectionCode = 0;
+
+ // return the octant value as slope value
+
+ if((inSlope< ANGLE_HIGHER_LIMIT_1) || (inSlope >= ANGLE_HIGHER_LIMIT_8))
+ {
+ outDirectionCode = DIRECTION_CODE_EAST;
+ }
+
+ else if((inSlope < ANGLE_HIGHER_LIMIT_2) && (inSlope >=ANGLE_HIGHER_LIMIT_1))
+ {
+ outDirectionCode = DIRECTION_CODE_NORTH_EAST;
+ }
+
+ else if(((inSlope >= ANGLE_HIGHER_LIMIT_2) && (inSlope < ANGLE_HIGHER_LIMIT_3)) )
+ {
+ outDirectionCode = DIRECTION_CODE_NORTH;
+ }
+
+ else if( (inSlope < ANGLE_HIGHER_LIMIT_4 ) && (inSlope >= ANGLE_HIGHER_LIMIT_3))
+ {
+ outDirectionCode = DIRECTION_CODE_NORTH_WEST;
+ }
+
+ else if((inSlope >= ANGLE_HIGHER_LIMIT_4) && (inSlope < ANGLE_HIGHER_LIMIT_5))
+ {
+ outDirectionCode = DIRECTION_CODE_WEST;
+ }
+
+ else if((inSlope >= ANGLE_HIGHER_LIMIT_5) && (inSlope < ANGLE_HIGHER_LIMIT_6))
+ {
+ outDirectionCode = DIRECTION_CODE_SOUTH_WEST;
+ }
+
+ else if(((inSlope >= ANGLE_HIGHER_LIMIT_6) && (inSlope < ANGLE_HIGHER_LIMIT_7)))
+ {
+ outDirectionCode = DIRECTION_CODE_SOUTH;
+ }
+
+ else if((inSlope >= ANGLE_HIGHER_LIMIT_7) && (inSlope < ANGLE_HIGHER_LIMIT_8))
+ {
+ outDirectionCode = DIRECTION_CODE_SOUTH_EAST;
+ }
+
+ if(outDirectionCode == 0)
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ EINVALID_DIRECTION_CODE << " : " <<
+ getErrorMessage(EINVALID_DIRECTION_CODE)<<
+ " SubStrokeShapeFeatureExtractor::getDirectionCode" <<endl;
+
+ LTKReturnError(EINVALID_DIRECTION_CODE);;
+ }
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "SubStrokeShapeFeatureExtractor::getDirectionCode()" << endl;
+
+ return SUCCESS;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : canSegmentStrokes
+ * DESCRIPTION : decision is taken towards dividing a stroke into substroke
+ * ARGUMENTS :
+ * RETURNS : int
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+int SubStrokeShapeFeatureExtractor::canSegmentStrokes(const float inFirstSlope, const float inSecondSlope, bool& outSegment)
+{
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "SubStrokeShapeFeatureExtractor::canSegmentStrokes()" << endl;
+
+ //Validating slope values
+ if(inFirstSlope < 0.0 || inSecondSlope < 0.0)
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ EINVALID_SLOPE << " : " << getErrorMessage(EINVALID_SLOPE)<<
+ " SubStrokeShapeFeatureExtractor::canSegmentStrokes" <<endl;
+
+ LTKReturnError(EINVALID_SLOPE);
+ }
+
+ int directionCodeOfFirstSlope = 0;
+ int directionCodeOfSecondSlope = 0;
+
+ outSegment = false;
+
+ int errorCode = -1;
+
+ // Computing octants of hte inFirstSlope and inSecondSlope
+ if( (errorCode = getDirectionCode(inFirstSlope, directionCodeOfFirstSlope)) != SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
+ " SubStrokeShapeFeatureExtractor::canSegmentStrokes" <<endl;
+
+ LTKReturnError(errorCode);
+ }
+
+ if( (errorCode = getDirectionCode(inSecondSlope, directionCodeOfSecondSlope)) != SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
+ " SubStrokeShapeFeatureExtractor::canSegmentStrokes" <<endl;
+
+ LTKReturnError(errorCode);
+ }
+
+ if(abs(directionCodeOfSecondSlope - directionCodeOfFirstSlope) <= STROKE_SEGMENT_VALUE )
+ outSegment = false;
+ else
+ outSegment = true;
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "SubStrokeShapeFeatureExtractor::canSegmentStrokes()" << endl;
+
+ return SUCCESS;
+}
+
+/******************************************************************************
+ * AUTHOR : Tanmay Mondal
+ * SUPERVISOR : Ujjwal Bhattacharya
+ * OTHER PLP : Kalikinkar Das
+ * ORGANIZATION : Indian Statistical Institute, Kolkata, India
+ * DEPARTMENT : Computer Vision and Pattern Recognition Unit
+ * DATE : Feb-2009
+ * NAME : getSlopeFromTrace
+ * DESCRIPTION :
+ * ARGUMENTS :
+ * RETURNS : int
+ * NOTES :
+ * CHANGE HISTROY
+ * Author Date Description
+ ******************************************************************************/
+int SubStrokeShapeFeatureExtractor::getSlopeFromTrace(const LTKTrace& inTrace, vector<float>& outSlopeVector)
+{
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
+ "SubStrokeShapeFeatureExtractor::getSlopeFromTrace()" << endl;
+
+ int dimension = 0; //Stores the number of points in a trace
+
+ dimension = inTrace.getNumberOfPoints();
+
+ if(dimension == 0)
+ {
+ LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
+ EEMPTY_TRACE << " : " << getErrorMessage(EEMPTY_TRACE)<<
+ " SubStrokeShapeFeatureExtractor::getSlopeFromTrace" <<endl;
+
+ LTKReturnError(EEMPTY_TRACE);
+ }
+
+ int pointIndex = 0;
+
+ float dx = 0.0, dy = 0.0; //Variables to store differences in x and y-directions to compute slope
+
+ float slope = 0.0;
+
+ floatVector xVec, yVec;
+
+ int errorCode = -1;
+
+ if( (errorCode = inTrace.getChannelValues(X_CHANNEL_NAME, xVec))!= SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)
+ <<"Error: SubStrokeShapeFeatureExtractor::getSlopeFromTrace"<<endl;
+
+ LTKReturnError(errorCode);
+ }
+
+ if( (errorCode = inTrace.getChannelValues(Y_CHANNEL_NAME, yVec)) != SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)
+ <<"Error: SubStrokeShapeFeatureExtractor::getSlopeFromTrace"<<endl;
+
+ LTKReturnError(errorCode);
+ }
+
+ outSlopeVector.clear();
+
+ for(pointIndex=0; pointIndex < dimension-1; ++pointIndex)
+ {
+ dx = xVec[pointIndex+1] - xVec[pointIndex];
+
+ dy = yVec[pointIndex+1] - yVec[pointIndex];
+
+ if( (errorCode = computeSlope(dx, dy, slope)) != SUCCESS)
+ {
+ LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
+ " SubStrokeShapeFeatureExtractor::getSlopeFromTrace" <<endl;
+
+ LTKReturnError(errorCode);
+ }
+
+ outSlopeVector.push_back(slope);
+ }
+
+ LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
+ "SubStrokeShapeFeatureExtractor::getSlopeFromTrace()" << endl;
+
+ return SUCCESS;
+}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.h
new file mode 100644
index 00000000..7d803727
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.h
@@ -0,0 +1,139 @@
+/*****************************************************************************************
+* 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 SubStroke feature extractor module
+ *
+ * CONTENTS:
+ *
+ * AUTHOR: Tanmay Mondal
+ *
+ * DATE: February 2009
+ * CHANGE HISTORY:
+ * Author Date Description of change
+ ************************************************************************/
+#ifndef __SUBSTROKESHAPEFEATUREEXTRACTOR_H
+#define __SUBSTROKESHAPEFEATUREEXTRACTOR_H
+
+#define SUPPORTED_MIN_VERSION "3.0.0"
+
+// delimiter of the slope of extracted substroke
+#define SUBSTROKES_ANGLE_DELIMITER -999.0
+
+#define SUBSTROKES_LENGTH_REJECT_THRESHOLD 0.001
+
+#define STROKE_SEGMENT_VALUE 0
+
+#define SINGLE_SUBSTROKES 1
+
+#define ANGLE_HIGHER_LIMIT_1 22.5
+
+#define ANGLE_HIGHER_LIMIT_2 67.5
+
+#define ANGLE_HIGHER_LIMIT_3 112.5
+
+#define ANGLE_HIGHER_LIMIT_4 157.5
+
+#define ANGLE_HIGHER_LIMIT_5 202.5
+
+#define ANGLE_HIGHER_LIMIT_6 247.5
+
+#define ANGLE_HIGHER_LIMIT_7 292.5
+
+#define ANGLE_HIGHER_LIMIT_8 337.5
+
+#define PI_DEGREE 180.0
+
+#include "LTKShapeFeatureExtractor.h"
+
+class SubStrokeShapeFeatureExtractor : public LTKShapeFeatureExtractor
+{
+
+public:
+ /** @brief Constructor for the SubStroke feature extractor
+ * Gets the cfg file path from the contorInfo
+ * Reads the cfg variables and poputlates the member variables
+ * @param controlInfo: LTKControlInfo : The control information
+ * @return no return value as it is a constructor
+ */
+
+ SubStrokeShapeFeatureExtractor(const LTKControlInfo& controlInfo);
+
+ int extractFeatures(const LTKTraceGroup& inTraceGroup,
+ vector<LTKShapeFeaturePtr>& outFeatureVec);
+
+ LTKShapeFeaturePtr getShapeFeatureInstance();
+
+private:
+
+ //store extracted sub-strokes
+ struct subStrokePoint
+ {
+ float X; // x point
+ float Y; // y point
+ bool penUp; // If point is penup then penUp = 1 else penUp =0
+ };
+
+ /** extract feature from sub strokes
+ */
+ int extractFeaturesFromSubStroke(const vector<struct subStrokePoint>& inSubStrokeVector,
+ vector<float>& outSlope,
+ vector<float>& outLength,
+ vector<float>& outCenterOfGravity);
+
+ /** extract the sub strokes from the preprocessed trace group
+ */
+ int extractSubStrokesFromInk(const LTKTraceGroup& inTraceGroup, vector<struct subStrokePoint>& outSubStrokeVector);
+
+ /** @brief claculate the angle
+ * inDeltaX,inDeltaY : float : the difference of x[i] and x[i+1] and difference of y[i] and y[i+1] of ink point
+ * float : the angle made with x axis and the point
+ */
+ int computeSlope(const float inDeltaX, const float inDeltaY, float& outSlope);
+
+ /** decide the octant of the point along the ink
+ * slope : float : value of the angle
+ * int : the octant code
+ */
+ int getDirectionCode(const float inSlope, int& outDirectionCode);
+
+ /** break the stroke into substrokes
+ * infirstSlope, insecondSlope : float : value of the slope
+ * int : SUCCESS : FAILURE
+ */
+ int canSegmentStrokes(const float inFirstSlope, const float inSecondSlope, bool& outSegment);
+
+ /** compute the slope of each point present in the tace
+ * inTrace : LTKTrace : value of a trace
+ * int : SUCCESS : FAILURE : errorcode
+ */
+ int getSlopeFromTrace(const LTKTrace& inTrace, vector<float>& outSlopeVector);
+
+};
+
+#endif //#ifndef __SUBSTROKESHAPEFEATUREEXTRACTOR_H
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/substroke.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/substroke.pro
new file mode 100644
index 00000000..804d1f42
--- /dev/null
+++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/substroke.pro
@@ -0,0 +1,22 @@
+LIPILIBS = ltkcommon ltkutil featureextractorcommon
+include(../../../../lipiplugin.pri)
+
+INCLUDEPATH += \
+ ../../../../util/lib \
+ ../common \
+
+HEADERS += \
+ SubStroke.h \
+ SubStrokeShapeFeature.h \
+ SubStrokeShapeFeatureExtractor.h \
+
+SOURCES += \
+ SubStroke.cpp \
+ SubStrokeShapeFeature.cpp \
+ SubStrokeShapeFeatureExtractor.cpp \
+
+win32 {
+ DEFINES += SUBSTROKE_EXPORTS
+ LIBS += Advapi32.lib
+ #DEF_FILE = SubStroke.def
+}