Can someone explain the logic of this codes please
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
QStringList Para_Meters;
std::string Secret_Code;
QString CaptureInterval;
QString MaximumCaptureTime;
std::string Para_MetersInString = val.toStdString();
std::string ifContain = ",";
if (Para_MetersInString.find(ifContain) != std::string::npos)
{
Para_Meters = val.split(",");
int parameterSize = Para_Meters.size();
if(QString::compare(Para_Meters.at(1).toLower(),"logs") == 0){
if(parameterSize == 3){
Secret_Code = Para_Meters.at(0).toStdString();
CaptureInterval = "111";
MaximumCaptureTime = Para_Meters.at(2);
}else{
Secret_Code = Para_Meters.at(0).toStdString();
CaptureInterval = Para_Meters.at(2);
MaximumCaptureTime = Para_Meters.at(3);
}
}
else{
if(parameterSize == 2){
Secret_Code = Para_Meters.at(0).toStdString();
CaptureInterval = "111";
MaximumCaptureTime = Para_Meters.at(1);
}else{
Secret_Code = Para_Meters.at(0).toStdString();
CaptureInterval = Para_Meters.at(1);
MaximumCaptureTime = Para_Meters.at(2);
}
}
}
//if(Secret_Code == "JORGE_PANGIT_DEBUG")
if(Secret_Code == "MARQUEE")
{
QString capturingIntervalLog = "";
if(CaptureInterval == "111")
{
capturingIntervalLog = "100";
}
else
{
capturingIntervalLog = CaptureInterval;
}
if(QString::compare(Para_Meters.at(1).toLower(),"logs") == 0){
mpParent->logUpdate("Reading Marquee OCR for " + obj + " with capturing interval of " + capturingIntervalLog + "msec" + " and Maximum Capturing time of "+MaximumCaptureTime +" msec" );
}
else{
mpParent->logUpdate("Marquee OCR Reading for " + obj + " for capturing interval of " + capturingIntervalLog + "msec" + " Maximum Capturing time of "+MaximumCaptureTime +" msec" );
}
mpParent->XMLUpdate("Marquee OCR Reading");
mpParent->XMLUpdate(obj);
mpParent->XMLUpdate(val);
}
else
{
mpParent->logUpdate("Reading " + obj + " for " + val + "msec");
mpParent->XMLUpdate(act);
mpParent->XMLUpdate(obj);
mpParent->XMLUpdate(val);
}
if (NULL != mpScFtOcr)
{
int rect[4];
rect[0] = roi.split(':').at(0).toInt();
rect[1] = roi.split(':').at(1).toInt();
rect[2] = roi.split(':').at(2).toInt();
rect[3] = roi.split(':').at(3).toInt();
mpReadData.clear();
if (!val.isEmpty())
{
if(data.at(4).compare("") != 0)
{
mpScFtOcr->SetModel(model.toStdString());
}
//if(Secret_Code == "JORGE_PANGIT_DEBUG")
if(Secret_Code == "MARQUEE")
{
mpReadData = mpScFtOcr->read(CaptureInterval.toInt(),rect,MaximumCaptureTime.toInt());
}
else
{
mpReadData = mpScFtOcr->read(rect, val.toInt());
}
}
mpParent->_result = mpReadData.size() > 0 ? true:false;
}
if(Secret_Code == "MARQUEE"){
if(QString::compare(Para_Meters.at(1).toLower(),"logs") == 0){
mpParent->_actualValue = mpParent->storeImageAsFile(mpScFtOcr->stitched_images);
}
}
mpParent->logUpdate(mpParent->_result ? "DONE" : "FAIL");
mpParent->XMLUpdate(mpParent->_result ? "DONE" : "FAIL");
if(mpParent->_result){
float fnxtime;
if(Secret_Code == "MARQUEE"){
int processTime = mpScFtOcr->getProcTime();
fnxtime = processTime/1000.0;
}else{
fnxtime = (std::stoll(mpReadData[mpReadData.size()-1][0])-std::stoll(mpReadData[0][0]))/1000.0;
}
QString num = QString::number(fnxtime);
mpParent->logUpdate(num);
mpParent->XMLUpdate(num);
}else{
mpParent->logUpdate("-");
mpParent->XMLUpdate("-");
}
}
}
| |
Last edited on
No, thank you.
Sorry its my first time, I used the code tags now please reconsider checking it again thank you
That's a sizeable chunk of code. Can you be specific about which bit(s) you don't understand?
EDIT: *Sigh* Please DON'T post multiple threads for the same topic. It wastes everyone's time.
How is this not obvious?
http://www.cplusplus.com/forum/beginner/248338/
Last edited on
Topic archived. No new replies allowed.