|
| 1 | +*Copyright (C) 2026, Axis Communications AB, Lund, Sweden. All Rights Reserved.* |
| 2 | + |
| 3 | +# ACAP application drawing video overlays |
| 4 | + |
| 5 | +This README file explains how to build an ACAP application that uses the axoverlay API, version 2.0. |
| 6 | + |
| 7 | +Together with this README file, you should be able to find a directory called app. That directory contains the "axoverlay2" application source code which can easily be compiled and run with the help of the tools and step by step below. |
| 8 | + |
| 9 | +For more information on Axoverlay2 API, please see the [Axis developer documentation](https://developer.axis.com/acap/4/api/#axoverlay2-api). |
| 10 | + |
| 11 | +This example illustrates how to draw overlays in a video stream and Cairo is used as rendering API, see [documentation](https://www.cairographics.org/). In this example, a rotating and color-shifting icon is drawn. |
| 12 | + |
| 13 | +## Getting started |
| 14 | + |
| 15 | +These instructions will guide you on how to execute the code. Below is the structure and scripts used in the example: |
| 16 | + |
| 17 | +```sh |
| 18 | +axoverlay2 |
| 19 | +├── app |
| 20 | +│ ├── axoverlay2.c |
| 21 | +│ ├── LICENSE |
| 22 | +│ ├── Makefile |
| 23 | +│ └── manifest.json |
| 24 | +├── Dockerfile |
| 25 | +└── README.md |
| 26 | +``` |
| 27 | + |
| 28 | +- **app/axoverlay2.c** - Application to draw overlays using axoverlay 2.0 in C. |
| 29 | +- **app/LICENSE** - Text file that lists all open source licensed source code distributed with the application. |
| 30 | +- **app/Makefile** - Build and link instructions for the application. |
| 31 | +- **app/manifest.json** - Defines the application and its configuration. |
| 32 | +- **Dockerfile** - Assembles an image containing the ACAP Native SDK and builds the application using it. |
| 33 | +- **README.md** - Step-by-step instructions on how to run the example. |
| 34 | + |
| 35 | +### Supported devices |
| 36 | + |
| 37 | +- ARTPEC-9, ARTPEC-8, and ARTPEC-7 based cameras and other video devices. |
| 38 | + |
| 39 | +## Build the application |
| 40 | + |
| 41 | +Standing in your working directory, run the following commands: |
| 42 | + |
| 43 | +> [!NOTE] |
| 44 | +> |
| 45 | +> Depending on the network your local build machine is connected to, you may need to add proxy |
| 46 | +> settings for Docker. See |
| 47 | +> [Proxy in build time](https://developer.axis.com/acap/develop/proxy/#proxy-in-build-time). |
| 48 | +
|
| 49 | +```sh |
| 50 | +docker build --platform=linux/amd64 --tag <APP_IMAGE> --build-arg ARCH=<ARCH> . |
| 51 | +``` |
| 52 | + |
| 53 | +- `<APP_IMAGE>` is the name to tag the image with, e.g., `axoverlay2:1.0` |
| 54 | +- `<ARCH>` is the architecture of the camera you are using, e.g., `armv7hf` (default) or `aarch64` |
| 55 | + |
| 56 | +Copy the result from the container image to a local directory called `build`: |
| 57 | + |
| 58 | +```sh |
| 59 | +docker cp $(docker create --platform=linux/amd64 <APP_IMAGE>):/opt/app ./build |
| 60 | +``` |
| 61 | + |
| 62 | +The `build` directory contains the build artifacts, where the ACAP application |
| 63 | +is found with suffix `.eap`, depending on which SDK architecture that was |
| 64 | +chosen, one of these files should be found: |
| 65 | + |
| 66 | +- `Axoverlay2_example_application_1_0_0_aarch64.eap` |
| 67 | +- `Axoverlay2_example_application_1_0_0_armv7hf.eap` |
| 68 | + |
| 69 | +> [!NOTE] |
| 70 | +> |
| 71 | +> For detailed information on how to build, install, and run ACAP applications, refer to the official ACAP documentation: [Build, install, and run](https://developer.axis.com/acap/develop/build-install-run/). |
| 72 | +
|
| 73 | +## Install and start the application |
| 74 | + |
| 75 | +Browse to the application page of the Axis device: |
| 76 | + |
| 77 | +```sh |
| 78 | +http://<AXIS_DEVICE_IP>/index.html#apps |
| 79 | +``` |
| 80 | + |
| 81 | +1. Click on the tab **Apps** in the device GUI |
| 82 | +2. Enable the **Allow unsigned apps** toggle |
| 83 | +3. Click the **(+ Add app)** button to upload the application file |
| 84 | +4. Select the newly built application package, depending on architecture: |
| 85 | + |
| 86 | + - `Axoverlay2_example_application_1_0_0_aarch64.eap` |
| 87 | + - `Axoverlay2_example_application_1_0_0_armv7hf.eap` |
| 88 | + |
| 89 | +5. Click **Install** |
| 90 | +6. Run the application by enabling the **Start** switch. |
| 91 | + |
| 92 | +## Expected output |
| 93 | + |
| 94 | +<img alt='A green smiley face superimposed on a picture of a roof' src="screenshot.jpg" width="500"> |
| 95 | + |
| 96 | +While the application is running, a rotating and colour-shifting icon should appear in the top-left |
| 97 | +corner of video streams. |
| 98 | + |
| 99 | +The application log can be found directly at: |
| 100 | + |
| 101 | +```sh |
| 102 | +http://<AXIS_DEVICE_IP>/axis-cgi/admin/systemlog.cgi?appname=axoverlay2 |
| 103 | +``` |
| 104 | + |
| 105 | +During normal operation, the application prints log entries for each connecting and disconnecting |
| 106 | +video stream: |
| 107 | + |
| 108 | +```text |
| 109 | +axoverlay2[2095]: Created overlay 1 on stream 1041, stream_size=3840x2160 overlay_used_size=135x135 overlay_full_size=136x136 |
| 110 | +axoverlay2[2095]: Removed overlay 1 from stream 1041 |
| 111 | +``` |
| 112 | + |
| 113 | +In addition, the code contains some debug prints which may be enabled using the DEBUG flag found in |
| 114 | +axoverlay2.c. |
| 115 | + |
| 116 | +## License |
| 117 | + |
| 118 | +**[MIT](../LICENSE)** |
0 commit comments