Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/axoverlay2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build axoverlay2 application
on:
workflow_dispatch:
push:
paths:
- 'axoverlay2/**'
- '!axoverlay2/README.md'
- '.github/workflows/axoverlay2.yml'
jobs:
test-app:
name: Test app
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
axis-os: ["12.10.68"]
arch: ["armv7hf", "aarch64"]
env:
EXREPO: acap-native-examples
EXNAME: axoverlay2
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v3

- name: Build ${{ env.EXNAME }} application
env:
imagetag: ${{ env.EXREPO }}_${{ env.EXNAME }}:${{ matrix.arch }}
run: |
docker image rm -f $imagetag
cd $EXNAME
docker build --no-cache --tag $imagetag --build-arg ARCH=${{ matrix.arch }} .
docker cp $(docker create $imagetag):/opt/app ./build
cd ..
docker image rm -f $imagetag
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ The examples are organized into logical groups to help you find the most relevan

### Graphical components

- [axoverlay2](./axoverlay2/)
- An example in C that illustrates how to draw icons as overlays in a stream using the modern
[Overlay API](https://developer.axis.com/acap/api#overlay2-API).
- [axoverlay](./axoverlay/)
- An example in C that illustrates how to draw plain boxes and text as overlays in a stream.
- An example in C that illustrates how to draw plain boxes and text as overlays in a stream using
the [Axoverlay API (Legacy)](https://developer.axis.com/acap/api#axoverlay-api-legacy).
- [bounding-box](./bounding-box/)
- An example in C that demonstrates how to portably draw burnt-in bounding boxes on selected video sources or channels.
- [vdo-opencl-filtering](./vdo-opencl-filtering/)
Expand Down
12 changes: 12 additions & 0 deletions axoverlay2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG ARCH=armv7hf
ARG VERSION=12.10.0
ARG UBUNTU_VERSION=24.04
ARG REPO=axisecp
ARG SDK=acap-native-sdk

FROM ${REPO}/${SDK}:${VERSION}-${ARCH}-ubuntu${UBUNTU_VERSION}

# Building the ACAP application
COPY ./app /opt/app/
WORKDIR /opt/app
RUN . /opt/axis/acapsdk/environment-setup* && acap-build .
118 changes: 118 additions & 0 deletions axoverlay2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
*Copyright (C) 2026, Axis Communications AB, Lund, Sweden. All Rights Reserved.*

# ACAP application drawing video overlays

This README file explains how to build an ACAP application that uses the axoverlay API, version 2.0.

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.

For more information on Axoverlay2 API, please see the [Axis developer documentation](https://developer.axis.com/acap/4/api/#axoverlay2-api).

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.

## Getting started

These instructions will guide you on how to execute the code. Below is the structure and scripts used in the example:

```sh
axoverlay2
├── app
│ ├── axoverlay2.c
│ ├── LICENSE
│ ├── Makefile
│ └── manifest.json
├── Dockerfile
└── README.md
```

- **app/axoverlay2.c** - Application to draw overlays using axoverlay 2.0 in C.
- **app/LICENSE** - Text file that lists all open source licensed source code distributed with the application.
- **app/Makefile** - Build and link instructions for the application.
- **app/manifest.json** - Defines the application and its configuration.
- **Dockerfile** - Assembles an image containing the ACAP Native SDK and builds the application using it.
- **README.md** - Step-by-step instructions on how to run the example.

### Supported devices

- ARTPEC-9, ARTPEC-8, and ARTPEC-7 based cameras and other video devices.

## Build the application

Standing in your working directory, run the following commands:

> [!NOTE]
>
> Depending on the network your local build machine is connected to, you may need to add proxy
> settings for Docker. See
> [Proxy in build time](https://developer.axis.com/acap/develop/proxy/#proxy-in-build-time).

```sh
docker build --platform=linux/amd64 --tag <APP_IMAGE> --build-arg ARCH=<ARCH> .
```

- `<APP_IMAGE>` is the name to tag the image with, e.g., `axoverlay2:1.0`
- `<ARCH>` is the architecture of the camera you are using, e.g., `armv7hf` (default) or `aarch64`

Copy the result from the container image to a local directory called `build`:

```sh
docker cp $(docker create --platform=linux/amd64 <APP_IMAGE>):/opt/app ./build
```

The `build` directory contains the build artifacts, where the ACAP application
is found with suffix `.eap`, depending on which SDK architecture that was
chosen, one of these files should be found:

- `Axoverlay2_example_application_1_0_0_aarch64.eap`
- `Axoverlay2_example_application_1_0_0_armv7hf.eap`

> [!NOTE]
>
> 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/).

## Install and start the application

Browse to the application page of the Axis device:

```sh
http://<AXIS_DEVICE_IP>/index.html#apps
```

1. Click on the tab **Apps** in the device GUI
2. Enable the **Allow unsigned apps** toggle
3. Click the **(+ Add app)** button to upload the application file
4. Select the newly built application package, depending on architecture:

- `Axoverlay2_example_application_1_0_0_aarch64.eap`
- `Axoverlay2_example_application_1_0_0_armv7hf.eap`

5. Click **Install**
6. Run the application by enabling the **Start** switch.

## Expected output

<img alt='A green smiley face superimposed on a picture of a roof' src="screenshot.jpg" width="500">

While the application is running, a rotating and colour-shifting icon should appear in the top-left
corner of video streams.

The application log can be found directly at:

```sh
http://<AXIS_DEVICE_IP>/axis-cgi/admin/systemlog.cgi?appname=axoverlay2
```

During normal operation, the application prints log entries for each connecting and disconnecting
video stream:

```text
axoverlay2[2095]: Created overlay 1 on stream 1041, stream_size=3840x2160 overlay_used_size=135x135 overlay_full_size=136x136
axoverlay2[2095]: Removed overlay 1 from stream 1041
```

In addition, the code contains some debug prints which may be enabled using the DEBUG flag found in
axoverlay2.c.

## License

**[MIT](../LICENSE)**
1 change: 1 addition & 0 deletions axoverlay2/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
21 changes: 21 additions & 0 deletions axoverlay2/app/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Axis Communications AB

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 30 additions & 0 deletions axoverlay2/app/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
PROG1 = $(shell jq -r '.acapPackageConf.setup.appName' manifest.json)

PKGS = gio-2.0 glib-2.0 cairo vdostream axoverlay2
CFLAGS += $(shell pkg-config --cflags $(PKGS))
LDLIBS += $(shell pkg-config --libs $(PKGS)) -lm

CFLAGS += -Wall \
-Wextra \
-Wformat=2 \
-Wpointer-arith \
-Wbad-function-cast \
-Wstrict-prototypes \
-Wmissing-prototypes \
-Winline \
-Wdisabled-optimization \
-Wfloat-equal \
-W \
-Werror

all: axoverlay2

$(PROG1): $(PROG1).c
mkdir -p debug
$(CC) $^ $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o debug/$@
cp debug/$@ .
$(STRIP) $@

.PHONY: clean
clean:
rm -rf $(PROG1) *.o *.eap* *_LICENSE.txt package.conf* param.conf tmp* debug
Loading
Loading