diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yaml similarity index 100% rename from .github/ISSUE_TEMPLATE/bug_report.yml rename to .github/ISSUE_TEMPLATE/bug_report.yaml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yaml similarity index 100% rename from .github/ISSUE_TEMPLATE/config.yml rename to .github/ISSUE_TEMPLATE/config.yaml diff --git a/.github/label-commenter-config.yml b/.github/label-commenter-config.yaml similarity index 100% rename from .github/label-commenter-config.yml rename to .github/label-commenter-config.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yaml similarity index 100% rename from .github/workflows/build.yml rename to .github/workflows/build.yaml diff --git a/.github/workflows/clear_cache.yml b/.github/workflows/clear_cache.yaml similarity index 100% rename from .github/workflows/clear_cache.yml rename to .github/workflows/clear_cache.yaml diff --git a/.github/workflows/manual-update-webinstaller.yml b/.github/workflows/manual-update-webinstaller.yaml similarity index 100% rename from .github/workflows/manual-update-webinstaller.yml rename to .github/workflows/manual-update-webinstaller.yaml diff --git a/.github/workflows/reply-bot.yml b/.github/workflows/reply-bot.yaml similarity index 91% rename from .github/workflows/reply-bot.yml rename to .github/workflows/reply-bot.yaml index a9e0421f1..7c7bb9c5d 100644 --- a/.github/workflows/reply-bot.yml +++ b/.github/workflows/reply-bot.yaml @@ -1,5 +1,5 @@ # Reply Bot -# It uses the configuration in .github/label-commenter-config.yml +# It uses the configuration in .github/label-commenter-config.yaml # See https://github.com/peaceiris/actions-label-commenter name: Reply-Bot @@ -25,7 +25,7 @@ jobs: #################################################################### ## Remove labels again (issues only) - ## Make sure to also add the reply message to .github/label-commenter-config.yml! + ## Make sure to also add the reply message to .github/label-commenter-config.yaml! ## This currently seems no longer to work due to changes on the actions-cool/issues-helper! #################################################################### # - name: Remove 'Logfile' label again (issues only) @@ -74,6 +74,7 @@ jobs: ## Write the response #################################################################### - name: Write Response - uses: peaceiris/actions-label-commenter@c2d00660c86f2b9ed0fb35b372c451558eba85b3 + uses: peaceiris/actions-label-commenter@v1 with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" + github_token: "${{ secrets.GITHUB_TOKEN }}" + config_file: .github/label-commenter-config.yaml diff --git a/Changelog.md b/Changelog.md index ce6d8251f..a42dabb04 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,18 @@ +## [15.7.0] - 2024-02-17 + +For a full list of changes see [Full list of changes](https://github.com/jomjol/AI-on-the-edge-device/compare/v15.6.0...v15.7.0) + +#### Core Changes +- Added new camera settings (See `Settings > Alignment > Reference Image and Camera Settings`). You might need to re-create the reference image and alignment marks. Note worthy: + - You can now crop the image + - Support to configure sharpness, grayscale, negatoive and exposure +- Enhanced various WebUI pages with better explanations and usability +- Add Firmware Version to MQTT + +#### Bug Fixes +- Reverted "Implemented late analog / digital transition [#2778](https://github.com/jomjol/AI-on-the-edge-device/pull/2778) (introduced in `v15.5`) as is seems to cause issues for many users. + + ## [15.6.0] - 2024-02-09 For a full list of changes see [Full list of changes](https://github.com/jomjol/AI-on-the-edge-device/compare/v15.5.0...v15.6.0) @@ -42,6 +57,8 @@ For a full list of changes see [Full list of changes](https://github.com/jomjol/ - dig-class100-0167_s2_q.tflite - dig-class11_1700_s2.tflite - ana-cont_1208_s2_q.tflite + + - Added config entries for MQTT TLS #### Fixed diff --git a/param-docs/parameter-pages/Alignment/FlipImageSize.md b/param-docs/parameter-pages/Alignment/FlipImageSize.md index 547d10507..9fdc95bb8 100644 --- a/param-docs/parameter-pages/Alignment/FlipImageSize.md +++ b/param-docs/parameter-pages/Alignment/FlipImageSize.md @@ -2,7 +2,10 @@ Default Value: `false` !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! This parameter can be used to rotate the viewport together with the alignment rotation: ![](img/flipImageSize.png) diff --git a/param-docs/parameter-pages/Alignment/InitialMirror.md b/param-docs/parameter-pages/Alignment/InitialMirror.md index 764b14c56..072de29c8 100644 --- a/param-docs/parameter-pages/Alignment/InitialMirror.md +++ b/param-docs/parameter-pages/Alignment/InitialMirror.md @@ -2,6 +2,9 @@ Default Value: `false` !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! Option for initially mirroring the image on the original x-axis. diff --git a/param-docs/parameter-pages/Alignment/InitialRotate.md b/param-docs/parameter-pages/Alignment/InitialRotate.md index fec2e570f..be93abd82 100644 --- a/param-docs/parameter-pages/Alignment/InitialRotate.md +++ b/param-docs/parameter-pages/Alignment/InitialRotate.md @@ -3,4 +3,10 @@ Default Value: `0` Unit: Degrees +!!! Note + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! + Initial rotation of image before alignment in degree (`-360` .. `+360`) diff --git a/param-docs/parameter-pages/TakeImage/Aec2.md b/param-docs/parameter-pages/TakeImage/Aec2.md index 08816c256..d5489ee29 100644 --- a/param-docs/parameter-pages/TakeImage/Aec2.md +++ b/param-docs/parameter-pages/TakeImage/Aec2.md @@ -5,6 +5,9 @@ Default Value: `false` This is an **Expert Parameter**! Only change it if you understand what it does! !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! Switch to "Auto-exposure Control 2" algorithm. This may resolve some over-exposure and under-exposure issues. diff --git a/param-docs/parameter-pages/TakeImage/AutoExposureLevel.md b/param-docs/parameter-pages/TakeImage/AutoExposureLevel.md index c2724db6d..b681bf0ff 100644 --- a/param-docs/parameter-pages/TakeImage/AutoExposureLevel.md +++ b/param-docs/parameter-pages/TakeImage/AutoExposureLevel.md @@ -5,7 +5,10 @@ Default Value: `0` This is an **Expert Parameter**! Only change it if you understand what it does! !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! Exposure compensation. Lower values produce darker image. diff --git a/param-docs/parameter-pages/TakeImage/Brightness.md b/param-docs/parameter-pages/TakeImage/Brightness.md index 165638f6c..b5f65aa59 100644 --- a/param-docs/parameter-pages/TakeImage/Brightness.md +++ b/param-docs/parameter-pages/TakeImage/Brightness.md @@ -2,6 +2,9 @@ Default Value: `0` !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! Image Brightness (`-2` .. `2`) diff --git a/param-docs/parameter-pages/TakeImage/Contrast.md b/param-docs/parameter-pages/TakeImage/Contrast.md index 633e0fba8..7bc76f2f2 100644 --- a/param-docs/parameter-pages/TakeImage/Contrast.md +++ b/param-docs/parameter-pages/TakeImage/Contrast.md @@ -2,7 +2,10 @@ Default Value: `0` !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! Image Contrast (`-2` .. `2`) diff --git a/param-docs/parameter-pages/TakeImage/FixedExposure.md b/param-docs/parameter-pages/TakeImage/FixedExposure.md index 2491e062f..7db1c4051 100644 --- a/param-docs/parameter-pages/TakeImage/FixedExposure.md +++ b/param-docs/parameter-pages/TakeImage/FixedExposure.md @@ -4,4 +4,10 @@ Default Value: `false` !!! Warning This is an **Expert Parameter**! Only change it if you understand what it does! +!!! Note + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! + Fixes the illumination setting of camera at the startup and uses this later -> Individual round is faster. diff --git a/param-docs/parameter-pages/TakeImage/Grayscale.md b/param-docs/parameter-pages/TakeImage/Grayscale.md index b5b442ac3..5eca929ae 100644 --- a/param-docs/parameter-pages/TakeImage/Grayscale.md +++ b/param-docs/parameter-pages/TakeImage/Grayscale.md @@ -5,6 +5,9 @@ Default Value: `false` This is an **Expert Parameter**! Only change it if you understand what it does! !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! Produces black and white image. diff --git a/param-docs/parameter-pages/TakeImage/LEDIntensity.md b/param-docs/parameter-pages/TakeImage/LEDIntensity.md index 9ce5d5c66..56e75827c 100644 --- a/param-docs/parameter-pages/TakeImage/LEDIntensity.md +++ b/param-docs/parameter-pages/TakeImage/LEDIntensity.md @@ -2,6 +2,9 @@ Default Value: `50` !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! Set the Flash LED Intensity: (`0` .. `100`) diff --git a/param-docs/parameter-pages/TakeImage/Negative.md b/param-docs/parameter-pages/TakeImage/Negative.md index 3d5a2c971..e0dc675c3 100644 --- a/param-docs/parameter-pages/TakeImage/Negative.md +++ b/param-docs/parameter-pages/TakeImage/Negative.md @@ -5,6 +5,9 @@ Default Value: `false` This is an **Expert Parameter**! Only change it if you understand what it does! !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! Inverts the colors. diff --git a/param-docs/parameter-pages/TakeImage/Saturation.md b/param-docs/parameter-pages/TakeImage/Saturation.md index a3b0868fc..34c165dd5 100644 --- a/param-docs/parameter-pages/TakeImage/Saturation.md +++ b/param-docs/parameter-pages/TakeImage/Saturation.md @@ -2,7 +2,10 @@ Default Value: `0` !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! Image Saturation (`-2` .. `2`) diff --git a/param-docs/parameter-pages/TakeImage/Sharpness.md b/param-docs/parameter-pages/TakeImage/Sharpness.md index 670af9561..88259fc76 100644 --- a/param-docs/parameter-pages/TakeImage/Sharpness.md +++ b/param-docs/parameter-pages/TakeImage/Sharpness.md @@ -5,7 +5,10 @@ Default Value: `0` This is an **Expert Parameter**! Only change it if you understand what it does! !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! Changes the sharpness of the image. Set to `-4` for auto-sharpness. diff --git a/param-docs/parameter-pages/TakeImage/Zoom.md b/param-docs/parameter-pages/TakeImage/Zoom.md index fe8c59a18..8dc875860 100644 --- a/param-docs/parameter-pages/TakeImage/Zoom.md +++ b/param-docs/parameter-pages/TakeImage/Zoom.md @@ -5,6 +5,9 @@ Default Value: `false` This is an **Expert Parameter**! Only change it if you understand what it does! !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! Crop the camera sensor frame to `ImageSize` resolution instead of scaling it down. diff --git a/param-docs/parameter-pages/TakeImage/ZoomMode.md b/param-docs/parameter-pages/TakeImage/ZoomMode.md index dd9a12f96..05ac0fd48 100644 --- a/param-docs/parameter-pages/TakeImage/ZoomMode.md +++ b/param-docs/parameter-pages/TakeImage/ZoomMode.md @@ -5,7 +5,10 @@ Default Value: `0` This is an **Expert Parameter**! Only change it if you understand what it does! !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! `ZoomMode` only applies when `Zoom` is enabled. Value 0: Crop the camera sensor frame to `ImageSize` resolution. diff --git a/param-docs/parameter-pages/TakeImage/ZoomOffsetX.md b/param-docs/parameter-pages/TakeImage/ZoomOffsetX.md index 486ed658c..613c2d171 100644 --- a/param-docs/parameter-pages/TakeImage/ZoomOffsetX.md +++ b/param-docs/parameter-pages/TakeImage/ZoomOffsetX.md @@ -5,7 +5,10 @@ Default Value: `0` This is an **Expert Parameter**! Only change it if you understand what it does! !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! `ZoomOffsetX` only applies when `Zoom` is enabled. X coordinate of the crop location within the camera sensor frame. diff --git a/param-docs/parameter-pages/TakeImage/ZoomOffsetY.md b/param-docs/parameter-pages/TakeImage/ZoomOffsetY.md index 3ca29b8e2..5880f5665 100644 --- a/param-docs/parameter-pages/TakeImage/ZoomOffsetY.md +++ b/param-docs/parameter-pages/TakeImage/ZoomOffsetY.md @@ -5,7 +5,10 @@ Default Value: `0` This is an **Expert Parameter**! Only change it if you understand what it does! !!! Note - This parameter can also be set on the Reference Image configuration. + This parameter can also be set on the Reference Image configuration page! + +!!! Note + After changing this parameter you need to update your reference image and alignment markers! `ZoomOffsetY` only applies when `Zoom` is enabled. Y coordinate of the crop location within the camera sensor frame. diff --git a/sd-card/config/dig-cont_0640_s3_q.tflite b/sd-card/config/dig-cont_0640_s3_q.tflite new file mode 100644 index 000000000..41536f523 Binary files /dev/null and b/sd-card/config/dig-cont_0640_s3_q.tflite differ diff --git a/sd-card/html/.gitignore b/sd-card/html/.gitignore index 670a212a8..ccfb4922a 100644 --- a/sd-card/html/.gitignore +++ b/sd-card/html/.gitignore @@ -1 +1 @@ -edit_config_param.html +edit_config.html diff --git a/sd-card/html/edit_analog.html b/sd-card/html/edit_analog.html index 6eef1fdb2..8f7dfcfe3 100644 --- a/sd-card/html/edit_analog.html +++ b/sd-card/html/edit_analog.html @@ -186,20 +186,25 @@

