mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 12:36:52 +03:00
Rollling 20210313
This commit is contained in:
@@ -39,7 +39,10 @@ If you would like to support the developer with a cup of coffee you can do that
|
||||
|
||||
**General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
|
||||
|
||||
##### Rolling (2021-03-13)
|
||||
|
||||
* Bug-fixing for html code
|
||||
* based on v6.2.2
|
||||
|
||||
##### 6.2.2 Image Processing in Memory - (2021-03-10)
|
||||
|
||||
|
||||
Binary file not shown.
@@ -13,6 +13,7 @@ InitalRotate=180
|
||||
/config/ref1.jpg 456 138
|
||||
SearchFieldX = 20
|
||||
SearchFieldY = 20
|
||||
InitialMirror= false
|
||||
AlignmentAlgo = Default
|
||||
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ select {
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="2"><input class="button" type="submit" name="saveroi" onclick="SaveToConfig()" value="Save to Config.ini"></td>
|
||||
<td colspan="2"><input class="button" type="submit" name="saveroi" onclick="SaveToConfig()" value="Save all to Config.ini"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -93,6 +93,7 @@ select {
|
||||
<script type="text/javascript" src="./readconfig.js"></script>
|
||||
<script type="text/javascript" src="./readconfigcommon.js"></script>
|
||||
|
||||
|
||||
<script language="JavaScript">
|
||||
var canvas = document.getElementById('canvas'),
|
||||
ctx = canvas.getContext('2d'),
|
||||
@@ -101,7 +102,8 @@ select {
|
||||
drag = false,
|
||||
aktindex = 0,
|
||||
refInfo,
|
||||
enhanceCon = false;
|
||||
enhanceCon = false,
|
||||
param;
|
||||
basepath = "http://192.168.178.26";
|
||||
basepath = "";
|
||||
|
||||
@@ -111,61 +113,61 @@ function ChangeSelection(){
|
||||
}
|
||||
|
||||
function SaveToConfig(){
|
||||
refInfo["name"] = document.getElementById("name").value;
|
||||
refInfo["x"] = document.getElementById("refx").value;
|
||||
refInfo["y"] = document.getElementById("refy").value;
|
||||
refInfo["dx"] = document.getElementById("refdx").value;
|
||||
refInfo["dy"] = document.getElementById("refdy").value;
|
||||
UpdateConfig(refInfo, aktindex, enhanceCon, basepath);
|
||||
/*
|
||||
refInfo[aktindex]["name"] = document.getElementById("name").value;
|
||||
refInfo[aktindex]["x"] = document.getElementById("refx").value;
|
||||
refInfo[aktindex]["y"] = document.getElementById("refy").value;
|
||||
refInfo[aktindex]["dx"] = document.getElementById("refdx").value;
|
||||
refInfo[aktindex]["dy"] = document.getElementById("refdy").value;
|
||||
*/
|
||||
UpdateConfigReference(refInfo, basepath);
|
||||
}
|
||||
|
||||
function EnhanceContrast(){
|
||||
refInfo["name"] = document.getElementById("name").value;
|
||||
refInfo["x"] = document.getElementById("refx").value;
|
||||
refInfo["y"] = document.getElementById("refy").value;
|
||||
refInfo["dx"] = document.getElementById("refdx").value;
|
||||
refInfo["dy"] = document.getElementById("refdy").value;
|
||||
refInfo[aktindex]["name"] = document.getElementById("name").value;
|
||||
refInfo[aktindex]["x"] = document.getElementById("refx").value;
|
||||
refInfo[aktindex]["y"] = document.getElementById("refy").value;
|
||||
refInfo[aktindex]["dx"] = document.getElementById("refdx").value;
|
||||
refInfo[aktindex]["dy"] = document.getElementById("refdy").value;
|
||||
|
||||
enhanceCon = true;
|
||||
MakeContrastImageZW(refInfo, enhanceCon, basepath);
|
||||
var url = basepath + "/fileserver" + "/img_tmp/ref_zw.jpg?" + Date.now();
|
||||
document.getElementById("img_ref").src = url;
|
||||
var url = basepath + "/fileserver" + "/img_tmp/ref_zw_org.jpg?" + Date.now();
|
||||
document.getElementById("img_ref_org").src = url;
|
||||
MakeContrastImageZW(refInfo[aktindex], enhanceCon, basepath);
|
||||
UpdateReference();
|
||||
// var url = basepath + "/fileserver" + "/img_tmp/ref_zw.jpg?" + Date.now();
|
||||
// document.getElementById("img_ref").src = url;
|
||||
// var url = basepath + "/fileserver" + "/img_tmp/ref_zw_org.jpg?" + Date.now();
|
||||
// document.getElementById("img_ref_org").src = url;
|
||||
}
|
||||
|
||||
function UpdateReference(){
|
||||
refInfo = GetCoordinates(aktindex, basepath);
|
||||
document.getElementById("img_ref").onload = function () {
|
||||
document.getElementById("refdx").value = this.width;
|
||||
document.getElementById("refdy").value = this.height;
|
||||
refInfo["dx"] = this.width;
|
||||
refInfo["dy"] = this.height;
|
||||
refInfo[aktindex]["dx"] = this.width;
|
||||
refInfo[aktindex]["dy"] = this.height;
|
||||
rect.w = document.getElementById("refdx").value;
|
||||
rect.h = document.getElementById("refdy").value;
|
||||
draw();
|
||||
}
|
||||
|
||||
var url = basepath + "/fileserver" + "/img_tmp/ref_zw_org.jpg?" + Date.now();
|
||||
document.getElementById("img_ref_org").src = url;
|
||||
var url = basepath + "/fileserver" + "/img_tmp/ref_zw.jpg?" + Date.now();
|
||||
_filenameurl = refInfo[aktindex]["name"].replace("/config/", "/img_tmp/");
|
||||
|
||||
var url = basepath + "/fileserver" + _filenameurl + "?" + Date.now();
|
||||
document.getElementById("img_ref").src = url;
|
||||
|
||||
document.getElementById("name").value = refInfo["name"];
|
||||
document.getElementById("refx").value = refInfo["x"];
|
||||
document.getElementById("refy").value = refInfo["y"];
|
||||
_filenameurl = _filenameurl.replace(".jpg", "_org.jpg");
|
||||
var url = basepath + "/fileserver" + _filenameurl + "?" + Date.now();
|
||||
document.getElementById("img_ref_org").src = url;
|
||||
|
||||
document.getElementById("name").value = refInfo[aktindex]["name"];
|
||||
document.getElementById("refx").value = refInfo[aktindex]["x"];
|
||||
document.getElementById("refy").value = refInfo[aktindex]["y"];
|
||||
rect.startX = document.getElementById("refx").value;
|
||||
rect.startY = document.getElementById("refy").value;
|
||||
document.getElementById("enhancecontrast").disabled = true;
|
||||
draw();
|
||||
}
|
||||
|
||||
function ParseIni(_basepath) {
|
||||
loadConfig(_basepath);
|
||||
ParseConfig();
|
||||
UpdateReference();
|
||||
}
|
||||
|
||||
function dataURLtoBlob(dataurl) {
|
||||
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
|
||||
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
|
||||
@@ -207,11 +209,19 @@ function dataURLtoBlob(dataurl) {
|
||||
|
||||
function init() {
|
||||
basepath = getbasepath();
|
||||
loadConfig(basepath);
|
||||
ParseConfig();
|
||||
|
||||
canvas.addEventListener('mousedown', mouseDown, false);
|
||||
canvas.addEventListener('mouseup', mouseUp, false);
|
||||
canvas.addEventListener('mousemove', mouseMove, false);
|
||||
loadCanvas(basepath + "/fileserver/config/reference.jpg");
|
||||
ParseIni(basepath);
|
||||
|
||||
CopyReferenceToImgTmp(basepath);
|
||||
refInfo = GetReferencesInfo();
|
||||
|
||||
UpdateReference();
|
||||
|
||||
drawImage();
|
||||
}
|
||||
function drawImage(){
|
||||
@@ -226,17 +236,13 @@ function dataURLtoBlob(dataurl) {
|
||||
|
||||
|
||||
function CutOutReference(){
|
||||
refInfo["x"] = document.getElementById("refx").value;
|
||||
refInfo["y"] = document.getElementById("refy").value;
|
||||
refInfo["dx"] = document.getElementById("refdx").value;
|
||||
refInfo["dy"] = document.getElementById("refdy").value;
|
||||
MakeRefZW(refInfo, basepath);
|
||||
var url = basepath + "/fileserver" + "/img_tmp/ref_zw.jpg?" + Date.now();
|
||||
document.getElementById("img_ref_org").src = url;
|
||||
var url = basepath + "/fileserver" + "/img_tmp/ref_zw_org.jpg?" + Date.now();
|
||||
document.getElementById("img_ref").src = url;
|
||||
refInfo[aktindex]["x"] = document.getElementById("refx").value;
|
||||
refInfo[aktindex]["y"] = document.getElementById("refy").value;
|
||||
refInfo[aktindex]["dx"] = document.getElementById("refdx").value;
|
||||
refInfo[aktindex]["dy"] = document.getElementById("refdy").value;
|
||||
MakeRefZW(refInfo[aktindex], basepath);
|
||||
UpdateReference();
|
||||
document.getElementById("enhancecontrast").disabled = false;
|
||||
draw();
|
||||
}
|
||||
|
||||
function drawGrid(){
|
||||
|
||||
@@ -29,23 +29,21 @@ p {font-size: 1em;}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This is the first time you the digitizer. You have been automatically routed to the <b>initial setup procedure</b>.
|
||||
This procedure should adjust the setting to your local counter. Basically you can customize your settings in five steps.
|
||||
<br>
|
||||
In the final step the inital setup will be disabled and it will restart to the normal mode.
|
||||
This is the first time you started the digitizer after the initial installation. You have been automatically routed to the <b>initial setup procedure</b>.
|
||||
Here you adjust the setting to your local counter within five steps. In the final step the inital setup will be disabled and it will restart to the normal mode.
|
||||
<br>
|
||||
<br>
|
||||
Just use the buttons "Next" and "Previous" to nagivate through the process.
|
||||
You can navigate forward and backward during the setup with the buttons "Next" and "Previous". Do not forget to save in each step.
|
||||
<br>
|
||||
</p>
|
||||
<p>
|
||||
Follow the instructions:
|
||||
This is an overview over the five steps:
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<ol>
|
||||
<li>Create reference image <br>
|
||||
Basis for the position references and the marking of the digits and counters.</li>
|
||||
Base for the position referencing and the identification of the digits and counters.</li>
|
||||
<li>Define two unique references <br>
|
||||
Used to align the individual camera shot and identify the absolut positions</li>
|
||||
<li>Define the digits <br>
|
||||
@@ -53,7 +51,7 @@ p {font-size: 1em;}
|
||||
<li>Define the analog counters <br>
|
||||
Analog counters to be identified</li>
|
||||
<li>General settings <br>
|
||||
Most can stay to the default value - also MQTT connection can be specified here</li>
|
||||
Most settings can be used with default value at the beginning. MQTT connection can be specified here</li>
|
||||
</ol>
|
||||
<p>
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ p {font-size: 1em;}
|
||||
<br>
|
||||
Once you have pushed below button, the setup modus will be left and the digitizer start to normal operation mode.
|
||||
<br>
|
||||
After a view seconds you can reload this page again and will go to normal operation mode.
|
||||
After a view seconds you can reload this page. It will take two to four minutes, until you get the first reading.
|
||||
<br>
|
||||
All settings can be changed later on as well in the configuration menue.
|
||||
All settings can be changed as well in the configuration menue in normal operation mode.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -102,7 +102,7 @@ table {
|
||||
_brightness = document.getElementById("MakeImage_Brightness_value1").value;
|
||||
// _contrast = document.getElementById("MakeImage_Contrast_value1").value;
|
||||
// _saturation = document.getElementById("MakeImage_Saturation_value1").value;
|
||||
url = basepath + "/editflow.html?task=test_take&bri=" + _brightness;
|
||||
url = basepath + "/editflow.html?task=test_take&bri=" + _brightness;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -118,9 +118,6 @@ url = basepath + "/editflow.html?task=test_take&bri=" + _brightness;
|
||||
|
||||
function loadRawImage(){
|
||||
url = basepath + "/img_tmp/raw.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);
|
||||
// document.getElementById("finerotate").value = 0;
|
||||
// document.getElementById("prerotateangle").value = getPreRotate();
|
||||
// document.getElementById("mirror").checked = getMirror();
|
||||
document.getElementById("finerotate").disabled = false;
|
||||
document.getElementById("prerotateangle").disabled = false;
|
||||
document.getElementById("updatereferenceimage").disabled = false;
|
||||
@@ -128,7 +125,9 @@ url = basepath + "/editflow.html?task=test_take&bri=" + _brightness;
|
||||
if (param["Alignment"]["InitialMirror"].found)
|
||||
document.getElementById("mirror").disabled = false;
|
||||
else
|
||||
{
|
||||
document.getElementById("labelmirror").style = "color:lightgrey;";
|
||||
}
|
||||
|
||||
if (param["MakeImage"]["Brightness"].found && param["MakeImage"]["Brightness"].enabled)
|
||||
document.getElementById("MakeImage_Brightness_value1").disabled = false;
|
||||
@@ -164,6 +163,14 @@ url = basepath + "/editflow.html?task=test_take&bri=" + _brightness;
|
||||
document.getElementById("MakeImage_Brightness_value1").disabled = true;
|
||||
// document.getElementById("MakeImage_Saturation_value1").disabled = true;
|
||||
// document.getElementById("MakeImage_Contrast_value1").disabled = true;
|
||||
document.getElementById("mirror").disabled = false;
|
||||
if (!(param["Alignment"]["InitialMirror"].found))
|
||||
{
|
||||
document.getElementById("MakeImage_Brightness_value1").type = "hidden";
|
||||
document.getElementById("MakeImage_Brightness_text").style.visibility = "hidden";
|
||||
}
|
||||
|
||||
|
||||
document.getElementById("mirror").disabled = true;
|
||||
|
||||
isActReference = true;
|
||||
|
||||
@@ -22,11 +22,11 @@ p {font-size: 1em;}
|
||||
<body style="font-family: arial">
|
||||
|
||||
<h4>Reference Image</h4>
|
||||
The reference image is needed to define the digits, counters and references for alignment.
|
||||
The reference image is the base to define the digits, counters and references positions.
|
||||
<p>
|
||||
The last taken raw image from the camera is taken. Use the Button "Create New Reference" to make your own reference.<br>
|
||||
Most important feature is a straight alignment of the image. Use the Pre roate Angle and the fine alignment to fine tune the rotation of the image<br>
|
||||
Finish the step by pushing <b>"Update Reference Image"</b>.
|
||||
Firstly you see the default image. Use the Button "Create New Reference" to start to create your own reference image.<br>
|
||||
Most important feature is a straight alignment of the image. Use the Pre-rotate angle and the fine alignment to adjust the rotation of the image<br>
|
||||
Store the reference image by pushing <b>"Update Reference Image"</b>.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -9,7 +9,7 @@ function getbasepath(){
|
||||
{
|
||||
// host = "http://192.168.2.118"; // jomjol interner test
|
||||
// host = "http://192.168.178.26"; // jomjol interner test
|
||||
host = "http://192.168.178.22"; // jomjol interner Real
|
||||
host = "http://192.168.178.26"; // jomjol interner Real
|
||||
// host = "."; // jomjol interner localhost
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,9 @@ var digitsEnabled = false;
|
||||
var posDigitsHeader;
|
||||
|
||||
function MakeRefZW(zw, _basepath){
|
||||
url = _basepath + "/editflow.html?task=cutref&in=/config/reference.jpg&out=/img_tmp/ref_zw_org.jpg&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
|
||||
_filetarget = zw["name"].replace("/config/", "/img_tmp/");
|
||||
_filetarget = _filetarget.replace(".jpg", "_org.jpg");
|
||||
url = _basepath + "/editflow.html?task=cutref&in=/config/reference.jpg&out="+_filetarget+"&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
|
||||
var xhttp = new XMLHttpRequest();
|
||||
try {
|
||||
xhttp.open("GET", url, false);
|
||||
@@ -23,17 +25,29 @@ function MakeRefZW(zw, _basepath){
|
||||
{
|
||||
// alert("Deleting Config.ini failed");
|
||||
}
|
||||
FileCopyOnServer("/img_tmp/ref_zw_org.jpg", "/img_tmp/ref_zw.jpg", _basepath);
|
||||
_filetarget2 = zw["name"].replace("/config/", "/img_tmp/");
|
||||
// _filetarget2 = _filetarget2.replace(".jpg", "_org.jpg");
|
||||
FileCopyOnServer(_filetarget, _filetarget2, _basepath);
|
||||
}
|
||||
|
||||
function GetCoordinates(index, _basepath){
|
||||
FileCopyOnServer(ref[index]["name"], "/img_tmp/ref_zw.jpg", _basepath);
|
||||
function CopyReferenceToImgTmp(_basepath)
|
||||
{
|
||||
for (index = 0; index < 2; ++index)
|
||||
{
|
||||
_filenamevon = ref[index]["name"];
|
||||
_filenamenach = _filenamevon.replace("/config/", "/img_tmp/");
|
||||
FileDeleteOnServer(_filenamenach, _basepath);
|
||||
FileCopyOnServer(_filenamevon, _filenamenach, _basepath);
|
||||
|
||||
FileDeleteOnServer("/img_tmp/ref_zw_org.jpg", _basepath);
|
||||
var namezw = ref[index]["name"].replace(".jpg", "_org.jpg");
|
||||
FileCopyOnServer(namezw, "/img_tmp/ref_zw_org.jpg", _basepath);
|
||||
_filenamevon = _filenamevon.replace(".jpg", "_org.jpg");
|
||||
_filenamenach = _filenamenach.replace(".jpg", "_org.jpg");
|
||||
FileDeleteOnServer(_filenamenach, _basepath);
|
||||
FileCopyOnServer(_filenamevon, _filenamenach, _basepath);
|
||||
}
|
||||
}
|
||||
|
||||
return ref[index];
|
||||
function GetReferencesInfo(){
|
||||
return ref;
|
||||
}
|
||||
|
||||
function ParseConfigAlignment(_aktline){
|
||||
@@ -321,21 +335,31 @@ function UpdateConfigFileReferenceChange(_basepath){
|
||||
SaveConfigToServer(_basepath);
|
||||
}
|
||||
|
||||
function UpdateConfig(zw, _index, _enhance, _basepath){
|
||||
var zeile = zw["name"] + " " + zw["x"] + " " + zw["y"];
|
||||
var _pos = ref[_index]["pos_ref"];
|
||||
function UpdateConfigReference(zw, _basepath){
|
||||
for (var index = 0; index < 2; ++index)
|
||||
{
|
||||
var zeile = zw[index]["name"] + " " + zw[index]["x"] + " " + zw[index]["y"];
|
||||
var _pos = zw[index]["pos_ref"];
|
||||
config_split[_pos] = zeile;
|
||||
|
||||
SaveConfigToServer(_basepath);
|
||||
_filenamenach = ref[index]["name"];
|
||||
_filenamevon = _filenamenach.replace("/config/", "/img_tmp/");
|
||||
FileDeleteOnServer(_filenamenach, _basepath);
|
||||
FileCopyOnServer(_filenamevon, _filenamenach, _basepath);
|
||||
|
||||
var namezw = zw["name"];
|
||||
FileCopyOnServer("/img_tmp/ref_zw.jpg", namezw, _basepath);
|
||||
var namezw = zw["name"].replace(".jpg", "_org.jpg");
|
||||
FileCopyOnServer("/img_tmp/ref_zw_org.jpg", namezw, _basepath);
|
||||
_filenamenach = _filenamenach.replace(".jpg", "_org.jpg");
|
||||
_filenamevon = _filenamevon.replace(".jpg", "_org.jpg");
|
||||
FileDeleteOnServer(_filenamenach, _basepath);
|
||||
FileCopyOnServer(_filenamevon, _filenamenach, _basepath);
|
||||
|
||||
}
|
||||
|
||||
SaveConfigToServer(_basepath);
|
||||
}
|
||||
|
||||
function MakeContrastImageZW(zw, _enhance, _basepath){
|
||||
url = _basepath + "/editflow.html?task=cutref&in=/config/reference.jpg&out=/img_tmp/ref_zw.jpg" + "&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
|
||||
_filename = zw["name"].replace("/config/", "/img_tmp/");
|
||||
url = _basepath + "/editflow.html?task=cutref&in=/config/reference.jpg&out=" + _filename + "&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
|
||||
if (_enhance == true){
|
||||
url = url + "&enhance=true";
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
5.4.1
|
||||
6.0.0
|
||||
|
||||
Reference in New Issue
Block a user