diff options
Diffstat (limited to 'src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat')
8 files changed, 1421 insertions, 0 deletions
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 +} |