diff options
Diffstat (limited to 'src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common')
6 files changed, 715 insertions, 0 deletions
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeature.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeature.h new file mode 100644 index 00000000..c233d3c5 --- /dev/null +++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeature.h @@ -0,0 +1,224 @@ +/***************************************************************************************** +* Copyright (c) 2006 Hewlett-Packard Development Company, L.P. +* Permission is hereby granted, free of charge, to any person obtaining a copy of +* this software and associated documentation files (the "Software"), to deal in +* the Software without restriction, including without limitation the rights to use, +* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the +* Software, and to permit persons to whom the Software is furnished to do so, +* subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*****************************************************************************************/ + +/************************************************************************ + * SVN MACROS + * + * $LastChangedDate: 2011-01-11 13:48:17 +0530 (Tue, 11 Jan 2011) $ + * $Revision: 827 $ + * $Author: mnab $ + * + ************************************************************************/ +/************************************************************************ + * FILE DESCR: function prototype for the LTKShapeFeature class + * + * CONTENTS: + * + * AUTHOR: Nidhi Sharma + * + * DATE: 07-FEB-2007 + * CHANGE HISTORY: + * Author Date Description of change + ************************************************************************/ + +#ifndef __LTKSHAPEFEATURE_H +#define __LTKSHAPEFEATURE_H +#include "LTKTypes.h" +#include "LTKException.h" +#include "LTKErrorsList.h" +#include "LTKMacros.h" +#include "LTKErrors.h" +#include "LTKShapeFeatureMacros.h" + +/** + * \defgroup feature_extractor The feature extractor module + * <p> + * The feature extractor module consists of following directories + * - common + * - Builds as a static library called <b> featureextractorcommon.lib</b> + * + * - Various feature extractors viz PointFloatShapeFeatureExtractor + * - These feature extractor are built as DLLs + * + * User can specify the feature extractor name in the classifier config file + * and the corresponding extractor is instantiated at run-time. + * + * </p> + */ + +/** @ingroup feature_extractor +* @brief An abstract class that defines the interface for a class representing a feature. +* @class LTKShapeFeature +* The LTKShapeFeature is the abstract base class. Any class representing a shape feature +* is derived from the LTKShapeFeature class. +*/ +class LTKShapeFeature +{ +public: + /** @name Constructors and Destructor */ + //@{ + + /** + * Default Constructor. + */ + + LTKShapeFeature(){}; + + /** + * Virtual destructor. + */ + virtual ~LTKShapeFeature() + { + }; + //@} + + /** @Purely cirtual functions */ + //@{ + + /** + * <b>Responsibility</b><br> + * This function initializes the instance of type LTKShapeFeature using the initialization string + * passed as parameter. + * + * @param initString : string& : reference to the initialization string. + */ + + virtual int initialize(const string& initString)=0; + + virtual int initialize(const floatVector& initFloatVector)=0; + + virtual int initialize(floatVector::const_pointer initFloatData, size_t dataSize) { (void)initFloatData; (void)dataSize; return SUCCESS; } + + /** + * <b>Responsibility</b><br> + * This function returns the character (char*) representation for the instance of type LTKShapeFeature. + * + * @param p1 : char* : Pointer to the character array. + */ + + virtual void toString(string& strFeat) const =0; + + /** + * <b>Responsibility</b><br> + * Creates a new instance of type LTKShapeFeature and initializes it with the calling instance. + * + * @param none. + * + * @return LTKShapeFeature* Pointer to the LTKShapeFeature instance + */ + + virtual LTKShapeFeaturePtr clone() const =0; + + /** + * <b>Responsibility</b><br> + * Returns the distance between two instances of LTKShapeFeature. + * + * @param shapeFeaturePtr : LTKShapeFeature* : Pointer to LTKShapeFeature + * + * @return distance (float) Distance between two instances of LTKShapeFeature class. + */ + + virtual void getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const = 0; + + //@} + + /** + * <b>Responsibility</b><br> + * Returns the representation of LTKShapeFeature instance as a vetor of floats. + * + * @param floatVec : vector<float>& : Reference to the vector of floats. + * + * @return FAILURE If no implementation is provided by the derived class + */ + virtual int toFloatVector(vector<float>& floatVec) { return FAILURE; } + + /** + * <b>Responsibility</b><br> + * Returns the representation of LTKShapeFeature instance as a vetor of integers. + * + * + * @param intVec : vector<float>& : Reference to the vector of integers. + * + * @return FAILURE If no implementation is provided by the derived class + */ + virtual int toIntVector(vector<int>& intVec) { return FAILURE; } + + //ADAPTATION REQUIREMENTS + + /** + * <b>Responsibility</b><br> + * Adds two instances of type LTKShapeFeature. + * + * @param secondFeature : LTKShapeFeature* : Pointer to LTKShapeFeature + * + * @return LTKShapeFeature* : The pointer to LTKShapeFeature holding the result of adding + * + * @exception LTKErrorsList::EFTR_RPRCLASS_NOIMPLEMENTATION If no implementation is provided by the derived class + */ + + virtual int addFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const + { + LTKReturnError(EFTR_RPRCLASS_NOIMPLEMENTATION); + } + + /** + * <b>Responsibility</b><br> + * Subtract two instances of LTKShapeFeature. + * + * + * @param secondFeature : LTKShapeFeature* : Pointer to LTKShapeFeature + * + * @return LTKShapeFeature* : The pointer to LTKShapeFeature holding the result of subtraction + * + * @exception LTKErrorsList::EFTR_RPRCLASS_NOIMPLEMENTATION If no implementation is provided by the derived class + */ + + virtual int subtractFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const + { + LTKReturnError(EFTR_RPRCLASS_NOIMPLEMENTATION); + } + + /** + * <b>Responsibility</b><br> + * Scales the instance of LTKShapeFeature by the floating point number alpha passed as parameter. + * + * + * @param secondFeature : LTKShapeFeature* : Pointer to LTKShapeFeature + * + * @return LTKShapeFeature* : The pointer to scaled LTKShapeFeature + * + * @exception LTKErrorsList::EFTR_RPRCLASS_NOIMPLEMENTATION If no implementation is provided by the derived class + */ + + virtual int scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const + { + LTKReturnError(EFTR_RPRCLASS_NOIMPLEMENTATION); + } + + virtual int getFeatureDimension() = 0; + + virtual bool isPenUp() const + { + LTKReturnError(EFTR_RPRCLASS_NOIMPLEMENTATION); + } + +}; + + +#endif diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.cpp new file mode 100644 index 00000000..1b4e9532 --- /dev/null +++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.cpp @@ -0,0 +1,64 @@ +/***************************************************************************************** +* Copyright (c) 2006 Hewlett-Packard Development Company, L.P. +* Permission is hereby granted, free of charge, to any person obtaining a copy of +* this software and associated documentation files (the "Software"), to deal in +* the Software without restriction, including without limitation the rights to use, +* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the +* Software, and to permit persons to whom the Software is furnished to do so, +* subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*****************************************************************************************/ + +/************************************************************************ + * SVN MACROS + * + * $LastChangedDate: 2007-05-14 13:35:33 +0530 (Mon, 14 May 2007) $ + * $Revision: 92 $ + * $Author: sharmnid $ + * + ************************************************************************/ +/************************************************************************ + * FILE DESCR: Implementation of LTKShapeFeatureExtractor which would be used as + * a place holder in LTKShapeFeatureExtractor + * for anyone of the implemented feature extractor + * which is derived from this class + * + * CONTENTS: + * + * AUTHOR: + * + * DATE: + * CHANGE HISTORY: + * Author Date Description of change + ************************************************************************/ + +#include "LTKShapeFeatureExtractor.h" +#include "LTKErrorsList.h" + +/********************************************************************************** +* AUTHOR : Tarun Madan +* DATE : 07-Aug-2007 +* NAME : convertToTraceGroup +* DESCRIPTION : +* ARGUMENTS : +* RETURNS : +* NOTES : +* CHANGE HISTROY +* Author Date Description of change +*************************************************************************************/ +int LTKShapeFeatureExtractor::convertFeatVecToTraceGroup( + const vector<LTKShapeFeaturePtr>& shapeFeature, + LTKTraceGroup& outTraceGroup) +{ + + return(EFTR_RPRCLASS_NOIMPLEMENTATION); + +}
\ No newline at end of file diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.h new file mode 100644 index 00000000..51ab4b57 --- /dev/null +++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.h @@ -0,0 +1,102 @@ +/***************************************************************************************** +* Copyright (c) 2006 Hewlett-Packard Development Company, L.P. +* Permission is hereby granted, free of charge, to any person obtaining a copy of +* this software and associated documentation files (the "Software"), to deal in +* the Software without restriction, including without limitation the rights to use, +* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the +* Software, and to permit persons to whom the Software is furnished to do so, +* subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*****************************************************************************************/ + +/************************************************************************ + * SVN MACROS + * + * $LastChangedDate: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $ + * $Revision: 556 $ + * $Author: sharmnid $ + * + ************************************************************************/ +/************************************************************************ + * FILE DESCR: Function prototype for feature extraction module + * + * CONTENTS: + * + * AUTHOR: Nidhi Sharma + * + * DATE: 07-FEB-2007 + * CHANGE HISTORY: + * Author Date Description of change + ************************************************************************/ + +#ifndef __LTKFEATUREEXTRACTOR_H +#define __LTKFEATUREEXTRACTOR_H + + +#include "LTKTypes.h" +#include "LTKShapeFeatureMacros.h" + +// Forward class declarations +class LTKTraceGroup; +class LTKShapeFeature; + +/** +* @ingroup feature_extractor +* @brief An abstract class which is extended by all the feature extractors. +* @class LTKShapeFeatureExtractor +* +*/ +class LTKShapeFeatureExtractor +{ +public: + /** + * <b>Responsibility</b><br> + * Extract features from the input TraceGroup passed a parameter. + * + * <b>Description</b> + * <p> + * Every feature representation class has a feature extractor associated with it. The feature extractor + * extracts the features from the trace group passed as parameter. + * </p> + * + * <p>This function is based on run-time polymorphism. + * The pointer to the derived class instances are stored in a vector of base class (<i>LTKShapeFeature</i>) pointers. + * </p> + * + * @return Pointer to the vector of LTKShapeFeature pointers. + */ + virtual int extractFeatures(const LTKTraceGroup& inTraceGroup, + vector<LTKShapeFeaturePtr>& outFeatureVec)=0; + + /** + * <b>Responsibility</b><br> + * Returns the instance of the shape feature class associated with the feature extractor. + * + * @return Pointer to the shape feature class. + * + */ + virtual LTKShapeFeaturePtr getShapeFeatureInstance()=0; + + + /** + * <b>Responsibility</b><br> + * Constructs traceGroup based on input LTKShapeFeaturePtr + * + * @return Pointer to Trace Group. + * + */ + virtual int convertFeatVecToTraceGroup( + const vector<LTKShapeFeaturePtr>& shapeFeature, + LTKTraceGroup& outTraceGroup); +}; + + +#endif diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.cpp new file mode 100644 index 00000000..07fa2adc --- /dev/null +++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.cpp @@ -0,0 +1,222 @@ +/***************************************************************************************** +* Copyright (c) 2006 Hewlett-Packard Development Company, L.P. +* Permission is hereby granted, free of charge, to any person obtaining a copy of +* this software and associated documentation files (the "Software"), to deal in +* the Software without restriction, including without limitation the rights to use, +* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the +* Software, and to permit persons to whom the Software is furnished to do so, +* subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*****************************************************************************************/ + +/************************************************************************ + * SVN MACROS + * + * $LastChangedDate: 2009-06-25 16:40:26 +0530 (Thu, 25 Jun 2009) $ + * $Revision: 778 $ + * $Author: mnab $ + * + ************************************************************************/ +/************************************************************************ +* FILE DESCR: Implementation for LTKFeatureExtractor factory class +* +* CONTENTS: +* createFeatureExtractor +* +* AUTHOR: Nidhi Sharma +* +* DATE: December 23, 2004 +* CHANGE HISTORY: +* Author Date Description of LTKShapeFeatureExtractorFactory +************************************************************************/ +#include "LTKShapeFeatureExtractorFactory.h" +#include "LTKMacros.h" +#include "LTKErrorsList.h" +#include "LTKException.h" +#include "LTKLoggerUtil.h" +#include "LTKErrors.h" +#include "LTKOSUtil.h" +#include "LTKOSUtilFactory.h" + +/************************************************************************* +* AUTHOR : Nidhi Sharma +* DATE : 07-FEB-2007 +* NAME : createFeatureExtractor +* DESCRIPTION : create method of a factory class +* ARGUMENTS : +* RETURNS : Pointer to the instance of LTKShapeFeatureExtractor +* NOTES : +* CHANGE HISTROY +* Author Date Description of LTKFeatureExtractor +*****************************************************************************/ + +LTKShapeFeatureExtractorFactory::LTKShapeFeatureExtractorFactory() +{ +} + +/*********************************************************************** +* AUTHOR : Nidhi Sharma +* DATE : 07-FEB-2007 +* NAME : createFeatureExtractor +* DESCRIPTION : create method of a factory class +* ARGUMENTS : +* RETURNS : Pointer to the instance of LTKShapeFeatureExtractor +* NOTES : +* CHANGE HISTROY +* Author Date Description of LTKFeatureExtractor +******************************************************************************/ +int LTKShapeFeatureExtractorFactory::createFeatureExtractor( + const string& featureExtractorName, + const string& lipiRootPath, + const string& lipiLibPath, + void** m_libHandlerFE, + const LTKControlInfo& controlInfo, + LTKShapeFeatureExtractor** outFeatureExtractor) +{ + LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " << + "LTKShapeFeatureExtractorFactory::createFeatureExtractor()" << endl; + + string feName = ""; + + int errorCode = mapFeatureExtractor(featureExtractorName, feName); + + if (errorCode != SUCCESS) + { + LOG( LTKLogger::LTK_LOGLEVEL_ERR) + << getErrorMessage(errorCode) + << "LTKShapeFeatureExtractorFactory::createFeatureExtractor:" + << endl; + + LTKReturnError(errorCode); + } + + errorCode = getFeatureExtractorInst(lipiRootPath, lipiLibPath, feName, m_libHandlerFE, + controlInfo, outFeatureExtractor); + + if ( errorCode != SUCCESS) + { + LOG( LTKLogger::LTK_LOGLEVEL_ERR) + << getErrorMessage(errorCode) << ":" << feName + << "LTKShapeFeatureExtractorFactory::createFeatureExtractor:" + << endl; + + LTKReturnError(errorCode); + } + + LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " << + "LTKShapeFeatureExtractorFactory::createFeatureExtractor()" << endl; + + return SUCCESS; +} + +/********************************************************************************** +* AUTHOR : Nidhi Sharma +* DATE : 11-Dec-2007 +* NAME : getFeatureExtractorInst +* DESCRIPTION : +* ARGUMENTS : +* RETURNS : +* NOTES : +* CHANGE HISTROY +* Author Date Description of LTKFeatureExtractor +*************************************************************************************/ +int LTKShapeFeatureExtractorFactory::getFeatureExtractorInst( + const string& lipiRootPath, + const string& lipiLibPath, + const string& feName, + void** m_libHandlerFE, + const LTKControlInfo& controlInfo, + LTKShapeFeatureExtractor** outFeatureExtractor) +{ + FN_PTR_CREATE_SHAPE_FEATURE_EXTRACTOR createFeatureExtractorPtr; + void *functionHandle = NULL; + + LTKOSUtil* utilPtr = LTKOSUtilFactory::getInstance(); + + int returnVal = utilPtr->loadSharedLib(lipiLibPath, feName, m_libHandlerFE); + + + if(returnVal != SUCCESS) + { + LTKReturnError(ELOAD_FEATEXT_DLL); + } + + returnVal = utilPtr->getFunctionAddress(*m_libHandlerFE, + CREATE_SHAPE_FEATURE_EXTRACTOR, + &functionHandle); + + if(returnVal != SUCCESS) + { + utilPtr->unloadSharedLib(m_libHandlerFE); + *m_libHandlerFE = NULL; + + LTKReturnError(EDLL_FUNC_ADDRESS_CREATE_FEATEXT); + } + + createFeatureExtractorPtr = (FN_PTR_CREATE_SHAPE_FEATURE_EXTRACTOR)functionHandle; + + int errorCode = createFeatureExtractorPtr(controlInfo, outFeatureExtractor); + + if (errorCode != SUCCESS) + { + LTKReturnError(errorCode); + } + + delete utilPtr; + return SUCCESS; + +} + +/****************************************************************************** + * AUTHOR : Saravanan + * DATE : 24-03-2007 + * NAME : mapFeatureExtractor + * DESCRIPTION : + * ARGUMENTS : + * RETURNS : + * NOTES : + * CHANGE HISTROY + * Author Date Description + ******************************************************************************/ +int LTKShapeFeatureExtractorFactory::mapFeatureExtractor(const string& featureExtractorName, + string& outFEName) +{ + LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " << + "LTKShapeFeatureExtractorFactory::mapFeatureExtractor()" << endl; + + int returnCode = SUCCESS; + + if(LTKSTRCMP(featureExtractorName.c_str(), NAME_POINT_FLOAT_SHAPE_FEATURE_EXTRACTOR) == 0) + { + outFEName = POINT_FLOAT; + } + else if(LTKSTRCMP(featureExtractorName.c_str(), NAME_L7_SHAPE_FEATURE_EXTRACTOR) == 0) + { + outFEName = L7; + } + else if(LTKSTRCMP(featureExtractorName.c_str(),NAME_NPEN_SHAPE_FEATURE_EXTRACTOR) == 0) + { + outFEName = NPEN; + } + else if(LTKSTRCMP(featureExtractorName.c_str(),NAME_SUBSTROKE_SHAPE_FEATURE_EXTRACTOR) == 0) + { + outFEName = SUBSTROKE; + } + else + { + returnCode = EFTR_EXTR_NOT_EXIST; + } + + LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " << + "LTKShapeFeatureExtractorFactory::mapFeatureExtractor()" << endl; + + return returnCode; +} diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.h new file mode 100644 index 00000000..d178d6ef --- /dev/null +++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.h @@ -0,0 +1,94 @@ +/***************************************************************************************** +* Copyright (c) 2006 Hewlett-Packard Development Company, L.P. +* Permission is hereby granted, free of charge, to any person obtaining a copy of +* this software and associated documentation files (the "Software"), to deal in +* the Software without restriction, including without limitation the rights to use, +* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the +* Software, and to permit persons to whom the Software is furnished to do so, +* subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*****************************************************************************************/ + +/************************************************************************ + * SVN MACROS + * + * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $ + * $Revision: 561 $ + * $Author: sharmnid $ + * + ************************************************************************/ +/************************************************************************ + * FILE DESCR: Function prototype for the Factory class LTKShapeFeatureExtractorFactory + * + * CONTENTS: + * + * AUTHOR: Nidhi Sharma + * + * DATE: 07-FEB-2007 + * CHANGE HISTORY: + * Author Date Description of change + ************************************************************************/ + +#ifndef __LTKFEATUREEXTRACTORFACTORY_H +#define __LTKFEATUREEXTRACTORFACTORY_H +#include "LTKTypes.h" + +#ifndef _WIN32 +#include <dlfcn.h> +#else +#include <windows.h> +#endif + +class LTKShapeFeatureExtractor; + +/** +* @ingroup feature_extractor +* @brief A factory class which return a pointer to the feature extractor. +* @class LTKShapeFeatureExtractorFactory +* +* +* <p> +* A factory class which return a pointer to the feature extractor depending +* on the featureExtractorType passed to it +* </p> +*/ +typedef int (*FN_PTR_CREATE_SHAPE_FEATURE_EXTRACTOR) + (const LTKControlInfo& controlInfo, + LTKShapeFeatureExtractor** outFeatureExtractor); + +class LTKShapeFeatureExtractorFactory +{ + +public: + + LTKShapeFeatureExtractorFactory(); + + int createFeatureExtractor(const string& featureExtractorType, + const string& lipiRootPath, + const string& lipiLibPath, + void** m_libHandlerFE, + const LTKControlInfo& controlInfo, + LTKShapeFeatureExtractor** outFeatureExtractor); + + int getFeatureExtractorInst(const string& lipiRootPath, + const string& lipiLibPath, + const string& feName, + void** m_libHandlerFE, + const LTKControlInfo& controlInfo, + LTKShapeFeatureExtractor** outFeatureExtractor); + +private: + int mapFeatureExtractor(const string& featureExtractorName, + string& outFECode); +}; + + +#endif diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/common.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/common.pro new file mode 100644 index 00000000..ae6ce1d2 --- /dev/null +++ b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/common.pro @@ -0,0 +1,9 @@ +TARGET = featureextractorcommon +include(../../../../lipilib.pri) + +INCLUDEPATH += \ + ../../../../util/lib \ + +SOURCES += \ + LTKShapeFeatureExtractorFactory.cpp \ + LTKShapeFeatureExtractor.cpp |