⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ltkpreprocessor.cpp

📁 An open source handwriting recongnition package!!!
💻 CPP
📖 第 1 页 / 共 5 页
字号:
* AUTHOR		: Dinesh M
* DATE			: 24-AUG-2006
* NAME			: setPreserveAspectRatio
* DESCRIPTION	: sets the m_preserveAspectRatio member variable to the given flag
* ARGUMENTS		: flag - true or false
* RETURNS		: SUCCESS on successful set operation
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
*************************************************************************************/

void LTKPreprocessor::setPreserveAspectRatio(bool flag)
{
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Entered LTKPreprocessor::setPreserveAspectRatio" <<endl;

	this->m_preserveAspectRatio = flag;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "m_preserveAspectRatio = " <<  m_preserveAspectRatio <<endl;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Exiting LTKPreprocessor::setPreserveAspectRatio" <<endl;

}

/**********************************************************************************
* AUTHOR		: Dinesh M
* DATE			: 24-AUG-2006
* NAME			: setPreserveRelativeYPosition
* DESCRIPTION	: sets the m_preserveRelativeYPosition member variable to the given flag
* ARGUMENTS		: flag - true or false
* RETURNS		: SUCCESS on successful set operation
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
*************************************************************************************/

void LTKPreprocessor::setPreserveRelativeYPosition(bool flag)
{
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Entered LTKPreprocessor::setPreserveRelativeYPosition" <<endl;

	this->m_preserveRelativeYPosition = flag;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "m_preserveRelativeYPosition = " <<  m_preserveRelativeYPosition <<endl;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Exiting LTKPreprocessor::setPreserveRelativeYPosition" <<endl;

}

/**********************************************************************************
* AUTHOR		: Balaji R.
* DATE			: 23-DEC-2004
* NAME			: setSizeThreshold
* DESCRIPTION	: sets the size threshold below which traces will not be rescaled
* ARGUMENTS		: sizeThreshold - size threshold below which traces will not be rescaled
* RETURNS		: SUCCESS on successful set operation
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
* Nidhi Sharma      13-Sept-2007        Added check on input parameter
*************************************************************************************/

int LTKPreprocessor::setSizeThreshold (float sizeThreshold)
{
    int errorCode;
	if(sizeThreshold < 0)
    {
        LOG(LTKLogger::LTK_LOGLEVEL_ERR)
              <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
              <<"LTKPreprocessor::setNormalizedSize" <<endl;

        LTKReturnError(ENEGATIVE_NUM);
    }

	if(sizeThreshold > PREPROC_DEF_NORMALIZEDSIZE/100)
    {
        LOG(LTKLogger::LTK_LOGLEVEL_ERR)
              <<"Error : "<< ECONFIG_FILE_RANGE <<":"<< getErrorMessage(ECONFIG_FILE_RANGE)
              <<"LTKPreprocessor::setNormalizedSize" <<endl;

        LTKReturnError(ECONFIG_FILE_RANGE);
    }

	this->m_sizeThreshold = sizeThreshold;

	return SUCCESS;
}

/**********************************************************************************
* AUTHOR		: Balaji R.
* DATE			: 23-DEC-2004
* NAME			: setLoopThreshold
* DESCRIPTION	: sets the threshold below which the trace would considered a loop
* ARGUMENTS		: loopThreshold - the threshold below which the trace would considered a loop
* RETURNS		: SUCCESS on successful set operation
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
*************************************************************************************/

int LTKPreprocessor::setLoopThreshold (float loopThreshold)
{
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Entered LTKPreprocessor::setLoopThreshold" <<endl;

	this->m_loopThreshold = loopThreshold;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "m_loopThreshold = " <<  m_loopThreshold <<endl;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Exiting LTKPreprocessor::setLoopThreshold" <<endl;

	return SUCCESS;
}

/**********************************************************************************
* AUTHOR		: Balaji R.
* DATE			: 23-DEC-2004
* NAME			: setAspectRatioThreshold
* DESCRIPTION	: sets the threshold below which aspect ratio will be maintained
* ARGUMENTS		: aspectRatioThreshold - threshold below which aspect ratio will be maintained
* RETURNS		: SUCCESS on successful set operation
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
* Nidhi Sharma      13-Sept-2007        Added check on input parameter
*************************************************************************************/

int LTKPreprocessor::setAspectRatioThreshold (float aspectRatioThreshold)
{
    int errorCode;
	if(aspectRatioThreshold < 1)
    {
        LOG(LTKLogger::LTK_LOGLEVEL_ERR)
              <<"Error : "<< ENON_POSITIVE_NUM <<":"<< getErrorMessage(ENON_POSITIVE_NUM)
              <<"LTKPreprocessor::setAspectRatioThreshold" <<endl;

        LTKReturnError(ENON_POSITIVE_NUM);
    }
	
	this->m_aspectRatioThreshold = aspectRatioThreshold;
        
	return SUCCESS;
}

