aboutsummaryrefslogtreecommitdiffstats
path: root/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen
diff options
context:
space:
mode:
Diffstat (limited to 'src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen')
-rw-r--r--src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp103
-rw-r--r--src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def3
-rw-r--r--src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h92
-rw-r--r--src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp340
-rw-r--r--src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h253
-rw-r--r--src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp722
-rw-r--r--src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h97
-rw-r--r--src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro22
8 files changed, 0 insertions, 1632 deletions
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp b/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp
deleted file mode 100644
index 1d142230..00000000
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/*****************************************************************************************
-* 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/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def b/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def
deleted file mode 100644
index 9a185d39..00000000
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def
+++ /dev/null
@@ -1,3 +0,0 @@
-EXPORTS
- createShapeFeatureExtractor @1
- deleteShapeFeatureExtractor @2
diff --git a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h b/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h
deleted file mode 100644
index c1a410d7..00000000
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*****************************************************************************************
-* 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/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp b/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp
deleted file mode 100644
index a05867be..00000000
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp
+++ /dev/null
@@ -1,340 +0,0 @@
-#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/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h b/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h
deleted file mode 100644
index 1f9f5f08..00000000
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*****************************************************************************************
-* 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/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp b/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp
deleted file mode 100644
index e20b63dc..00000000
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp
+++ /dev/null
@@ -1,722 +0,0 @@
-/*****************************************************************************************
-* 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/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h b/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h
deleted file mode 100644
index 18ca347e..00000000
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*****************************************************************************************
-* 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/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro b/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro
deleted file mode 100644
index dacec369..00000000
--- a/src/virtualkeyboard/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-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
-}