📄 ltkpreprocessor.cpp
字号:
firstPoint = dominantPoints[1];
}
else
{
firstPoint = dominantPoints[0];
}
dPX1 = xVec[dominantPoints[numDominantPoints - 1]];
dPY1 = yVec[dominantPoints[numDominantPoints - 1]];
dPX2 = xVec[dominantPoints[numDominantPoints - 2]];
dPY2 = yVec[dominantPoints[numDominantPoints - 2]];
dPX3 = xVec[dominantPoints[numDominantPoints - 2] - 1];
dPY3 = yVec[dominantPoints[numDominantPoints - 2] - 1];
dPX4 = xVec[dominantPoints[numDominantPoints - 2] + 1];
dPY4 = yVec[dominantPoints[numDominantPoints - 2] + 1];
if( (errorCode = computeTraceLength(trace, dominantPoints[numDominantPoints - 2], dominantPoints[numDominantPoints - 1],L0))!= SUCCESS)
{
LOG(LTKLogger::LTK_LOGLEVEL_ERR)
<<"Error: LTKPreprocessor::resampleTraceGroup"<<endl;
LTKReturnError(errorCode);
}
angle = (acos(((dPX1 - dPX2) * (dPX3 - dPX2) + (dPY1 - dPY2) * (dPY3 - dPY2)) /
(calculateEuclidDist(dPX2, dPX1, dPY2, dPY1) * calculateEuclidDist(dPX2, dPX3, dPY2, dPY3)))) * 180 / 3.14;
if((L0/scale) < this->m_hookLengthThreshold1 || (((L0/scale) < this->m_hookLengthThreshold2) &&
(angle < this->m_hookAngleThreshold)))
{
lastPoint = dominantPoints[numDominantPoints - 2];
}
else
{
lastPoint = dominantPoints[numDominantPoints - 1];
}
floatVector newXVec(xVec.begin() + firstPoint, xVec.begin() + lastPoint + 1);
floatVector newYVec(yVec.begin() + firstPoint, yVec.begin() + lastPoint + 1);
float2DVector allChannelValuesVec;
allChannelValuesVec.push_back(newXVec);
allChannelValuesVec.push_back(newYVec);
LTKTrace newTrace;
if( (errorCode = newTrace.setAllChannelValues(allChannelValuesVec)) != SUCCESS)
{
LOG(LTKLogger::LTK_LOGLEVEL_ERR)
<<"Error: LTKPreprocessor::dehookTraces"<<endl;
LTKReturnError(errorCode);
}
tempTraceVector.push_back(newTrace);
}
else
{
tempTraceVector.push_back(trace);
/*
if( (errorCode = outTraceGroup.addTrace(trace)) != SUCCESS)
{
LOG(LTKLogger::LTK_LOGLEVEL_ERR)
<<"Error: LTKPreprocessor::dehookTraces"<<endl;
LTKReturnError(errorCode);
}
*/
}
outTraceGroup.setAllTraces(tempTraceVector,
inTraceGroup.getXScaleFactor(),
inTraceGroup.getYScaleFactor());
quantizedSlopes.clear();
dominantPoints.clear();
maxValues.clear();
minValues.clear();
}
return SUCCESS;
}
/**********************************************************************************
* AUTHOR : Balaji R.
* DATE : 23-DEC-2004
* NAME : orderTraces
* DESCRIPTION : reorders the traces to a pre-defined empirical order
* ARGUMENTS :
* RETURNS : SUCCESS on successful reordering operation
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
int LTKPreprocessor::orderTraces (const LTKTraceGroup& inTraceGroup,
LTKTraceGroup& outTraceGroup)
{
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
"Entered LTKPreprocessor::orderTraces" <<endl;
// yet to be implemented
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
"Exiting LTKPreprocessor::orderTraces" <<endl;
return SUCCESS;
}
/**********************************************************************************
* AUTHOR : Balaji R.
* DATE : 23-DEC-2004
* NAME : reorientTraces
* DESCRIPTION : reorients the traces to a pre-defined empirical direction
* ARGUMENTS :
* RETURNS : SUCCESS on successful reorientation operation
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
int LTKPreprocessor::reverseTrace(const LTKTrace& inTrace, LTKTrace& outTrace)
{
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::reverseTrace" <<endl;
int pointIndex;
floatVector revXVec, revYVec;
floatVector xVec, yVec;
int errorCode;
if( (errorCode = inTrace.getChannelValues(X_CHANNEL_NAME, xVec)) != SUCCESS)
{
LOG(LTKLogger::LTK_LOGLEVEL_ERR)
<<"Error: LTKPreprocessor::reverseTrace"<<endl;
LTKReturnError(errorCode);
}
if( (errorCode = inTrace.getChannelValues(Y_CHANNEL_NAME, yVec)) != SUCCESS)
{
LOG(LTKLogger::LTK_LOGLEVEL_ERR)
<<"Error: LTKPreprocessor::reverseTrace"<<endl;
LTKReturnError(errorCode);
}
// reversing the trace
for(pointIndex = xVec.size() - 1; pointIndex >= 0 ; --pointIndex)
{
revXVec.push_back(xVec[pointIndex]);
revYVec.push_back(yVec[pointIndex]);
}
outTrace = inTrace;
outTrace.reassignChannelValues(X_CHANNEL_NAME, revXVec);
outTrace.reassignChannelValues(Y_CHANNEL_NAME, revYVec);
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::reverseTrace" <<endl;
return SUCCESS;
}
/**********************************************************************************
* AUTHOR : Balaji R.
* DATE : 23-DEC-2004
* NAME : duplicatePoints
* DESCRIPTION :
* ARGUMENTS :
* RETURNS : SUCCESS on successful duplication of points operation
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
int LTKPreprocessor::duplicatePoints (const LTKTraceGroup& traceGroup, int traceDimension)
{
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::duplicatePoints" <<endl;
// yet to be implemented
LOG( LTKLogger::LTK_LOGLEVEL_ERR)<< "LTKPreprocessor::duplicatePoints - method not implemented" <<endl;
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::duplicatePoints" <<endl;
return SUCCESS;
}
/**********************************************************************************
* AUTHOR : Dinesh M
* DATE : 24-Aug-2006
* NAME : getPreserveAspectRatio
* DESCRIPTION : gets the value of the m_preserveAspectRatio member variable
* ARGUMENTS :
* RETURNS : true or false
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
bool LTKPreprocessor::getPreserveAspectRatio() const
{
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getPreserveAspectRatio" <<endl;
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getPreserveAspectRatio with return value " << m_preserveAspectRatio <<endl;
return m_preserveAspectRatio;
}
/**********************************************************************************
* AUTHOR : Dinesh M
* DATE : 24-Aug-2006
* NAME : getPreserveRealtiveYPosition
* DESCRIPTION : gets the value of the m_preserveAspectRatio member variable
* ARGUMENTS :
* RETURNS : true or false
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
bool LTKPreprocessor::getPreserveRealtiveYPosition() const
{
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getPreserveRealtiveYPosition" <<endl;
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getPreserveRealtiveYPosition with return value " << m_preserveRelativeYPosition <<endl;
return m_preserveRelativeYPosition;
}
/**********************************************************************************
* AUTHOR : Balaji R.
* DATE : 23-DEC-2004
* NAME : getSizeThreshold
* DESCRIPTION : gets the size threshold below which traces will not be rescaled
* ARGUMENTS :
* RETURNS : size threshold below which traces will not be rescaled
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
float LTKPreprocessor::getSizeThreshold () const
{
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getSizeThreshold" <<endl;
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getSizeThreshold with return value " << m_sizeThreshold <<endl;
return m_sizeThreshold;
}
/**********************************************************************************
* AUTHOR : Balaji R.
* DATE : 23-DEC-2004
* NAME : getLoopThreshold
* DESCRIPTION : gets the threshold below which the trace would considered a loop
* ARGUMENTS :
* RETURNS : threshold below which the trace would considered a loop
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
float LTKPreprocessor::getLoopThreshold () const
{
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getLoopThreshold" <<endl;
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getLoopThreshold with return value " << m_loopThreshold <<endl;
return m_loopThreshold;
}
/**********************************************************************************
* AUTHOR : Balaji R.
* DATE : 23-DEC-2004
* NAME : getAspectRatioThreshold
* DESCRIPTION : returns threshold below which aspect ration will be maintained
* ARGUMENTS :
* RETURNS : threshold below which aspect ration will be maintained
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
float LTKPreprocessor::getAspectRatioThreshold () const
{
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getAspectRatioThreshold" <<endl;
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getAspectRatioThreshold with return value " << m_aspectRatioThreshold <<endl;
return m_aspectRatioThreshold;
}
/**********************************************************************************
* AUTHOR : Balaji R.
* DATE : 23-DEC-2004
* NAME : getDotThreshold
* DESCRIPTION : returns threshold to detect dots
* ARGUMENTS :
* RETURNS : threshold to detect dots
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
float LTKPreprocessor::getDotThreshold () const
{
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getDotThreshold" <<endl;
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getDotThreshold with return value " << m_dotThreshold <<endl;
return m_dotThreshold;
}
/**********************************************************************************
* AUTHOR : Dinesh M
* DATE : 31-May-2007
* NAME : getQuantizationStep
* DESCRIPTION : returns the value of the quantization step used in resampling
* ARGUMENTS :
* RETURNS : return the m_quantizationStep of the preprocessor
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
int LTKPreprocessor::getQuantizationStep() const
{
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getQuantizationStep" <<endl;
return m_quantizationStep;
LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getQuantizationStep with return value " << m_quantizationStep <<endl;
}
/**********************************************************************************
* AUTHOR : Dinesh M
* DATE : 31-May-2007
* NAME : getResamplingMethod
* DESCRIPTION : returns the type of resampling method being used in preprocessing
* ARGUMENTS :
* RETURNS : the m_resamplingMethod value
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
string LTKPreprocessor::getResamplingMethod() const
{
LOG( LTKLogger::LTK_LOGLEVEL_INFO)<< "Entered LTKPreprocessor::getResamplingMethod" <<endl;
return m_resamplingMethod;
LOG( LTKLogger::LTK_LOGLEVEL_INFO)<< "Exiting LTKPreprocessor::getResamplingMethod" <<endl;
}
/**********************************************************************************
* AUTHOR : Srinivasa Vithal, Ch.
* DATE : 18-Jun-2008
* NAME : getTraceDimension
* DESCRIPTION : returns the value of resamplingTraceDimension
* ARGUMENTS :
* RETURNS : the m_traceDimension value
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
const int LTKPreprocessor::getTraceDimension() const
{
LOG( LTKLogger::LTK_LOGLEVEL_INFO)<< "Entered LTKPreprocessor::getTraceDimension" <<endl;
return m_traceDimension;
LOG( LTKLogger::LTK_LOGLEVEL_INFO)<< "Exiting LTKPreprocessor::getTraceDimension" <<endl;
}
/**********************************************************************************
* AUTHOR : Srinivasa Vithal, Ch.
* DATE : 18-Jun-2008
* NAME : getFilterLength
* DESCRIPTION : returns the value of m_filterLength
* ARGUMENTS :
* RETURNS : the m_filterLength value
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
const int LTKPreprocessor::getFilterLength() const
{
LOG( LTKLogger::LTK_LOGLEVEL_INFO)<< "Entered LTKPreprocessor::getFilterLength" <<endl;
return m_filterLength;
LOG( LTKLogger::LTK_LOGLEVEL_INFO)<< "Exiting LTKPreprocessor::getFilterLength" <<endl;
}
/**********************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -