mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 20:46:52 +03:00
Added Counter Clockwise option for analog dial.
This commit is contained in:
@@ -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);
|
||||
|
||||
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();
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -116,11 +116,12 @@ th, td {
|
||||
<tr>
|
||||
<td>x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()" tabindex=2></td>
|
||||
<td>dx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchangeddx()" tabindex=4></td>
|
||||
<td rowspan="2"><label for="lockAR"> Lock aspect ratio: </label><input type="checkbox" id="lockAR" name="lockAR" value="1" onclick="changelockAR()" checked tabindex=6></td>
|
||||
<td rowspan="1"><label for="lockAR"> Lock aspect ratio: </label><input type="checkbox" id="lockAR" name="lockAR" value="1" onclick="changelockAR()" checked tabindex=6></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()" tabindex=3></td>
|
||||
<td>dy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()" tabindex=5></td>
|
||||
<td rowspan="1"><label for="CCW"> Counter-Clockwise Rotation: </label><input type="checkbox" id="CCW" name="CCW" value="0" onclick="changeCCW()" checked tabindex=6></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -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"];
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user