📄 mdv.cpp
字号:
(LTKSTRCMP(fileName.c_str(), argv[index]) == 0) ||
(LTKSTRCMP(argv[index], "-LIPIROOT") == 0) ||
(LTKSTRCMP(m_strLipiRootPath.c_str(), argv[index]) == 0))
{
++index;
continue;
}
if( (LTKSTRCMP(argv[index], "-DATASET") == 0) ||
(LTKSTRCMP(argv[index], "-COMMENT") == 0) ||
(LTKSTRCMP(argv[index], "-COMMENTLEN") == 0))
{
++index;
continue;
}
if(LTKSTRCMP(argv[index], "-PLATFORM") == 0)
{
cout << "Platform - " << headerSequence[PLATFORM] << endl;
cout << " " << headerSequence[OSVERSION] << endl;
cout << " " << headerSequence[PROCESSOR_ARCHITEC] << endl;
++index;
continue;
}
description = optMap[stringToUpper(argv[index])].description;
if(description.empty())
cout << "UnKnown Option - "<< argv[index] << endl;
else
cout << optMap[argv[index]].description << optMap[argv[index]].value << endl;
++index;
}
LTKLoggerUtil::destroyLogger();
return SUCCESS;
}
/**********************************************************************************
* AUTHOR : Vijayakumara M
* DATE : 23 Aug 2005
* NAME : helpDisplay
* DESCRIPTION : This function reades the contents of help.txt file and Displays it
* on the screen.
* ARGUMENTS : - No -
* RETURNS : 0 on success and -1 on failure.
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
************************************************************************************/
int helpDisplay()
{
cout << "mdv -input <md file name> -lipiroot <lipi root> \n "
<< " <option1> <option2> ...\n"<< endl;
cout << "options :" << endl;
cout << "[-help] - Displays the usage of this tool" << endl;
cout << "[-projname] - Displays the name of the project" << endl;
cout << "[-numshapes] - Displays the number of shapes" << endl;
cout << "[-recname] - Displays the name of the shape recognizer" << endl;
cout << "[-recver] - Displays the version the shape recognizer" << endl;
cout << "[-checksum] - Displays the checksum of the file" << endl;
cout << "[-createtime] - Displays the date on which the modle data file created" << endl;
cout << "[-modtime] - Displays the last modified date of model data file" << endl;
cout << "[-headerlen] - Displays the length of the model data header" << endl;
cout << "[-dataoffset] - Displays the byte offset value of the start of data in file" << endl;
cout << "[-headerver] - Displays the version of model data header" << endl;
cout << "[-byteorder] - Displays the byte order - Little endian or big endian" << endl;
cout << "[-platform] - Displays the platform on which this file is created" << endl;
cout << "[-ver] - Displays the version of this tool" << endl;
cout << "[-preproc] - Displays the preproc fields" << endl;
cout << "[-all] - Displays all the fields" << endl;
return SUCCESS;
}
/**********************************************************************************
* AUTHOR : Vijayakumara M
* DATE : 23 Aug 2005
* NAME : mapOptions
* DESCRIPTION : Do the mapping with the option and the respective description and value.
* ARGUMENTS : - No -
* RETURNS : SUCCESS on successful map operation.
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
int mapOptions(stringStructMap &optMap, stringStringMap &headerSequence)
{
option obj;
char *ptr;
obj.description = "Project name - ";
obj.value = headerSequence[PROJNAME];
optMap["-PROJNAME"] =obj;
obj.description = "Number of shapes used - ";
obj.value = headerSequence[NUMSHAPES];
optMap["-NUMSHAPES"] = obj;
obj.description = "Shape recognizer name - ";
obj.value = headerSequence[RECNAME];
optMap["-RECNAME"] = obj;
obj.description = "Shape recognizer version - ";
obj.value = headerSequence[RECVERSION];
optMap["-RECVER"] = obj;
obj.description = "Checksum - ";
obj.value = headerSequence[CKS];
optMap["-CHECKSUM"] = obj;
obj.description = "Feature Extractor - ";
obj.value = headerSequence[FE_NAME];
optMap["-FEATEXTR"] = obj;
obj.description = "Data creation time - ";
obj.value = headerSequence[CREATETIME].c_str();
optMap["-CREATETIME"] = obj;
obj.description = "Data modified time - ";
obj.value = headerSequence[MODTIME].c_str();
optMap["-MODTIME"] = obj;
obj.description = "Header length - ";
obj.value = headerSequence[HEADERLEN];
optMap["-HEADERLEN"] = obj;
obj.description = "Data offset - ";
obj.value = headerSequence[DATAOFFSET];
optMap["-DATAOFFSET"] = obj;
obj.description = "Header version - ";
obj.value = headerSequence[HEADERVER];
optMap["-HEADERVER"] = obj;
obj.description = "Byte order - ";
if(headerSequence[BYTEORDER] == "LE")
obj.value = "Little endian";
else
obj.value = "Big endian";
optMap["-BYTEORDER"] = obj;
return SUCCESS;
}
/*****************************************************************************
* AUTHOR : Vijayakumara M
* DATE : 23 Aug 2005
* NAME : StringToUpper
* DESCRIPTION : This method converts the string to upper case.
* ARGUMENTS : String to be convert in to upper case.
* RETURNS : The converted string in upper uase.
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*****************************************************************************/
char* stringToUpper(char *strToConvert)
{
int i;
//change each element of the string to upper case
for(i=0;i< strlen(strToConvert);i++)
{
strToConvert[i] = toupper(strToConvert[i]);
}
return strToConvert;//return the converted string
}
/*****************************************************************************
* AUTHOR : Nidhi Sharma
* DATE : 11 Aug 2008
* NAME : mapLogLevel
* DESCRIPTION :
* ARGUMENTS :
* RETURNS :
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*****************************************************************************/
int mapLogLevel(const string& logLevelStr, LTKLogger::EDebugLevel& outLogLevel)
{
const char * strLogLevelPtr = logLevelStr.c_str();
// mapping m_LogLevel to Logger log levels
if(LTKSTRCMP(strLogLevelPtr, LOG_LEVEL_DEBUG) == 0)
{
outLogLevel = LTKLogger::LTK_LOGLEVEL_DEBUG;
}
else if(LTKSTRCMP(strLogLevelPtr, LOG_LEVEL_ALL) == 0)
{
outLogLevel = LTKLogger::LTK_LOGLEVEL_ALL;
}
else if(LTKSTRCMP(strLogLevelPtr, LOG_LEVEL_VERBOSE) == 0)
{
outLogLevel = LTKLogger::LTK_LOGLEVEL_VERBOSE;
}
else if(LTKSTRCMP(strLogLevelPtr, LOG_LEVEL_ERROR) == 0)
{
outLogLevel = LTKLogger::LTK_LOGLEVEL_ERR;
}
else if(LTKSTRCMP(strLogLevelPtr, LOG_LEVEL_OFF) == 0)
{
outLogLevel = LTKLogger::LTK_LOGLEVEL_OFF;
}
else if(LTKSTRCMP(strLogLevelPtr, LOG_LEVEL_INFO) == 0)
{
outLogLevel = LTKLogger::LTK_LOGLEVEL_INFO;
}
else
{
LTKReturnError(EINVALID_LOG_LEVEL);
}
return SUCCESS;
}
/*****************************************************************************
* AUTHOR : Balaji, M N A
* DATE : 21 Aug 2008
* NAME : DisplayPreProc
* DESCRIPTION :
* ARGUMENTS :
* RETURNS :
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*****************************************************************************/
void DisplayPreProc(stringStructMap optPreprocMap)
{
char preprocOptIndex[NO_PREPROC_FIELDS][20]={"-TRACE_DIM" ,
"-RESAMP_POINT_ALLOC" ,
"-DOT_SIZE_THRES" ,
"-NORM_LN_WID_THRES" ,
"-PRESER_ASP_RATIO" ,
"-ASP_RATIO_THRES" ,
"-PRESER_REL_Y_POS" ,
"-SMOOTH_WIND_SIZE" ,
"-PREPROC_SEQ" };
cout << "Preprocessing configuration values" << endl;
for (int i=0; i < NO_PREPROC_FIELDS && preprocOptIndex[i][0] != '\0' ; i++)
{
if(!(optPreprocMap[preprocOptIndex[i]].description.empty()))
cout << "\t" << optPreprocMap[preprocOptIndex[i]].description << optPreprocMap[preprocOptIndex[i]].value << endl;
}
}
/**********************************************************************************
* AUTHOR : Balaji, M N A
* DATE : 21 Aug 2008
* NAME : mapOptions
* DESCRIPTION : Do the mapping with the preprocessing option and the respective description and value.
* ARGUMENTS : - No -
* RETURNS : SUCCESS on successful map operation.
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
int mapPreprocOptions(stringStructMap &optPreprocMap, stringStringMap &headerSequence)
{
option obj;
//Preproc fields
obj.description = TRACEDIMENSION;
obj.description += " - ";
obj.value = headerSequence[TRACE_DIM];
optPreprocMap["-TRACE_DIM"] =obj;
obj.description = RESAMPLINGMETHOD;
obj.description += " - ";
obj.value = headerSequence[RESAMP_POINT_ALLOC];
optPreprocMap["-RESAMP_POINT_ALLOC"] =obj;
obj.description = DOTTHRESHOLD;
obj.description += " - ";
obj.value = headerSequence[DOT_SIZE_THRES];
optPreprocMap["-DOT_SIZE_THRES"] =obj;
obj.description = SIZETHRESHOLD;
obj.description += " - ";
obj.value = headerSequence[NORM_LN_WID_THRES];
optPreprocMap["-NORM_LN_WID_THRES"] =obj;
obj.description = PRESERVEASPECTRATIO;
obj.description += " - ";
obj.value = headerSequence[PRESER_ASP_RATIO];
optPreprocMap["-PRESER_ASP_RATIO"] =obj;
obj.description = ASPECTRATIOTHRESHOLD;
obj.description += " - ";
obj.value = headerSequence[ASP_RATIO_THRES];
optPreprocMap["-ASP_RATIO_THRES"] =obj;
obj.description = PRESERVERELATIVEYPOSITION;
obj.description += " - ";
obj.value = headerSequence[PRESER_REL_Y_POS];
optPreprocMap["-PRESER_REL_Y_POS"] =obj;
obj.description = SMOOTHFILTERLENGTH;
obj.description += " - ";
obj.value = headerSequence[SMOOTH_WIND_SIZE];
optPreprocMap["-SMOOTH_WIND_SIZE"] =obj;
obj.description = PREPROCSEQUENCE;
obj.description += " - ";
obj.value = headerSequence[PREPROC_SEQ];
optPreprocMap["-PREPROC_SEQ"] =obj;
return SUCCESS;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -