{"id":28995085,"url":"https://github.com/axiscommunications/opc-ua-gaugereader-acap","last_synced_at":"2025-06-25T04:06:31.722Z","repository":{"id":77758048,"uuid":"537366666","full_name":"AxisCommunications/opc-ua-gaugereader-acap","owner":"AxisCommunications","description":"Small example ACAP application that reads analog gauges with video analytics and exposes the value via OPC UA.","archived":false,"fork":false,"pushed_at":"2025-03-03T15:38:08.000Z","size":2571,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-03T16:25:49.446Z","etag":null,"topics":["acap","axis","industry-4","industry-40","industry40","opc","opc-ua","opcua","opencv","video-analytics"],"latest_commit_sha":null,"homepage":"https://www.axis.com/developer-community/industry-4-0-integration","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AxisCommunications.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-16T08:15:00.000Z","updated_at":"2025-03-03T15:38:11.000Z","dependencies_parsed_at":"2023-03-05T20:00:43.908Z","dependency_job_id":"7582a081-3df2-4ac2-b5fe-8115a9857f4d","html_url":"https://github.com/AxisCommunications/opc-ua-gaugereader-acap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AxisCommunications/opc-ua-gaugereader-acap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Fopc-ua-gaugereader-acap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Fopc-ua-gaugereader-acap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Fopc-ua-gaugereader-acap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Fopc-ua-gaugereader-acap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AxisCommunications","download_url":"https://codeload.github.com/AxisCommunications/opc-ua-gaugereader-acap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Fopc-ua-gaugereader-acap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261801988,"owners_count":23211664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acap","axis","industry-4","industry-40","industry40","opc","opc-ua","opcua","opencv","video-analytics"],"created_at":"2025-06-25T04:06:29.769Z","updated_at":"2025-06-25T04:06:31.703Z","avatar_url":"https://github.com/AxisCommunications.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"*Copyright (C) 2025, Axis Communications AB, Lund, Sweden. All Rights Reserved.*\n\n# OPC UA Gauge Reader ACAP\n\n[![Build ACAP packages](https://github.com/AxisCommunications/opc-ua-gaugereader-acap/actions/workflows/build.yml/badge.svg)](https://github.com/AxisCommunications/opc-ua-gaugereader-acap/actions/workflows/build.yml)\n[![GitHub Super-Linter](https://github.com/AxisCommunications/opc-ua-gaugereader-acap/actions/workflows/super-linter.yml/badge.svg)](https://github.com/AxisCommunications/opc-ua-gaugereader-acap/actions/workflows/super-linter.yml)\n\n![Image of a water level gauge](images/water_level_gauge.jpg)\n\nThis repository contains the source code to build a small example\n[ACAP version 4](https://axiscommunications.github.io/acap-documentation/)\n(native) application that reads an analog gauge using video analytics with\n[OpenCV](https://opencv.org/)\nand exposes the value through a built-in\n[OPC UA](https://en.wikipedia.org/wiki/OPC_Unified_Architecture)\n([open62541](https://open62541.org/)) server.\n\n![Architectural overview](images/acap_architecture.svg)\n\nThe exposed value is in percent.\n\n\u003e [!NOTE]\n\u003e Even if this application would fit right into your usecase, its purpose is\n\u003e above all to serve as an example and boilerplate rather than being ready for\n\u003e production.\n\n## Example Use Cases\n\n\u003e The following examples assume that you have a [SCADA](https://en.wikipedia.org/wiki/SCADA) (Supervisory\nControl And Data Acquisition) system or a [PLC](https://en.wikipedia.org/wiki/Programmable_logic_controller) (Programmable Logic Controller) system with OPC UA as the communication protocol and you want to take advantage of the Axis device capabilities to enrich or complement your operations.\n\nAnalog gauges are common in the industry, and it is often impossible to add\ndigital sensors due to regulations or warranty restrictions. However, having a\nhuman operator monitor these gauges (which is what is done today) is\ninconvenient and error-prone. Instead, we can use an IP camera with very basic\nvideo analysis to automatically capture the digital reading and feed it into\nthe industrial system. Automating the capture of digital values from analog\ngauges opens up a multitude of possibilities.\n\nFor example:\n\n- shutdown or start a PLC process if a gauge reading exceeds or falls below a specified threshold\n- generate alarms when the gauge reading goes outside a predefined range\n- display real-time gauge values within the SCADA server's operational interface\n- maintain historical logs of gauge values to track changes over time\n\n\u003e [!WARNING]\n\u003e Please note that any analytic process can never be 100% accurate and the system designer has to account for this.\n\n## Build\n\nThe build process uses the\n[ACAP SDK build container](https://hub.docker.com/r/axisecp/acap-sdk)\nand Docker or Podman.\n\nThe Docker and Podman commands are integrated in the [Makefile](Makefile), so\nif you have Docker or Podman and `make` on your computer all you need to do is:\n\n```sh\nmake dockerbuild\n```\n\nor\n\n```sh\nmake podmanbuild\n```\n\nor perhaps build in parallel:\n\n```sh\nmake -j dockerbuild\n```\n\nalternatively\n\n```sh\nmake -j podmanbuild\n```\n\nIf you do have Docker but no `make` on your system:\n\n```sh\n# 32-bit ARM, e.g. ARTPEC-6- and ARTPEC-7-based devices\nDOCKER_BUILDKIT=1 docker build --build-arg ARCH=armv7hf -o type=local,dest=. .\n# 64-bit ARM, e.g. ARTPEC-8 and ARTPEC-9-based devices\nDOCKER_BUILDKIT=1 docker build --build-arg ARCH=aarch64 -o type=local,dest=. .\n```\n\nIf you do have Podman but no `make` on your system:\n\n```sh\n# 32-bit ARM, e.g. ARTPEC-6- and ARTPEC-7-based devices\npodman build --build-arg ARCH=armv7hf -o type=local,dest=. .\n# 64-bit ARM, e.g. ARTPEC-8 and ARTPEC-9-based devices\npodman build --build-arg ARCH=aarch64 -o type=local,dest=. .\n```\n\n## Debug\n\nIf you would like the application to store the images from each step in the\nvideo analysis to disk for debugging, set the `DEBUG_WRITE` variable for the\nbuild:\n\n```sh\nDEBUG_WRITE=y make -j dockerbuild\n```\n\nor\n\n```sh\n# 32-bit ARM, e.g. ARTPEC-6- and ARTPEC-7-based devices\nDOCKER_BUILDKIT=1 docker build --build-arg DEBUG_WRITE=y --build-arg ARCH=armv7hf -o type=local,dest=. .\n# 64-bit ARM, e.g. ARTPEC-8 and ARTPEC-9-based devices\nDOCKER_BUILDKIT=1 docker build --build-arg DEBUG_WRITE=y --build-arg ARCH=aarch64 -o type=local,dest=. .\n```\n\n\u003e [!TIP]\n\u003e For Podman, use the same commands using `podman` instead of `docker`.\n\n## Setup\n\n### Manual installation and configuration\n\nUpload the ACAP application file (the file with the `.eap` extension for the\ncamera's architecture) through the camera's web UI: *Apps-\u003eAdd app*\n\nWhen installed, start the application.\n\n![Web UI Screenshot](images/web_ui_open_settings.png)\n\nOpen the application's settings page in the web interface (available when the\napplication is running) by clicking the *Open* button.\n\n![Web UI Screenshot](images/web_ui_settings.png)\n\nIn the settings page, simply click in the image to set up the calibration\npoints in the following order:\n\n1. Center of the gauge\n1. Minimum value of the gauge\n1. Maximum value of the gauge\n\nThe calibration points can also, along with the OPC UA Server port (default is\n4840) and clockwise/counterclockwise (default is clockwise), be set directly\nthrough the application's parameter settings, found in the three vertical dots menu:\n\n![Web UI Screenshot](images/web_ui_open_param_settings.png)\n\n![Web UI Screenshot](images/web_ui_param_settings.png)\n\n### Scripted installation and configuration\n\nUse the camera's\n[applications/upload.cgi](https://www.axis.com/vapix-library/subjects/t10102231/section/t10036126/display?section=t10036126-t10010609)\nto upload the ACAP application file (the file with the `.eap` extension for the\ncamera's architecture):\n\n```sh\ncurl -k --anyauth -u root:\u003cpassword\u003e \\\n    -F packfil=@OPC_UA_Gauge_Reader_\u003cversion\u003e_\u003carchitecture\u003e.eap \\\n    https://\u003ccamera hostname/ip\u003e/axis-cgi/applications/upload.cgi\n```\n\nTo\n[start (or stop/restart/remove)](https://www.axis.com/vapix-library/subjects/t10102231/section/t10036126/display?section=t10036126-t10010606)\nthe application, you can make a call like this:\n\n```sh\ncurl -k --anyauth -u root:\u003cpassword\u003e \\\n    'https://\u003ccamera hostname/ip\u003e/axis-cgi/applications/control.cgi?package=opcuagaugereader\u0026action=start'\n```\n\nUse the camera's\n[param.cgi](https://www.axis.com/vapix-library/subjects/t10175981/section/t10036014/display)\nto set the center/min/max points, as well as clockwise/counterclockwise and the\nOPC UA server port number.\n\nThe call\n\n```sh\ncurl -k --anyauth -u root:\u003cpassword\u003e \\\n    'https://\u003ccamera hostname/ip\u003e/axis-cgi/param.cgi?action=list\u0026group=opcuagaugereader'\n```\n\nwill list the current settings:\n\n```sh\nroot.Opcuagaugereader.DynamicStringNumber=1\nroot.Opcuagaugereader.centerX=479\nroot.Opcuagaugereader.centerY=355\nroot.Opcuagaugereader.clockwise=1\nroot.Opcuagaugereader.maxX=678\nroot.Opcuagaugereader.maxY=165\nroot.Opcuagaugereader.minX=283\nroot.Opcuagaugereader.minY=167\nroot.Opcuagaugereader.port=4840\n```\n\nIf you want to set the OPC UA server port to e.g. 4842:\n\n```sh\ncurl -k --anyauth -u root:\u003cpassword\u003e \\\n    'https://\u003ccamera hostname/ip\u003e/axis-cgi/param.cgi?action=update\u0026opcuagaugereader.port=4842'\n```\n\n## Usage\n\nAttach an OPC UA client to the port set in ACAP. The client will then be able\nto read the value (and its timestamp) from the application's OPC UA server.\n\n\u003e [!NOTE]\n\u003e The application will also log the gauge value in the camera's syslog.\n\n### Bonus\n\nIn addition to the above, the application will write the extracted gauge\nreading as a\n[dynamic text overlay](https://www.axis.com/vapix-library/subjects/t10175981/section/t10007638/display?section=t10007638-t10003585)\nstring. It can then be displayed as camera text overlay\u0026mdash;or used by graph\nwidgets\u0026mdash;with the modifier **#D***N*, where *N* is set by the application\nparameter `DynamicStringNumber`.\n\n## License\n\n[Apache 2.0](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxiscommunications%2Fopc-ua-gaugereader-acap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxiscommunications%2Fopc-ua-gaugereader-acap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxiscommunications%2Fopc-ua-gaugereader-acap/lists"}