Skip to content
README.md 4.64 KiB
Newer Older
Tamas Petz's avatar
Tamas Petz committed
<!--
Mark Horvath's avatar
Mark Horvath committed
SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
Tamas Petz's avatar
Tamas Petz committed

SPDX-License-Identifier: Apache-2.0
-->

---
**NOT SUITABLE FOR DEPLOYMENT OR PRODUCTION USE**
---

# IntrinsicCV

This project is in the early stages of development and is not ready for use
except as a preview.

Michael Platings's avatar
Michael Platings committed
IntrinsicCV is a library aiming to give high-performing image
Tamas Petz's avatar
Tamas Petz committed
processing functions on Arm. It is designed to be simple to import into a wide
variety of projects.
Tamas Petz's avatar
Tamas Petz committed

Michael Platings's avatar
Michael Platings committed
The library provides a C interface. For details see
[the C API documentation](https://intrinsiccv.sites.arm.com/intrinsiccv/).
Tamas Petz's avatar
Tamas Petz committed

Michael Platings's avatar
Michael Platings committed
An adapter layer API is currently provided for:
* OpenCV - [available functionality overview](adapters/opencv/doc-opencv.md)
Tamas Petz's avatar
Tamas Petz committed

# Structure

The directory `intrinsiccv` contains generic implementation of the library.
Integration with other projects are stored in `adapters` folder. `test` contains
API and unit tests for the library. All supporting scripts are located in
`scripts`.

Mark Horvath's avatar
Mark Horvath committed
# Standalone build using CMake
Tamas Petz's avatar
Tamas Petz committed

The library can be built using CMake:
```
Tamas Petz's avatar
Tamas Petz committed
cmake \
-S /path/to/intrinsiccv \
-B build-intrinsiccv \
Mark Horvath's avatar
Mark Horvath committed
cmake --build build-intrinsiccv --parallel
```

To target Android devices the following CMake flags are also required:
```
Tamas Petz's avatar
Tamas Petz committed
-DCMAKE_TOOLCHAIN_FILE=/path/to/android-ndk/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a
Tamas Petz's avatar
Tamas Petz committed
```

Mark Horvath's avatar
Mark Horvath committed
# Standalone build using the provided script
Tamas Petz's avatar
Tamas Petz committed

Mark Horvath's avatar
Mark Horvath committed
Build scripts for Linux/macOS are provided for convenience. To build the library run:
```
scripts/build.sh
```

To target Android devices the following command can be used:
Tamas Petz's avatar
Tamas Petz committed
```
BUILD_ID=android \
CMAKE_TOOLCHAIN_FILE=/path/to/android-ndk/build/cmake/android.toolchain.cmake \
EXTRA_CMAKE_ARGS="-DANDROID_ABI=arm64-v8a" \
scripts/build.sh
```

Mark Horvath's avatar
Mark Horvath committed
The build artifacts are placed in the `build` directory.
Tamas Petz's avatar
Tamas Petz committed

Mark Horvath's avatar
Mark Horvath committed
## Build and run tests for Android
Tamas Petz's avatar
Tamas Petz committed

Mark Horvath's avatar
Mark Horvath committed
To build all the tests use the target `intrinsiccv-test`, to also run them use
Tamas Petz's avatar
Tamas Petz committed
`check-intrinsiccv` and set a proper `CMAKE_CROSSCOMPILING_EMULATOR`.

Mark Horvath's avatar
Mark Horvath committed
To build all tests:
Tamas Petz's avatar
Tamas Petz committed
```
BUILD_ID=android \
CMAKE_TOOLCHAIN_FILE=/path/to/android-ndk/build/cmake/android.toolchain.cmake \
EXTRA_CMAKE_ARGS="-DANDROID_ABI=arm64-v8a" \
scripts/build.sh intrinsiccv-test
```

Mark Horvath's avatar
Mark Horvath committed
To run the tests:
Tamas Petz's avatar
Tamas Petz committed
```
BUILD_ID=android \
CMAKE_TOOLCHAIN_FILE=/path/to/android-ndk/build/cmake/android.toolchain.cmake \
ADB=<path to adb executable of choice> \
CMAKE_CROSSCOMPILING_EMULATOR="<path to intrinsiccv>/scripts/test_android.sh;<path to intrinsiccv>/build/<build_id>" \
EXTRA_CMAKE_ARGS="-DANDROID_ABI=arm64-v8a" \
scripts/build.sh check-intrinsiccv
```

Mark Horvath's avatar
Mark Horvath committed
For further options please refer to the documentation in `./scripts/build.sh`
and `./scripts/test_android.sh`.

Tamas Petz's avatar
Tamas Petz committed
# Building with OpenCV

## Install

This library is compatible with [OpenCV](https://opencv.org) version 5.x.

Integration consists of the following steps:
1. Download OpenCV sources:
```
git clone https://github.com/opencv/opencv
cd opencv
git checkout 67a3d35b4ea1b11136042cdf5072a634d6789984
```
2. Patch OpenCV:
```
git apply /path/to/intrinsiccv/adapters/opencv/opencv-5.x.patch
```

## Build Library

Mark Horvath's avatar
Mark Horvath committed
The project can be built using standard cmake.
Tamas Petz's avatar
Tamas Petz committed

```
cmake \
-S /path/to/opencv \
-B build-opencv \
-DWITH_INTRINSICCV=ON \
-DINTRINSICCV_SOURCE_PATH=/path/to/intrinsiccv \
-DCMAKE_CXX_STANDARD=14 \
-DBUILD_ANDROID_EXAMPLE=OFF \
-DBUILD_ANDROID_PROJECTS=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF

cmake --build build-opencv --parallel
```

Mark Horvath's avatar
Mark Horvath committed
To target Android devices the following CMake flags are required here as well:
```
-DCMAKE_TOOLCHAIN_FILE=/path/to/android-ndk/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a
```

# Build Prerequisites
While the core functionality of the library does not rely on any third-party libraries, there are
build prerequisites that are essential for compiling the source code and generating the executable.
Please ensure that these tools are installed on your system before proceeding with the build
process.
Tamas Petz's avatar
Tamas Petz committed

To successfully build and compile this project, you'll need the following tools:
Tamas Petz's avatar
Tamas Petz committed
- [cmake](https://cmake.org) version 3.16 or newer (3.21 is recommended),
- [ninja](https://ninja-build.org),
- [gcovr](https://gcovr.com/) and its dependencies for coverage reports,
- [rsync](https://linux.die.net/man/1/rsync) for coverage reports,
- recent version of [llvm](https://llvm.org), preferably 17 or newer.

Mark Horvath's avatar
Mark Horvath committed
Building for Android requires the [Android NDK](https://developer.android.com/ndk/).

Running tests on Android devices requires [ADB](https://developer.android.com/tools/adb).
Can be installed standalone by installing [Android SDK Platform-Tools](https://developer.android.com/tools/releases/platform-tools).

Tamas Petz's avatar
Tamas Petz committed
OpenCV has its own
[dependencies](https://docs.opencv.org/5.x/d7/d9f/tutorial_linux_install.html).