/**********************************************************************************
* AUTHOR		: Balaji R.
* DATE			: 23-DEC-2004
* NAME			: setDotThreshold
* DESCRIPTION	: sets the threshold to detect dots
* ARGUMENTS		: dotThreshold - threshold to detect dots
* RETURNS		: SUCCESS on successful set operation
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
* Nidhi Sharma      13-Sept-2007        Added a check on input parameter
*************************************************************************************/

int LTKPreprocessor::setDotThreshold (float dotThreshold)
{
    int errorCode;
	if(dotThreshold <= 0)
    {
        LOG(LTKLogger::LTK_LOGLEVEL_ERR)
              <<"Error : "<< ENON_POSITIVE_NUM <<":"<< getErrorMessage(ENON_POSITIVE_NUM)
              <<"LTKPreprocessor::setDotThreshold" <<endl;

        LTKReturnError(ENON_POSITIVE_NUM);
    }
    this->m_dotThreshold = dotThreshold;

	return SUCCESS;
}

/**********************************************************************************
* AUTHOR		: Vijayakumara M.
* DATE			: 25-OCT-2005
* NAME			: setFilterLength
* DESCRIPTION	: sets the fileter length
* ARGUMENTS		: filterLength - filter Length
* RETURNS		: SUCCESS on successful set operation
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
*************************************************************************************/
int LTKPreprocessor::setFilterLength (int filterLength)
{
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Entered LTKPreprocessor::setFilterLength" <<endl;

	int errorCode;
	if(filterLength <= 0)
    {
        LOG(LTKLogger::LTK_LOGLEVEL_ERR)
              <<"Error : "<< ENON_POSITIVE_NUM <<":"<< getErrorMessage(ENON_POSITIVE_NUM)
              <<"LTKPreprocessor::setFilterLength" <<endl;

        LTKReturnError(ENON_POSITIVE_NUM);
    }
	this->m_filterLength = filterLength;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "m_filterLength = " + m_filterLength <<endl;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Exiting LTKPreprocessor::setFilterLength" <<endl;

	return SUCCESS;
}

/**********************************************************************************
* AUTHOR		: Balaji R.
* DATE			: 23-DEC-2004
* NAME			: setHookLengthThreshold1
* DESCRIPTION	: sets the length threshold to detect hooks
* ARGUMENTS		: hookLengthThreshold1 - length threshold to detect hooks
* RETURNS		: SUCCESS on successful set operation
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
*************************************************************************************/
int LTKPreprocessor::setHookLengthThreshold1(float hookLengthThreshold1)
{
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Entered LTKPreprocessor::setHookLengthThreshold1" <<endl;

	if(hookLengthThreshold1 < 0)
    {
        LOG(LTKLogger::LTK_LOGLEVEL_ERR)
              <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
              <<"LTKPreprocessor::setHookLengthThreshold1" <<endl;

        LTKReturnError(ENEGATIVE_NUM);
    }

	this->m_hookLengthThreshold1 = hookLengthThreshold1;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "m_hookLengthThreshold1 = " <<  m_hookLengthThreshold1 <<endl;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Exiting LTKPreprocessor::setHookLengthThreshold1" <<endl;

	return SUCCESS;
}

/**********************************************************************************
* AUTHOR		: Balaji R.
* DATE			: 23-DEC-2004
* NAME			: setHookLengthThreshold2
* DESCRIPTION	: sets the length threshold to detect hooks
* ARGUMENTS		: hookLengthThreshold2 - length threshold to detect hooks
* RETURNS		: SUCCESS on successful set operation
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
*************************************************************************************/

int LTKPreprocessor::setHookLengthThreshold2(float hookLengthThreshold2)
{
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Entered LTKPreprocessor::setHookLengthThreshold2" <<endl;
	if(hookLengthThreshold2 < 0)
    {
        LOG(LTKLogger::LTK_LOGLEVEL_ERR)
              <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
              <<"LTKPreprocessor::setHookLengthThreshold2" <<endl;

        LTKReturnError(ENEGATIVE_NUM);
    }

	this->m_hookLengthThreshold2 = hookLengthThreshold2;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "m_hookLengthThreshold2 = " <<  m_hookLengthThreshold2 <<endl;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Exiting LTKPreprocessor::setHookLengthThreshold2" <<endl;

	return SUCCESS;

}

