diff --git a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp index 83243e30..b4407b0f 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp @@ -395,6 +395,7 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph) neuroi->posy = std::stoi(zerlegt[2]); neuroi->deltax = std::stoi(zerlegt[3]); neuroi->deltay = std::stoi(zerlegt[4]); + neuroi->CCW = std::stoi(zerlegt[5]); neuroi->result_float = -1; neuroi->image = NULL; neuroi->image_org = NULL; @@ -680,7 +681,12 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time) f1 = tflite->GetOutputValue(0); f2 = tflite->GetOutputValue(1); float result = fmod(atan2(f1, f2) / (M_PI * 2) + 2, 1); - GENERAL[_ana]->ROI[i]->result_float = result * 10; + + if(GENERAL[_ana]->ROI[i]->CCW) + GENERAL[_ana]->ROI[i]->result_float = 10 - (result * 10); + else + GENERAL[_ana]->ROI[i]->result_float = result * 10; + printf("Result General(Analog)%i: %f\n", i, GENERAL[_ana]->ROI[i]->result_float); if (isLogImage) LogImage(logPath, GENERAL[_ana]->ROI[i]->name, &GENERAL[_ana]->ROI[i]->result_float, NULL, time, GENERAL[_ana]->ROI[i]->image_org); @@ -872,9 +878,11 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time) _num = tflite->GetOutClassification(); - GENERAL[_ana]->ROI[i]->result_float = (float)_num / 10.0; + if(GENERAL[_ana]->ROI[i]->CCW) + GENERAL[_ana]->ROI[i]->result_float = 10 - ((float)_num / 10.0); + else + GENERAL[_ana]->ROI[i]->result_float = (float)_num / 10.0; - _result_save_file = GENERAL[_ana]->ROI[i]->result_float; diff --git a/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h b/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h index 98432886..8c1cf64b 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h +++ b/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h @@ -7,7 +7,7 @@ struct roi { int posx, posy, deltax, deltay; float result_float; int result_klasse; - bool isReject; + bool isReject, CCW; string name; CImageBasis *image, *image_org; }; diff --git a/sd-card/html/edit_analog.html b/sd-card/html/edit_analog.html index fb4bd03d..d9c11594 100644 --- a/sd-card/html/edit_analog.html +++ b/sd-card/html/edit_analog.html @@ -116,11 +116,12 @@ th, td { x: dx: - + y: dy: + @@ -146,6 +147,7 @@ th, td { ROIInfo, enhanceCon = false; lockAR = true; + CCW = false; basepath = "http://192.168.178.26"; @@ -204,9 +206,9 @@ function newROI(){ var _roinew = prompt("Please enter name of new ROI", "name"); if (ROIInfo.length > 0) - erg = CreateROI(_number, "analog", sel.selectedIndex, _roinew, 1, 1, ROIInfo[aktindex]["dx"], ROIInfo[aktindex]["dy"]); + erg = CreateROI(_number, "analog", sel.selectedIndex, _roinew, 1, 1, ROIInfo[aktindex]["dx"], ROIInfo[aktindex]["dy"],ROIInfo[aktindex]["CCW"]); else - erg = CreateROI(_number, "analog", sel.selectedIndex, _roinew, 1, 1, 30, 30); + erg = CreateROI(_number, "analog", sel.selectedIndex, _roinew, 1, 1, 30, 30, 0); if (erg != "") alert(erg); @@ -234,6 +236,10 @@ function changelockAR(){ lockAR = document.getElementById("lockAR").checked; } +function changeCCW(){ + CCW = document.getElementById("CCW").checked; +} + function ChangeSelection(){ aktindex = parseInt(document.getElementById("index").value); // lockAR = true; @@ -315,6 +321,7 @@ function UpdateROIs(){ } document.getElementById("lockAR").checked = lockAR; + document.getElementById("CCW").checked = CCW; document.getElementById("refx").value = ROIInfo[aktindex]["x"]; document.getElementById("refy").value = ROIInfo[aktindex]["y"]; diff --git a/sd-card/html/edit_digits.html b/sd-card/html/edit_digits.html index 5eb2d266..f6444f83 100644 --- a/sd-card/html/edit_digits.html +++ b/sd-card/html/edit_digits.html @@ -197,9 +197,9 @@ function newROI() { var _roinew = prompt("Please enter name of new ROI", "name"); if (ROIInfo.length > 0) - erg = CreateROI(_number, "digit", sel.selectedIndex, _roinew, 1, 1, ROIInfo[aktindex]["dx"], ROIInfo[aktindex]["dy"]); + erg = CreateROI(_number, "digit", sel.selectedIndex, _roinew, 1, 1, ROIInfo[aktindex]["dx"], ROIInfo[aktindex]["dy"], 0); else - erg = CreateROI(_number, "digit", sel.selectedIndex, _roinew, 1, 1, 30, 51); + erg = CreateROI(_number, "digit", sel.selectedIndex, _roinew, 1, 1, 30, 51, 0); if (erg != "") alert(erg); diff --git a/sd-card/html/readconfigparam.js b/sd-card/html/readconfigparam.js index 7977fce9..feb5bce4 100644 --- a/sd-card/html/readconfigparam.js +++ b/sd-card/html/readconfigparam.js @@ -398,6 +398,7 @@ function WriteConfigININew() text = text + " " + NUMBERS[_roi]["digit"][_roiddet]["y"]; text = text + " " + NUMBERS[_roi]["digit"][_roiddet]["dx"]; text = text + " " + NUMBERS[_roi]["digit"][_roiddet]["dy"]; + text = text + " " + NUMBERS[_roi]["digit"][_roiddet]["CCW"]; config_split.push(text); } } @@ -416,6 +417,7 @@ function WriteConfigININew() text = text + " " + NUMBERS[_roi]["analog"][_roiddet]["y"]; text = text + " " + NUMBERS[_roi]["analog"][_roiddet]["dx"]; text = text + " " + NUMBERS[_roi]["analog"][_roiddet]["dy"]; + text = text + " " + NUMBERS[_roi]["analog"][_roiddet]["CCW"]; config_split.push(text); } } @@ -484,6 +486,7 @@ function ExtractROIs(_aktline, _type){ abc["dx"] = linesplit[3]; abc["dy"] = linesplit[4]; abc["ar"] = parseFloat(linesplit[3]) / parseFloat(linesplit[4]); + abc["CCW"] = linesplit[5]; } @@ -712,7 +715,7 @@ function DeleteNUMBER(_delte){ return ""; } -function CreateROI(_number, _type, _pos, _roinew, _x, _y, _dx, _dy){ +function CreateROI(_number, _type, _pos, _roinew, _x, _y, _dx, _dy, _CCW){ _indexnumber = -1; for (j = 0; j < NUMBERS.length; ++j) if (NUMBERS[j]["name"] == _number) @@ -735,6 +738,7 @@ function CreateROI(_number, _type, _pos, _roinew, _x, _y, _dx, _dy){ _ret["dx"] = _dx; _ret["dy"] = _dy; _ret["ar"] = _dx / _dy; + _ret["CCW"] = _CCW; NUMBERS[_indexnumber][_type].splice(_pos+1, 0, _ret);