Analog ROI

x: Δx: - y: Δy: - - - - + + +
+The following settings are only used for easier setup, they are not persisted on the device:
+
+
+
+ +
+ @@ -223,43 +228,41 @@

Analog ROI

- diff --git a/sd-card/html/edit_config.html b/sd-card/html/edit_config_raw.html similarity index 100% rename from sd-card/html/edit_config.html rename to sd-card/html/edit_config_raw.html diff --git a/sd-card/html/edit_config_param_template.html b/sd-card/html/edit_config_template.html similarity index 95% rename from sd-card/html/edit_config_param_template.html rename to sd-card/html/edit_config_template.html index 1ad7226dd..2fb11751e 100644 --- a/sd-card/html/edit_config_param_template.html +++ b/sd-card/html/edit_config_template.html @@ -220,7 +220,7 @@

Configuration

@@ -266,7 +266,6 @@

Configuration

- @@ -282,7 +281,7 @@

Configuration

Brightness @@ -294,7 +293,7 @@

Configuration

Contrast @@ -306,7 +305,7 @@

Configuration

Saturation @@ -318,7 +317,7 @@

Configuration

Sharpness @@ -330,7 +329,7 @@

Configuration

LED Intensity @@ -342,7 +341,7 @@

Configuration

Image Quality @@ -354,7 +353,7 @@