/**********************************************************************************
* AUTHOR		: Balaji R.
* DATE			: 23-DEC-2004
* NAME			: setHookAngleThreshold
* DESCRIPTION	: sets the angle threshold to detect hooks
* ARGUMENTS		: hookAngleThreshold - angle threshold to detect hooks
* RETURNS		: SUCCESS on successful set operation
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
*************************************************************************************/

int LTKPreprocessor::setHookAngleThreshold(float hookAngleThreshold)
{
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Entered LTKPreprocessor::setHookAngleThreshold" <<endl;

	if(hookAngleThreshold < 0)
    {
        LOG(LTKLogger::LTK_LOGLEVEL_ERR)
              <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
              <<"LTKPreprocessor::setHookAngleThreshold" <<endl;

        LTKReturnError(ENEGATIVE_NUM);
    }

	this->m_hookAngleThreshold = hookAngleThreshold;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "m_hookAngleThreshold = " <<  m_hookAngleThreshold <<endl;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Exiting LTKPreprocessor::setHookAngleThreshold" <<endl;

	return SUCCESS;

}

/**********************************************************************************
* AUTHOR		: Dinesh M
* DATE			: 31-May-2007
* NAME			: setQuantizationStep
* DESCRIPTION	: sets the value of the quantization step used in resampling
* ARGUMENTS		:
* RETURNS		: SUCCESS on successful set operation
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
*Nidhi Sharma       13-Sept-2007        Added a check on input parameter
*************************************************************************************/


int LTKPreprocessor::setQuantizationStep(int quantizationStep)
{
    int errorCode;
	if(quantizationStep < 1)
    {
        LOG(LTKLogger::LTK_LOGLEVEL_ERR)
              <<"Error : "<< ECONFIG_FILE_RANGE <<":"<< getErrorMessage(ECONFIG_FILE_RANGE)
              <<"LTKPreprocessor::setQuantizationStep" <<endl;

        LTKReturnError(ECONFIG_FILE_RANGE);
    }
    
	m_quantizationStep = quantizationStep;
              
	return SUCCESS;
}

/**********************************************************************************
* AUTHOR		: Dinesh M
* DATE			: 31-May-2007
* NAME			: setResamplingMethod
* DESCRIPTION	: sets the type of resampling method being used in preprocessing
* ARGUMENTS		:
* RETURNS		: SUCCESS on successful set operation
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
* Nidhi Sharma      13-Sept-2007        Added a check on input parameter
*************************************************************************************/
int LTKPreprocessor::setResamplingMethod(const string& resamplingMethod)
{
    int returnVal = FAILURE;

    if ( LTKSTRCMP(resamplingMethod.c_str(), LENGTHBASED) == 0 ||
         LTKSTRCMP(resamplingMethod.c_str(), POINTBASED ) == 0 )
    {
        m_resamplingMethod = resamplingMethod;

        LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
            "Resampling Method = " << m_resamplingMethod << endl;

        return SUCCESS;
    }

    LOG(LTKLogger::LTK_LOGLEVEL_ERR)
        <<"Error : "<< ECONFIG_FILE_RANGE <<":"<< getErrorMessage(ECONFIG_FILE_RANGE)
        <<"LTKPreprocessor::setResamplingMethod" <<endl;

    LTKReturnError(ECONFIG_FILE_RANGE);
}



/**********************************************************************************
* AUTHOR		: Balaji R.
* DATE			: 23-DEC-2004
* NAME			: calculateSlope
* DESCRIPTION	: calculates the slope of the line joining two 2-d points
* ARGUMENTS		: x1 - x co-ordinate of point 1
*				  y1 - y co-ordinate of point 1
*				  x2 - x co-ordinate of point 2
*				  y2 - y co-ordinate of point 2
* RETURNS		: slope of the line joining the two 2-d points
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
*************************************************************************************/

float LTKPreprocessor::calculateSlope (float x1,float y1,float x2,float y2)
{
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Entered LTKPreprocessor::calculateSlope" <<endl;

	//	yet to be implemented

	float slope=0.0f;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Exiting LTKPreprocessor::calculateSlope" <<endl;

	return slope;
}

/**********************************************************************************
* AUTHOR		: Balaji R.
* DATE			: 23-DEC-2004
* NAME			: calculateEuclidDist
* DESCRIPTION	: calculates the euclidean distance between two 2-d points
* ARGUMENTS		: x1 - x co-ordinate of point 1
*				  x2 - x co-ordinate of point 2
*				  y1 - y co-ordinate of point 1
*				  y2 - y co-ordinate of point 2
* RETURNS		: euclidean distance between the two 2-d points
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
*************************************************************************************/

float LTKPreprocessor::calculateEuclidDist(float x1,float x2,float y1,float y2)
{
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<   "Entered LTKPreprocessor::calculateEuclidDist" <

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -