Skip to content

Commit 216ed52

Browse files
Merge pull request #1594 from madeline-underwood/OpenCVKleidiCV
OpenCV KleidiCV_Andy to review
2 parents 9a6ea6f + 1555ca3 commit 216ed52

File tree

6 files changed

+122
-90
lines changed

6 files changed

+122
-90
lines changed

content/learning-paths/mobile-graphics-and-gaming/android_opencv_kleidicv/_index.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
---
2-
title: Accelerate OpenCV-based Android Applications with KleidiCV
2+
title: Accelerate an OpenCV-based Android Application with KleidiCV
33

44
minutes_to_complete: 45
55

6-
who_is_this_for: This is an introductory topic for developers who are interested in creating Computer Vision Applications with OpenCV and KleidiCV on Android Devices.
6+
who_is_this_for: This is an introductory topic for developers who are interested in creating Computer Vision applications with OpenCV and KleidiCV on Android Devices.
77

88
learning_objectives:
99
- Describe what KleidiCV is, and what it can offer.
1010
- Create and configure a project to add OpenCV support.
11-
- Process images using various OpenCV functions.
11+
- Process images using OpenCV functionality.
1212

1313
prerequisites:
1414
- A development machine with [Android Studio](https://developer.android.com/studio) installed.
15+
- Familiarity with Android development concepts.
1516
- An Android smartphone.
1617

1718
author: Dawid Borycki
@@ -22,7 +23,7 @@ subjects: Graphics
2223
armips:
2324
- Cortex-A
2425
operatingsystems:
25-
- Windows
26+
- Android
2627
tools_software_languages:
2728
- Android
2829
- Android Studio

content/learning-paths/mobile-graphics-and-gaming/android_opencv_kleidicv/background.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,28 @@ weight: 2
77
layout: "learningpathall"
88
---
99

10-
## OpenCV Overview with HAL and KleidiCV
10+
## What is OpenCV in Computer Vision?
11+
Open Source Computer Vision Library (OpenCV) is a framework for real-time computer vision, that you can use across different platforms, including mobile devices. Modern smartphones equipped with advanced cameras and powerful processors can efficiently handle complex computer vision tasks, and OpenCV is a go-to choice for developers. Its cross-platform compatibility allows the creation of versatile applications that work across multiple devices without extensive code modifications.
1112

12-
### OpenCV in Computer Vision
13-
OpenCV (Open Source Computer Vision Library) is a robust framework for real-time computer vision, widely used across platforms, including mobile devices. Modern smartphones equipped with advanced cameras and powerful processors can efficiently handle complex computer vision tasks, making OpenCV a go-to choice for developers. Its cross-platform compatibility allows the creation of versatile applications that work seamlessly across multiple devices without extensive code modifications.
13+
## What does OpenCV offer Android Developers?
14+
For Android developers, OpenCV offers an SDK designed for integration with Android Studio, the primary development environment. The SDK simplifies the process of adding OpenCV libraries, managing dependencies, and configuring projects, enabling developers to easily incorporate vision capabilities into their applications.
1415

15-
### Integration with Android and Kotlin
16-
OpenCV integrates well with Android development, leveraging Kotlin’s concise syntax and Java interoperability to simplify implementation. Developers can use OpenCV’s diverse set of functionalities, such as image and video capture, filtering, transformations, feature detection, object recognition, and machine learning integration, to build efficient and maintainable applications.
16+
## How does OpenCV Integrate with Android and Kotlin?
17+
OpenCV integrates with Android development, leveraging Kotlin’s concise syntax and Java's interoperability, to simplify implementation. You can use OpenCV’s diverse set of functionalities, such as image and video capture, filtering, transformations, feature detection, object recognition, and machine learning integration, to build efficient and maintainable applications.
1718

18-
### Performance Optimization and HAL
19-
OpenCV is optimized for high performance, utilizing native C++ code for efficient processing. This ensures real-time performance, particularly on mobile devices where computational resources may be limited. A critical component enabling these optimizations is the Hardware Acceleration Layer (HAL). HAL serves as an abstraction layer that enables hardware-specific acceleration by utilizing device-specific optimizations. This significantly boosts the performance of OpenCV functions on supported hardware, reducing processing time and power consumption. HAL makes OpenCV highly adaptable to modern multi-core processors and GPU architectures, vital for computationally intensive tasks like object detection and image recognition.
19+
## How is Performance Optimized with HAL?
20+
OpenCV is optimized for performance, utilizing native C++ code for efficient processing. This ensures optimized real-time performance, particularly on mobile devices where computational resources might be limited.
2021

21-
### ARM and KleidiCV
22-
To further enhance OpenCV’s capabilities on ARM-based devices, ARM developed KleidiCV, a specialized library that leverages OpenCV’s HAL for hardware acceleration. KleidiCV is an Arm Kleidi Library, a suite of highly performant open-source Arm routines. KleidiCV focuses on optimizing various OpenCV functions specifically for ARM processors, ensuring faster execution and lower power consumption. This integration is particularly beneficial for mobile and embedded systems where performance efficiency is critical. By utilizing HAL, KleidiCV allows developers to harness the full potential of ARM hardware, making it an ideal solution for applications requiring high-performance computer vision on ARM-based devices.
22+
A critical component in enabling these optimizations is the Hardware Acceleration Layer (HAL). HAL serves as an abstraction layer that enables hardware-specific acceleration by utilizing device-specific optimizations. This significantly boosts the performance of OpenCV functions on supported hardware, which reduces processing time and power consumption. HAL makes OpenCV adaptable to modern multi-core processors and GPU architectures, which are essential for computationally-intensive tasks, such as object detection and image recognition.
2323

24-
### OpenCV for Android Developers
25-
For Android developers, OpenCV offers an SDK designed for seamless integration with Android Studio, the primary development environment. The SDK simplifies the process of adding OpenCV libraries, managing dependencies, and configuring projects, enabling developers to incorporate sophisticated vision capabilities into their applications effortlessly.
24+
## What is KleidiCV?
25+
KleidiCV is an Arm Kleidi Library, a suite of highly performant open-source Arm routines that leverages OpenCV’s HAL for hardware acceleration. KleidiCV focuses on optimizing various OpenCV functions specifically for Arm processors, ensuring faster execution and lower power consumption.
2626

27-
By combining OpenCV’s rich feature set, hardware optimization via HAL, and specialized enhancements like ARM’s KleidiCV, developers can build efficient, high-performing computer vision solutions tailored for modern mobile and embedded systems.
27+
This integration is particularly beneficial for mobile and embedded systems where performance efficiency is critical. By utilizing HAL, KleidiCV allows developers to harness the full potential of Arm hardware, making it an ideal solution for applications requiring high-performance computer vision on Arm-based devices.
2828

29-
In this Learning Path we will demonstrate how to use KleidiCV-accelerated OpenCV in Android application.
29+
## A Performant Solution
30+
By combining OpenCV’s feature set, the hardware optimization from HAL, and specialized enhancements such as Arm’s KleidiCV, developers can build efficient, high-performing computer vision solutions tailored for modern mobile and embedded systems.
31+
32+
In this Learning Path, you will learn how you can use KleidiCV-accelerated OpenCV in an Android application.
3033

3134
You can find all the code used in this Learning Path in a [GitHub repository](https://github.com/dawidborycki/Arm64.KleidiCV.Demo.git).

content/learning-paths/mobile-graphics-and-gaming/android_opencv_kleidicv/create-project.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,39 @@ weight: 3
77
layout: "learningpathall"
88
---
99
## Create a project
10-
You will need a development computer with [Android Studio](https://developer.android.com/studio) installed (this examples uses Android Studio Ladybug | 2024.2.1 Patch 3)
10+
You will need a development computer with [Android Studio](https://developer.android.com/studio) installed. This example uses Android Studio Ladybug 2024.2.1, Patch 3.
1111

12-
Follow these steps to create a project and add OpenCV with KleidiCV support:
12+
You can create a project and add OpenCV with KleidiCV support by following the steps outlined in this section.
1313

14-
1. Open Android Studio on your development machine and then click the **+ New Project** icon:
15-
2. In the New Project window, select **Empty Views Activity**:
14+
Start by creating a new project, and configuring it:
1615

17-
![img1](Figures/01.png)
16+
1. Open Android Studio on your development machine, and click the **+ New Project** icon.
17+
2. In the **New Project** window, select **Empty Views Activity**:
1818

19-
3. Configure the project as follows (see figure below):
19+
![img1 alt-text#center](Figures/01.png "Figure 1: Creating a new project.")
20+
21+
3. Figure 2 shows you how to configure the project:
2022
- Name: **Arm64.KleidiCV.Demo**.
2123
- Package name: **com.arm.arm64kleidicvdemo**.
22-
- Save location: *Select relevant file location*.
24+
- Save location: *Select relevant file location for your setup*.
2325
- Language: **Kotlin**.
2426
- Minimum SDK: **API 24**.
2527
- Build configuration language: **Kotlin DSL**.
2628

27-
![img2](Figures/02.png)
29+
![img2 alt-text#center](Figures/02.png "Figure 2: Configuring your new project.")
2830

2931
4. Click the **Finish** button.
3032

31-
The project will be ready in a few moments. Afterward you can configure the project.
33+
Now wait a few moments until your project is ready. You will be able to configure the project further later on.
3234

3335
## Add OpenCV support
34-
To add OpenCV for Arm64, open the *build.gradle.ts (Module: app)*, and add the following line under the dependencies:
36+
To add OpenCV support for Arm64 (AArch64), open the *build.gradle.ts (Module: app)*, and add the following line under the dependencies:
3537

3638
```JSON
3739
implementation("org.opencv:opencv:4.11.0")
3840
```
3941

40-
Also, make sure that compileSdk is set to 35. The contents of the file should look something like this:
42+
Make sure that compileSdk is set to 35. The contents of the file should look like this:
4143

4244
```JSON
4345
plugins {
@@ -90,6 +92,8 @@ dependencies {
9092
}
9193
```
9294

93-
Then, click the **Sync Now** link in the top pane that appears. From here on, you can use OpenCV with KleidiCV support in your application.
95+
Now click the **Sync Now** link in the top pane that appears.
96+
97+
You can now use OpenCV with KleidiCV support in your application.
9498

9599
Save the file. In the next step, you will define the application UI.

0 commit comments

Comments
 (0)