Configuration

Image Size @@ -406,7 +405,7 @@

Configuration

Zoom Offset Y @@ -417,7 +416,7 @@

Configuration

Grayscale @@ -468,7 +467,7 @@

Configuration

Fixed Exposure + @@ -189,7 +189,7 @@

Reference Image and Camera Settings

@@ -197,7 +197,7 @@

Reference Image and Camera Settings

@@ -207,13 +207,13 @@

Reference Image and Camera Settings

+ @@ -223,13 +223,14 @@

Reference Image and Camera Settings

+ @@ -237,7 +238,7 @@

Reference Image and Camera Settings

@@ -246,7 +247,8 @@

Reference Image and Camera Settings

Contrast: *) @@ -254,7 +256,7 @@

Reference Image and Camera Settings

@@ -263,34 +265,36 @@

Reference Image and Camera Settings

Saturation: *) + - - + + + + - + + @@ -299,13 +303,14 @@

Reference Image and Camera Settings

+ @@ -357,6 +362,26 @@

Reference Image and Camera Settings

} } + function cameraParameterChanged() { + document.getElementById("savereferenceimage").disabled = true; + + if(document.getElementById("zoom").checked) { + document.getElementById("zoommode").disabled = false; + document.getElementById("zoomoffsetx").disabled = false; + document.getElementById("zoomoffsety").disabled = false; + } + else { + document.getElementById("zoommode").disabled = true; + document.getElementById("zoomoffsetx").disabled = true; + document.getElementById("zoomoffsety").disabled = true; + } + } + + function cameraParameterChangedDR() { + document.getElementById("savereferenceimage").disabled = true; + drawRotated(); + } + // Create New Reference, Update Image function doTakeReference(){ document.getElementById("overlay").style.display = "block"; @@ -366,10 +391,20 @@

Reference Image and Camera Settings

document.getElementById("negative").disabled = false; document.getElementById("aec2").disabled = false; document.getElementById("FixedExposure").disabled = false; + document.getElementById("zoom").disabled = false; - document.getElementById("zoommode").disabled = false; - document.getElementById("zoomoffsetx").disabled = false; - document.getElementById("zoomoffsety").disabled = false; + + if(document.getElementById("zoom").checked) { + document.getElementById("zoommode").disabled = false; + document.getElementById("zoomoffsetx").disabled = false; + document.getElementById("zoomoffsety").disabled = false; + } + else { + document.getElementById("zoommode").disabled = true; + document.getElementById("zoomoffsetx").disabled = true; + document.getElementById("zoomoffsety").disabled = true; + } + document.getElementById("TakeImage_AutoExposureLevel_value1").disabled = false; document.getElementById("finerotate").disabled = false; document.getElementById("prerotateangle").disabled = false; @@ -479,6 +514,9 @@

Reference Image and Camera Settings

if (_zoom != '0') { url = url + "&zm=" + _zm + "&x=" + _x + "&y=" + _y; } + else { + url = url + "&zm=0" + "&x=0" + "&y=0"; + } url = url + "&ae=" + _ae + "&a2=" + _aec2; diff --git a/sd-card/html/index.html b/sd-card/html/index.html index 62c1b2487..05fe9dafd 100644 --- a/sd-card/html/index.html +++ b/sd-card/html/index.html @@ -24,7 +24,7 @@ 'channelmode=no,directories=no,fullscreen=no,' + 'location=no,dependent=yes,menubar=no,resizable=no,scrollbars=no,' + 'status=no,toolbar=no,titlebar=no,' + - 'left=10,top=250,width=640px,height=480px'; + 'left=10,top=260,width=640px,height=480px'; function loadPage(page) { console.log("loadPage( " + page + " )"); @@ -88,21 +88,21 @@

An ESP32 all inclusive neural network recognition system for meter digitaliz

- +
Wait Before Taking Picture - - - - - - - @@ -367,7 +366,7 @@

Configuration

Zoom
- @@ -380,7 +379,7 @@

Configuration

Zoom Mode
- @@ -394,7 +393,7 @@

Configuration

Zoom Offset X
- Pixel $TOOLTIP_TakeImage_ZoomOffsetX - Pixel $TOOLTIP_TakeImage_ZoomOffsetY - @@ -430,7 +429,7 @@

Configuration

Negative
- @@ -443,7 +442,7 @@

Configuration

Auto-exposure Control 2
- @@ -456,7 +455,7 @@

Configuration

Auto Exposure Level
- - @@ -1796,11 +1795,28 @@

Digit ROI

cofcat["Digits"]["enabled"] = isEnabled; document.getElementById("saveroi").disabled = false; - if (isEnabled) - { + if (isEnabled) { UpdateROIs(); } -} + } function sah1(el, _target) { try { el.disabled = _target; } catch (E) {} + if (el.childNodes && el.childNodes.length > 0) { for (var x = 0; x < el.childNodes.length; x++) { sah1(el.childNodes[x], _target); @@ -278,476 +278,484 @@

Digit ROI

} } + function onNameChange() { + ROIInfo[aktindex]["name"] = document.getElementById("name").value; + UpdateROIs(); + } -function onNameChange(){ - ROIInfo[aktindex]["name"] = document.getElementById("name").value; - UpdateROIs(); -} + function deleteROI() { + if (!confirm("Delete the selected ROI?")) { + return; //break out of the function early because prompt was aborted + } -function deleteROI(){ - if (!confirm("Delete the selected ROI?")) { - return; //break out of the function early because prompt was aborted + ROIInfo.splice(aktindex, 1); + + if (aktindex > ROIInfo.length - 1){ + aktindex = ROIInfo.length - 1; + } + UpdateROIs(); + draw(); } - ROIInfo.splice(aktindex, 1); - if (aktindex > ROIInfo.length - 1){ - aktindex = ROIInfo.length - 1; - } - UpdateROIs(); - draw(); -} + function newROI() { + var sel = document.getElementById("Numbers_value1"); + var _number= sel.options[sel.selectedIndex].text; + sel = document.getElementById("index"); + + if (ROIInfo.length > 0) { + _roialt = sel.options[sel.selectedIndex].text; + } + else { + _roialt = "dig"; + } -function newROI() { - var sel = document.getElementById("Numbers_value1"); - var _number= sel.options[sel.selectedIndex].text; - sel = document.getElementById("index"); + var _roinew = prompt("Please enter a name for the new ROI", _roialt); - if (ROIInfo.length > 0) { - _roialt = sel.options[sel.selectedIndex].text; + if (_roinew === null) { + return; //break out of the function early because prompt was aborted + } + + if (ROIInfo.length > 0) { + if (ROIInfo.length > 1) { + space = ROIInfo[1].x - parseInt(ROIInfo[0].x) - parseInt(ROIInfo[0].dx); + } + erg = CreateROI(_number, "digit", sel.selectedIndex, _roinew, parseInt(ROIInfo[sel.selectedIndex].x) + parseInt(ROIInfo[sel.selectedIndex].dx) + space, + parseInt(ROIInfo[sel.selectedIndex].y), ROIInfo[aktindex]["dx"], ROIInfo[aktindex]["dy"], 0); + } + else { + erg = CreateROI(_number, "digit", sel.selectedIndex, _roinew, 15, 30, 30, 51, 0); + } + + if (erg != "") { + firework.launch(erg, 'danger', 30000); + } + else { + UpdateROIs(_roinew); + // Shift all ROIs on right side to the right + for (var _nb = sel.selectedIndex + 1; _nb < ROIInfo.length; _nb++) { + ROIInfo[_nb].x = parseInt(ROIInfo[_nb].x) + parseInt(ROIInfo[_nb].dx) + space; + } + draw(); + } } - else { - _roialt = "dig"; + + function movePrevious() { + var zw = ROIInfo[aktindex]; + ROIInfo[aktindex] = ROIInfo[aktindex-1]; + ROIInfo[aktindex-1] = zw; + aktindex--; + UpdateROIs(); + valuemanualchanged(); } - var _roinew = prompt("Please enter a name for the new ROI", _roialt); - - if (_roinew === null) { - return; //break out of the function early because prompt was aborted + function moveNext() { + var zw = ROIInfo[aktindex]; + ROIInfo[aktindex] = ROIInfo[aktindex+1]; + ROIInfo[aktindex+1] = zw; + aktindex++; + UpdateROIs(); + valuemanualchanged(); } - if (ROIInfo.length > 0) { - if (ROIInfo.length > 1) { - space = ROIInfo[1].x - parseInt(ROIInfo[0].x) - parseInt(ROIInfo[0].dx); + function changelockAspectRatio() { + lockAspectRatio = document.getElementById("lockAspectRatio").checked; + } + + function changelockSizes() { + lockSizes = document.getElementById("lockSizes").checked; + UpdateROIs(); + valuemanualchangedspace(); + + if (!lockSizes) { + firework.launch("In most cases it's advised to keep the y, Δx and Δy identical!", 'warning', 10000); } - erg = CreateROI(_number, "digit", sel.selectedIndex, _roinew, parseInt(ROIInfo[sel.selectedIndex].x) + parseInt(ROIInfo[sel.selectedIndex].dx) + space, - parseInt(ROIInfo[sel.selectedIndex].y), ROIInfo[aktindex]["dx"], ROIInfo[aktindex]["dy"], 0); } - else - erg = CreateROI(_number, "digit", sel.selectedIndex, _roinew, 15, 30, 30, 51, 0); - if (erg != "") - firework.launch(erg, 'danger', 30000); - else { - UpdateROIs(_roinew); - // Shift all ROIs on right side to the right - for (var _nb = sel.selectedIndex + 1; _nb < ROIInfo.length; _nb++) { - ROIInfo[_nb].x = parseInt(ROIInfo[_nb].x) + parseInt(ROIInfo[_nb].dx) + space; + function changeLockSpaceEquidistant() { + lockSpaceEquidistant = document.getElementById("lockSpaceEquidistant").checked; + if (!lockSpaceEquidistant) { + document.getElementById("space").disabled = true; } - draw(); + else { + document.getElementById("space").disabled = false; + } + UpdateROIs(); } -} - -function movePrevious(){ - var zw = ROIInfo[aktindex]; - ROIInfo[aktindex] = ROIInfo[aktindex-1]; - ROIInfo[aktindex-1] = zw; - aktindex--; - UpdateROIs(); - valuemanualchanged(); -} - -function moveNext(){ - var zw = ROIInfo[aktindex]; - ROIInfo[aktindex] = ROIInfo[aktindex+1]; - ROIInfo[aktindex+1] = zw; - aktindex++; - UpdateROIs(); - valuemanualchanged(); -} - -function changelockAspectRatio(){ - lockAspectRatio = document.getElementById("lockAspectRatio").checked; -} - -function changelockSizes(){ - lockSizes = document.getElementById("lockSizes").checked; - UpdateROIs(); - valuemanualchangedspace(); - - if (!lockSizes) { - firework.launch("In most cases it's advised to keep the y, Δx and Δy identical!", 'warning', 10000); - } -} - -function changeLockSpaceEquidistant(){ - lockSpaceEquidistant = document.getElementById("lockSpaceEquidistant").checked; - if (!lockSpaceEquidistant) { - document.getElementById("space").disabled = true; - } - else { - document.getElementById("space").disabled = false; - } - UpdateROIs(); -} - -function ChangeSelection(){ - aktindex = parseInt(document.getElementById("index").value); -// lockAspectRatio = true; - UpdateROIs(); -} - -function SaveToConfig(){ - if (confirm("Are you sure you want to save the new digit ROI configuration?")) { - // _zwcat = getConfigCategory(); - cofcat["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked; - WriteConfigININew(); - SaveConfigToServer(domainname); - UpdateROIs(); - document.getElementById("saveroi").disabled = true; - firework.launch('Configuration saved. It will get applied after next reboot', 'success', 5000); + function ChangeSelection() { + aktindex = parseInt(document.getElementById("index").value); + //lockAspectRatio = true; + UpdateROIs(); } -} + function SaveToConfig() { + if (confirm("Are you sure you want to save the new digit ROI configuration?")) { + // _zwcat = getConfigCategory(); + cofcat["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked; + WriteConfigININew(); + SaveConfigToServer(domainname); + UpdateROIs(); + document.getElementById("saveroi").disabled = true; + + firework.launch('Configuration saved. It will get applied after next reboot', 'success', 5000); + } + } -function ShowMultiplier() -{ - var decimalShift = 0; - var multiplier; - var multiplier_decshift; - var fixedDecimals_decshift; - var NumberInfo = getNUMBERInfo(); + function ShowMultiplier() { + var decimalShift = 0; + var multiplier; + var multiplier_decshift; + var fixedDecimals_decshift; + var NumberInfo = getNUMBERInfo(); - var sel = document.getElementById("Numbers_value1"); - var _number= sel.options[sel.selectedIndex].text; - document.getElementById("decimalShift").value = 0; - for (var i = 0; i < NumberInfo.length; ++i) { - if (NumberInfo[i]["name"] == _number) { - if (NumberInfo[i]["PostProcessing"]["DecimalShift"]["enabled"]) { - decimalShift = NumberInfo[i]["PostProcessing"]["DecimalShift"]["value1"]; - document.getElementById("decimalShift").value = decimalShift; + var sel = document.getElementById("Numbers_value1"); + var _number= sel.options[sel.selectedIndex].text; + document.getElementById("decimalShift").value = 0; + + for (var i = 0; i < NumberInfo.length; ++i) { + if (NumberInfo[i]["name"] == _number) { + if (NumberInfo[i]["PostProcessing"]["DecimalShift"]["enabled"]) { + decimalShift = NumberInfo[i]["PostProcessing"]["DecimalShift"]["value1"]; + document.getElementById("decimalShift").value = decimalShift; + } } } - } - multiplier = ROIInfo.length - 1 - aktindex; - multiplier_decshift = fixedDecimals_decshift = multiplier + Number(decimalShift); + multiplier = ROIInfo.length - 1 - aktindex; + multiplier_decshift = fixedDecimals_decshift = multiplier + Number(decimalShift); - if (multiplier_decshift > 0) - fixedDecimals_decshift = 0; + if (multiplier_decshift > 0) { + fixedDecimals_decshift = 0; + } - if (fixedDecimals_decshift < 0) { - fixedDecimals_decshift = -1*fixedDecimals_decshift; - } + if (fixedDecimals_decshift < 0) { + fixedDecimals_decshift = -1*fixedDecimals_decshift; + } - document.getElementById("multiplier").value="x" + Number(10 ** multiplier).toFixed(0); - document.getElementById("multiplier_decshift").value="x" + Number(10 ** multiplier_decshift).toFixed(fixedDecimals_decshift); -} - - -function UpdateROIs(_sel){ - document.getElementById("Category_Digits_enabled").checked = true; - var sel = document.getElementById("Numbers_value1"); - var _number = sel.options[sel.selectedIndex].text; - - ROIInfo = getROIInfo("digit", _number); -// _catzw = getConfigCategory(); - - if (cofcat["Digits"]["enabled"] == false) - { - document.getElementById("Category_Digits_enabled").checked = false; - EnDisableDigits(); - firework.launch('Digit ROI processing is disabled. Activate with checkbox if needed', 'warning', 10000); - return; - } - - if (ROIInfo.length == 0){ - firework.launch('No digit ROIs defined in selected number sequence', 'warning', 10000); - document.getElementById("newROI").disabled = false; - document.getElementById("deleteROI").disabled = true; - document.getElementById("renameROI").disabled = true; - document.getElementById("index").disabled = true; - document.getElementById("multiplier").style.display = "none"; - document.getElementById("multiplier_decshift").style.display = "none"; - document.getElementById("refx").disabled = true; - document.getElementById("refdx").disabled = true; - document.getElementById("refy").disabled = true; - document.getElementById("refdy").disabled = true; - document.getElementById("lockSizes").disabled = true; - document.getElementById("lockAspectRatio").disabled = true; - document.getElementById("lockSpaceEquidistant").disabled = true; - document.getElementById("moveNext").disabled = true; - document.getElementById("movePrevious").disabled = true; - document.getElementById("saveroi").disabled = false; - return; - } - else - { - document.getElementById("newROI").disabled = false; - document.getElementById("deleteROI").disabled = false; - document.getElementById("renameROI").disabled = false; - document.getElementById("index").disabled = false; - document.getElementById("multiplier").style.display = ""; - document.getElementById("multiplier_decshift").style.display = ""; - document.getElementById("refx").disabled = false; - document.getElementById("refdx").disabled = false; - document.getElementById("refy").disabled = false; - document.getElementById("refdy").disabled = false; - document.getElementById("lockSizes").disabled = false; - document.getElementById("lockAspectRatio").disabled = false; - document.getElementById("lockSpaceEquidistant").disabled = false; - document.getElementById("saveroi").disabled = false; + document.getElementById("multiplier").value="x" + Number(10 ** multiplier).toFixed(0); + document.getElementById("multiplier_decshift").value="x" + Number(10 ** multiplier_decshift).toFixed(fixedDecimals_decshift); } - var _index = document.getElementById("index"); - while (_index.length){ - _index.remove(0); - } + function UpdateROIs(_sel){ + document.getElementById("Category_Digits_enabled").checked = true; + var sel = document.getElementById("Numbers_value1"); + var _number = sel.options[sel.selectedIndex].text; - if (aktindex > ROIInfo.length) - aktindex = ROIInfo.length-1; + ROIInfo = getROIInfo("digit", _number); + // _catzw = getConfigCategory(); - for (var i = 0; i < ROIInfo.length; ++i){ - var option = document.createElement("option"); - option.text = ROIInfo[i]["name"]; - option.value = i; - _index.add(option); - if (typeof _sel !== 'undefined') { - if (option.text == _sel) - aktindex = i; + if (cofcat["Digits"]["enabled"] == false) { + document.getElementById("Category_Digits_enabled").checked = false; + EnDisableDigits(); + firework.launch('Digit ROI processing is disabled. Activate with checkbox if needed', 'warning', 10000); + return; } - } - _index.selectedIndex = aktindex; + if (ROIInfo.length == 0){ + firework.launch('No digit ROIs defined in selected number sequence', 'warning', 10000); + document.getElementById("newROI").disabled = false; + document.getElementById("deleteROI").disabled = true; + document.getElementById("renameROI").disabled = true; + document.getElementById("index").disabled = true; + document.getElementById("multiplier").style.display = "none"; + document.getElementById("multiplier_decshift").style.display = "none"; + document.getElementById("refx").disabled = true; + document.getElementById("refdx").disabled = true; + document.getElementById("refy").disabled = true; + document.getElementById("refdy").disabled = true; + document.getElementById("lockSizes").disabled = true; + document.getElementById("lockAspectRatio").disabled = true; + document.getElementById("showall").disabled = true; + document.getElementById("lockSpaceEquidistant").disabled = true; + document.getElementById("moveNext").disabled = true; + document.getElementById("movePrevious").disabled = true; + document.getElementById("saveroi").disabled = false; + return; + } + else { + document.getElementById("newROI").disabled = false; + document.getElementById("deleteROI").disabled = false; + document.getElementById("renameROI").disabled = false; + document.getElementById("index").disabled = false; + document.getElementById("multiplier").style.display = ""; + document.getElementById("multiplier_decshift").style.display = ""; + document.getElementById("refx").disabled = false; + document.getElementById("refdx").disabled = false; + document.getElementById("refy").disabled = false; + document.getElementById("refdy").disabled = false; + document.getElementById("lockSizes").disabled = false; + document.getElementById("showall").disabled = false; + document.getElementById("lockAspectRatio").disabled = false; + document.getElementById("lockSpaceEquidistant").disabled = false; + document.getElementById("saveroi").disabled = false; + } + + var _index = document.getElementById("index"); + while (_index.length){ + _index.remove(0); + } + + if (aktindex > ROIInfo.length) { + aktindex = ROIInfo.length-1; + } + + for (var i = 0; i < ROIInfo.length; ++i){ + var option = document.createElement("option"); + option.text = ROIInfo[i]["name"]; + option.value = i; + _index.add(option); + + if (typeof _sel !== 'undefined') { + if (option.text == _sel) { + aktindex = i; + } + } + } + + _index.selectedIndex = aktindex; - document.getElementById("movePrevious").disabled = false; - if (aktindex == 0){ - document.getElementById("movePrevious").disabled = true; - } + document.getElementById("movePrevious").disabled = false; + if (aktindex == 0){ + document.getElementById("movePrevious").disabled = true; + } - document.getElementById("moveNext").disabled = false; - if (aktindex == (ROIInfo.length-1)){ - document.getElementById("moveNext").disabled = true; - } + document.getElementById("moveNext").disabled = false; + if (aktindex == (ROIInfo.length-1)){ + document.getElementById("moveNext").disabled = true; + } - ShowMultiplier(); + ShowMultiplier(); - document.getElementById("lockAspectRatio").checked = lockAspectRatio; - document.getElementById("lockSizes").checked = lockSizes; - document.getElementById("lockSpaceEquidistant").checked = lockSpaceEquidistant; - document.getElementById("space").value = space; - if (!lockSpaceEquidistant) { - document.getElementById("space").disabled = true; - } - else { - document.getElementById("space").disabled = false; - } + document.getElementById("lockAspectRatio").checked = lockAspectRatio; + document.getElementById("lockSizes").checked = lockSizes; + document.getElementById("lockSpaceEquidistant").checked = lockSpaceEquidistant; + document.getElementById("space").value = space; + + if (!lockSpaceEquidistant) { + document.getElementById("space").disabled = true; + } + else { + document.getElementById("space").disabled = false; + } - document.getElementById("refx").value = ROIInfo[aktindex]["x"]; - document.getElementById("refy").value = ROIInfo[aktindex]["y"]; - document.getElementById("refdx").value = ROIInfo[aktindex]["dx"]; - document.getElementById("refdy").value = ROIInfo[aktindex]["dy"]; - rect.startX = ROIInfo[aktindex]["x"]; - rect.startY = ROIInfo[aktindex]["y"]; - rect.w = ROIInfo[aktindex]["dx"]; - rect.h = ROIInfo[aktindex]["dy"]; - draw(); -} - - function loadCanvas(dataURL) { - var canvas = document.getElementById('canvas'); - var context = canvas.getContext('2d'); + document.getElementById("refx").value = ROIInfo[aktindex]["x"]; + document.getElementById("refy").value = ROIInfo[aktindex]["y"]; + document.getElementById("refdx").value = ROIInfo[aktindex]["dx"]; + document.getElementById("refdy").value = ROIInfo[aktindex]["dy"]; + rect.startX = ROIInfo[aktindex]["x"]; + rect.startY = ROIInfo[aktindex]["y"]; + rect.w = ROIInfo[aktindex]["dx"]; + rect.h = ROIInfo[aktindex]["dy"]; + draw(); + } - imageObj.onload = function() { - canvas.width = this.width; - canvas.height = this.height; - drawImage(); - draw(); - }; + function loadCanvas(dataURL) { + var canvas = document.getElementById('canvas'); + var context = canvas.getContext('2d'); - imageObj.src = dataURL; - } + imageObj.onload = function() { + canvas.width = this.width; + canvas.height = this.height; + drawImage(); + draw(); + }; + imageObj.src = dataURL; + } - function getCoords(elem) { // crossbrowser version - var box = elem.getBoundingClientRect(); - var body = document.body; - var docEl = document.documentElement; - var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop; - var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft; - var clientTop = docEl.clientTop || body.clientTop || 0; - var clientLeft = docEl.clientLeft || body.clientLeft || 0; - var top = box.top + scrollTop - clientTop; - var left = box.left + scrollLeft - clientLeft; - return { top: Math.round(top), left: Math.round(left) }; - } - - - /* hash #description open the details part of the page */ - function openDescription() { + function getCoords(elem) { + // crossbrowser version + var box = elem.getBoundingClientRect(); + var body = document.body; + var docEl = document.documentElement; + var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop; + var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft; + var clientTop = docEl.clientTop || body.clientTop || 0; + var clientLeft = docEl.clientLeft || body.clientLeft || 0; + var top = box.top + scrollTop - clientTop; + var left = box.left + scrollLeft - clientLeft; + return { top: Math.round(top), left: Math.round(left) }; + } + + /* hash #description open the details part of the page */ + function openDescription() { if(window.location.hash) { var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character - if(hash == 'description') + if(hash == 'description') { document.getElementById("desc_details").open = true; } } + } + function init() { + openDescription(); + domainname = getDomainname(); + canvas.addEventListener('mousedown', mouseDown, false); + canvas.addEventListener('mouseup', mouseUp, false); + canvas.addEventListener('mousemove', mouseMove, false); + loadCanvas(domainname + "/fileserver/config/reference.jpg"); + loadConfig(domainname); + ParseConfig(); + param = getConfigParameters(); + cofcat = getConfigCategory(); + UpdateNUMBERS(); - function init() { - openDescription(); - domainname = getDomainname(); - canvas.addEventListener('mousedown', mouseDown, false); - canvas.addEventListener('mouseup', mouseUp, false); - canvas.addEventListener('mousemove', mouseMove, false); - loadCanvas(domainname + "/fileserver/config/reference.jpg"); - loadConfig(domainname); - ParseConfig(); - param = getConfigParameters(); - cofcat = getConfigCategory(); - UpdateNUMBERS(); - - - /* Check if the ROIs are equidistant. Only if not, untick the checkbox */ - if (ROIInfo.length > 1) { - var distanceROI0_to_ROI1 = parseInt(ROIInfo[1].x) - (parseInt(ROIInfo[0].x) + parseInt(ROIInfo[0].dx)); // Distance between 1st and 2nd ROI - //console.log("0->1: " + distanceROI0_to_ROI1); - for (var i = 1; i < (ROIInfo.length - 1); ++i) { // 2nd .. 2nd-last ROI - //console.log(i + "->" + i+1 + ": " + (parseInt(ROIInfo[i+1].x) - (parseInt(ROIInfo[i].x) + parseInt(ROIInfo[i].dx)))); - if (distanceROI0_to_ROI1 != (parseInt(ROIInfo[i+1].x) - (parseInt(ROIInfo[i].x) + parseInt(ROIInfo[i].dx)))) { - console.log("Not equidistant, unticking the checkbox!"); - lockSpaceEquidistant = false; - document.getElementById("lockSpaceEquidistant").checked = lockSpaceEquidistant; - if (!lockSpaceEquidistant) { - document.getElementById("space").disabled = true; - } - else { - document.getElementById("space").disabled = false; - } - break; - } - } - } - /* Check if the ROIs have same y, dy and dx. If so, tick the sync checkbox */ - var all_y_dx_dy_Identical = true; - if (ROIInfo.length > 1) { - for (var i = 1; i < (ROIInfo.length); ++i) { // 2nd .. last ROI - if (parseInt(ROIInfo[i].y) != parseInt(ROIInfo[0].y) || - parseInt(ROIInfo[i].dx) != parseInt(ROIInfo[0].dx) || - parseInt(ROIInfo[i].dy) != parseInt(ROIInfo[0].dy)) { - all_y_dx_dy_Identical = false; - break; + /* Check if the ROIs are equidistant. Only if not, untick the checkbox */ + if (ROIInfo.length > 1) { + var distanceROI0_to_ROI1 = parseInt(ROIInfo[1].x) - (parseInt(ROIInfo[0].x) + parseInt(ROIInfo[0].dx)); // Distance between 1st and 2nd ROI + //console.log("0->1: " + distanceROI0_to_ROI1); + for (var i = 1; i < (ROIInfo.length - 1); ++i) { // 2nd .. 2nd-last ROI + //console.log(i + "->" + i+1 + ": " + (parseInt(ROIInfo[i+1].x) - (parseInt(ROIInfo[i].x) + parseInt(ROIInfo[i].dx)))); + if (distanceROI0_to_ROI1 != (parseInt(ROIInfo[i+1].x) - (parseInt(ROIInfo[i].x) + parseInt(ROIInfo[i].dx)))) { + console.log("Not equidistant, unticking the checkbox!"); + lockSpaceEquidistant = false; + document.getElementById("lockSpaceEquidistant").checked = lockSpaceEquidistant; + if (!lockSpaceEquidistant) { + document.getElementById("space").disabled = true; } + else { + document.getElementById("space").disabled = false; + } + break; } - } - - if (all_y_dx_dy_Identical) { - lockSizes = true; - console.log("All ROI have the same Y, dX and dY, ticking the sync checkbox!"); - document.getElementById("lockSizes").checked = lockSizes; } - else { - console.log("Not all ROI have the same Y, dX and dY, unticking the sync checkbox!"); - } - - if (ROIInfo.length > 1) { - space = ROIInfo[1].x - parseInt(ROIInfo[0].x) - parseInt(ROIInfo[0].dx); - document.getElementById("space").value = space; + } + + /* Check if the ROIs have same y, dy and dx. If so, tick the sync checkbox */ + var all_y_dx_dy_Identical = true; + + if (ROIInfo.length > 1) { + for (var i = 1; i < (ROIInfo.length); ++i) { // 2nd .. last ROI + if (parseInt(ROIInfo[i].y) != parseInt(ROIInfo[0].y) || + parseInt(ROIInfo[i].dx) != parseInt(ROIInfo[0].dx) || + parseInt(ROIInfo[i].dy) != parseInt(ROIInfo[0].dy)) { + all_y_dx_dy_Identical = false; + break; + } } - - document.getElementById("saveroi").disabled = true; - - drawImage(); - draw(); } - function drawImage(){ - var canvas = document.getElementById('canvas'); - var context = canvas.getContext('2d'); - - context.clearRect(0,0,imageObj.width,imageObj.height); - context.save(); - context.drawImage(imageObj, 0, 0); -// context.restore(); - } + if (all_y_dx_dy_Identical) { + lockSizes = true; + console.log("All ROI have the same Y, dX and dY, ticking the sync checkbox!"); + document.getElementById("lockSizes").checked = lockSizes; + } + else { + console.log("Not all ROI have the same Y, dX and dY, unticking the sync checkbox!"); + } -function UpdateNUMBERS(_sel){ - zw = getNUMBERInfo(); + if (ROIInfo.length > 1) { + space = ROIInfo[1].x - parseInt(ROIInfo[0].x) - parseInt(ROIInfo[0].dx); + document.getElementById("space").value = space; + } - index = 0; + document.getElementById("saveroi").disabled = true; - var _index = document.getElementById("Numbers_value1"); - while (_index.length){ - _index.remove(0); + drawImage(); + draw(); } - for (var i = 0; i < zw.length; ++i){ - var option = document.createElement("option"); - option.text = zw[i]["name"]; - option.value = i; - _index.add(option); + function drawImage() { + var canvas = document.getElementById('canvas'); + var context = canvas.getContext('2d'); - if (typeof _sel !== 'undefined') { - if (zw[i]["name"] == _sel) - index = i - } - } - _index.selectedIndex = index; + context.clearRect(0,0,imageObj.width,imageObj.height); + context.save(); + context.drawImage(imageObj, 0, 0); + // context.restore(); + } - UpdateROIs(); -} + function UpdateNUMBERS(_sel) { + zw = getNUMBERInfo(); + index = 0; -function renameNumber(){ - var sel = document.getElementById("Numbers_value1"); - var _delete= sel.options[sel.selectedIndex].text; - var _numbernew = prompt("Please enter a new name for the selected number sequence", _delete); - if (_numbernew === null) { - return; //break out of the function early because prompt was aborted - } + var _index = document.getElementById("Numbers_value1"); + + while (_index.length){ + _index.remove(0); + } - erg = RenameNUMBER(_delete, _numbernew); - if (erg != "") - firework.launch(erg, 'danger', 30000); - else - UpdateNUMBERS(_numbernew); -} + for (var i = 0; i < zw.length; ++i) { + var option = document.createElement("option"); + option.text = zw[i]["name"]; + option.value = i; + _index.add(option); -function newNumber(){ - var _numbernew = prompt("Please enter a name for the new number sequence", "name"); - if (_numbernew === null) { - return; //break out of the function early because prompt was aborted + if (typeof _sel !== 'undefined') { + if (zw[i]["name"] == _sel) { + index = i; + } + } + } + + _index.selectedIndex = index; + UpdateROIs(); } - erg = CreateNUMBER(_numbernew); - if (erg != "") - firework.launch(erg, 'danger', 30000); - else - UpdateNUMBERS(_numbernew); -} - - -function removeNumber(){ - if (confirm("The entire number sequence will be removed (digit + analog parts). " + - "To remove single ROI of the number sequence, use \"Delete ROI\" instead.\n" + - "Do you really want to proceed?")) - { + function renameNumber() { var sel = document.getElementById("Numbers_value1"); var _delete= sel.options[sel.selectedIndex].text; - erg = DeleteNUMBER(_delete); - if (erg != "") + var _numbernew = prompt("Please enter a new name for the selected number sequence", _delete); + + if (_numbernew === null) { + return; //break out of the function early because prompt was aborted + } + + erg = RenameNUMBER(_delete, _numbernew); + if (erg != "") { firework.launch(erg, 'danger', 30000); - UpdateNUMBERS(); - } -} + } + else { + UpdateNUMBERS(_numbernew); + } + } + function newNumber() { + var _numbernew = prompt("Please enter a name for the new number sequence", "name"); + if (_numbernew === null) { + return; //break out of the function early because prompt was aborted + } -function drawTextBG(context, txt, x, y, padding) { - context.font = "15px Arial"; - context.textAlign = "center"; + erg = CreateNUMBER(_numbernew); + if (erg != "") { + firework.launch(erg, 'danger', 30000); + } + else { + UpdateNUMBERS(_numbernew); + } + } - context.fillStyle = 'rgba(255, 0, 0, 0.5)'; - var width = context.measureText(txt).width; - context.fillRect(x-(width+padding)/2, y-12, width + padding*2, parseInt(context.font, 10) + padding); + function removeNumber() { + if (confirm("The entire number sequence will be removed (digit + analog parts). " + + "To remove single ROI of the number sequence, use \"Delete ROI\" instead.\n" + + "Do you really want to proceed?")) { + var sel = document.getElementById("Numbers_value1"); + var _delete= sel.options[sel.selectedIndex].text; + erg = DeleteNUMBER(_delete); + if (erg != "") { + firework.launch(erg, 'danger', 30000); + } + UpdateNUMBERS(); + } + } - context.fillStyle = "black"; - context.fillText(txt, x + padding / 2, y + padding / 2); -} + function drawTextBG(context, txt, x, y, padding) { + context.font = "15px Arial"; + context.textAlign = "center"; + context.fillStyle = 'rgba(255, 0, 0, 0.5)'; + var width = context.measureText(txt).width; + context.fillRect(x-(width+padding)/2, y-12, width + padding*2, parseInt(context.font, 10) + padding); -function draw() { - if (typeof ROIInfo === 'undefined') { // During init, ROIInfo is not defined yet - return; + context.fillStyle = "black"; + context.fillText(txt, x + padding / 2, y + padding / 2); } + function draw() { + if (typeof ROIInfo === 'undefined') { // During init, ROIInfo is not defined yet + return; + } + var canvas = document.getElementById('canvas'); var context = canvas.getContext('2d'); context.drawImage(imageObj, 0, 0); @@ -756,17 +764,14 @@

Digit ROI

return; } - if (document.getElementById("Category_Digits_enabled").checked) - { + if (document.getElementById("Category_Digits_enabled").checked) { var sel = document.getElementById("index"); var _number = sel.selectedIndex; if (lockSizes) { // Synchronize Y, dx and dy - for (var _nb = 0; _nb < ROIInfo.length; _nb++) - { - if (_nb != _number) - { + for (var _nb = 0; _nb < ROIInfo.length; _nb++) { + if (_nb != _number) { ROIInfo[_nb].y = rect.startY; ROIInfo[_nb].dy = rect.h; ROIInfo[_nb].dx = rect.w; @@ -774,31 +779,31 @@

Digit ROI

} } - for (var _nb = 0; _nb < ROIInfo.length; _nb++) - { - if (_nb != _number) - { - lw = 2; - context.lineWidth = lw; - context.strokeStyle = "#990000"; - var x0 = parseInt(ROIInfo[_nb].x) - parseInt(lw/2); - var y0 = parseInt(ROIInfo[_nb].y) - parseInt(lw/2); - var dx = parseInt(ROIInfo[_nb].dx) + parseInt(lw); - var dy = parseInt(ROIInfo[_nb].dy) + parseInt(lw); - context.strokeRect(x0, y0, dx, dy); - drawTextBG(context, ROIInfo[_nb]["name"], x0+dx/2, y0-12, 5); - - lw = 1 - var x0 = parseInt(ROIInfo[_nb].x) - parseInt(lw/2); - var y0 = parseInt(ROIInfo[_nb].y) - parseInt(lw/2); - var dx = parseInt(ROIInfo[_nb].dx) + parseInt(lw); - var dy = parseInt(ROIInfo[_nb].dy) + parseInt(lw); - context.lineWidth = lw; - context.beginPath(); - context.moveTo(x0, y0+dy/2); - context.lineTo(x0+dx, y0+dy/2); - context.stroke(); - context.strokeRect(x0+dx*0.2, y0+dy*0.2, dx*0.6, dy*0.6); + if (document.getElementById("showall").checked) { + for (var _nb = 0; _nb < ROIInfo.length; _nb++) { + if (_nb != _number) { + lw = 2; + context.lineWidth = lw; + context.strokeStyle = "#990000"; + var x0 = parseInt(ROIInfo[_nb].x) - parseInt(lw/2); + var y0 = parseInt(ROIInfo[_nb].y) - parseInt(lw/2); + var dx = parseInt(ROIInfo[_nb].dx) + parseInt(lw); + var dy = parseInt(ROIInfo[_nb].dy) + parseInt(lw); + context.strokeRect(x0, y0, dx, dy); + drawTextBG(context, ROIInfo[_nb]["name"], x0+dx/2, y0-12, 5); + + lw = 1 + var x0 = parseInt(ROIInfo[_nb].x) - parseInt(lw/2); + var y0 = parseInt(ROIInfo[_nb].y) - parseInt(lw/2); + var dx = parseInt(ROIInfo[_nb].dx) + parseInt(lw); + var dy = parseInt(ROIInfo[_nb].dy) + parseInt(lw); + context.lineWidth = lw; + context.beginPath(); + context.moveTo(x0, y0+dy/2); + context.lineTo(x0+dx, y0+dy/2); + context.stroke(); + context.strokeRect(x0+dx*0.2, y0+dy*0.2, dx*0.6, dy*0.6); + } } } @@ -814,7 +819,6 @@

Digit ROI

context.lineWidth = 1; context.strokeRect(x0+dx*0.2, y0+dy*0.2, dx*0.6, dy*0.6); - context.lineWidth = 2; context.beginPath(); context.moveTo(x0, y0+dy/2); @@ -843,11 +847,11 @@

Digit ROI

if (rect.w < 0) { rect.w = -rect.w rect.startX-=rect.w - } + } if (rect.h < 0) { rect.h = -rect.h rect.startY-=rect.h - } + } document.getElementById("refdx").value = rect.w; document.getElementById("refdy").value = rect.h; document.getElementById("refx").value = rect.startX; @@ -864,7 +868,8 @@

Digit ROI

if (lockAspectRatio) { rect.h = (e.pageY - zw.top) - rect.startY; - rect.w = Math.round(rect.h * ROIInfo[aktindex]["ar"]); } + rect.w = Math.round(rect.h * ROIInfo[aktindex]["ar"]); + } else { rect.w = (e.pageX - zw.left) - rect.startX; rect.h = (e.pageY - zw.top) - rect.startY; @@ -893,7 +898,7 @@

Digit ROI

} } - function valuemanualchanged(){ + function valuemanualchanged() { if (ROIInfo.length == 0) { return; } @@ -919,7 +924,7 @@

Digit ROI

document.getElementById("saveroi").disabled = false; } - function valuemanualchangeddx(){ + function valuemanualchangeddx() { if (ROIInfo.length == 0) { return; } @@ -945,7 +950,7 @@

Digit ROI

document.getElementById("saveroi").disabled = false; } - function valuemanualchangedspace(){ + function valuemanualchangedspace() { if (!drag) { space = document.getElementById("space").value; valuemanualchanged(); @@ -978,7 +983,7 @@

Digit ROI

} } - function renameROI(){ + function renameROI() { var sel = document.getElementById("Numbers_value1"); var _number= sel.options[sel.selectedIndex].text; sel = document.getElementById("index"); @@ -990,22 +995,21 @@

Digit ROI

} erg = RenameROI(_number, "digit", _roialt, _roinew); - if (erg != "") + if (erg != "") { firework.launch(erg, 'danger', 30000); - else + } + else { UpdateROIs(_roinew); + } } - function numberChanged() - { + function numberChanged() { aktindex = 0; UpdateROIs(); } - init(); - diff --git a/sd-card/html/edit_reference.html b/sd-card/html/edit_reference.html index 47c1006a4..e9fc087b0 100644 --- a/sd-card/html/edit_reference.html +++ b/sd-card/html/edit_reference.html @@ -174,12 +174,12 @@

Reference Image and Camera Settings

- $TOOLTIP_TakeImage_Zoom - - - - $TOOLTIP_Alignment_InitialMirror LED intensity: *) - - $TOOLTIP_Alignment_FlipImageSize Brightness: *) - + 0 $TOOLTIP_TakeImage_Brightness
- degree - + 0 $TOOLTIP_TakeImage_Contrast
- degree - + 0 $TOOLTIP_TakeImage_Saturation
+ - - $TOOLTIP_TakeImage_Grayscale$TOOLTIP_TakeImage_Negative - $TOOLTIP_TakeImage_Aec2
- - $TOOLTIP_TakeImage_Negative$TOOLTIP_TakeImage_Grayscale Auto Exposure Level: *) - + 0 $TOOLTIP_TakeImage_AutoExposureLevel - $TOOLTIP_TakeImage_FixedExposure Sharpness: *) - + 0 $TOOLTIP_TakeImage_Sharpness