From 4455a398c022197277d637f0c1266e0d762c2139 Mon Sep 17 00:00:00 2001 From: Mark Horvath Date: Fri, 14 Mar 2025 13:39:07 +0000 Subject: [PATCH] Add official builds and bit-exactness to opencv.md OpenCV conformity tests are also updated, as KleidiCV's remap implementation is bit-exact with OpenCV, if map1.type() is CV_16SC2 and map2 is empty. --- conformity/opencv/test_remap.cpp | 4 ++-- doc/opencv.md | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/conformity/opencv/test_remap.cpp b/conformity/opencv/test_remap.cpp index 54e5de999..cd8af7ddc 100644 --- a/conformity/opencv/test_remap.cpp +++ b/conformity/opencv/test_remap.cpp @@ -70,9 +70,9 @@ bool test_remap_s16(int index, RecreatedMessageQueue& request_queue, bool success = (CV_MAT_DEPTH(Format) == CV_8U && - !are_matrices_different(1, actual_mat, expected_mat)) || + !are_matrices_different(0, actual_mat, expected_mat)) || (CV_MAT_DEPTH(Format) == CV_16U && - !are_matrices_different(1, actual_mat, expected_mat)); + !are_matrices_different(0, actual_mat, expected_mat)); if (!success) { fail_print_matrices(w, h, source_mat, actual_mat, expected_mat); return true; diff --git a/doc/opencv.md b/doc/opencv.md index 5195dac27..146d5162e 100644 --- a/doc/opencv.md +++ b/doc/opencv.md @@ -10,6 +10,14 @@ SPDX-License-Identifier: Apache-2.0 acceleration via KleidiCV's OpenCV Hardware Acceleration Layer (HAL). For details of building OpenCV with KleidiCV see [the build documentation](build.md). +In addition, KleidiCV is enabled in certain official OpenCV builds. For example, +the [OpenCV 4.11 maven package](https://mvnrepository.com/artifact/org.opencv/opencv/4.11.0) +contains KleidiCV accelerations already, and it can be easily used in Android +applications. (See this [learning path](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/android_opencv_kleidicv/) +for more information.) Please check OpenCV's documentation, change log or build +configuration whether KleidiCV is enabled in a given OpenCV version for a given +platform, and which version of KleidiCV is integrated. + ## Functionality in KleidiCV OpenCV HAL ### [`cv::add()`](https://docs.opencv.org/4.10.0/d2/de8/group__core__array.html#ga10ac1bfb180e2cfda1701d06c24fdbd6), [`cv::subtract()`](https://docs.opencv.org/4.10.0/d2/de8/group__core__array.html#gaa0f00d98b4b5edeaeb7b8333b2de353b), [`cv::absdiff()`](https://docs.opencv.org/4.10.0/d2/de8/group__core__array.html#ga6fef31bc8c4071cbc114a758a2b79c14) @@ -91,6 +99,8 @@ Notes on parameters: * `src.channels()` - supports 3 for RGB/BGR and 4 for RGBA/BGRA. ### [`cv::GaussianBlur()`](https://docs.opencv.org/4.11.0/d4/d86/group__imgproc__filter.html#gae8bdcd9154ed5ca3cbc1766d960f45c1) +> ⚠️ **The operation is not bitexact with OpenCV due to rounding differences even if ALGO_HINT_ACCURATE is used as the hint parameter.** + Blurs an image using a Gaussian filter.\ The filter's standard deviation must be the same in horizontal and vertical directions (`sigmaX == sigmaY`).\ In-place filtering is not supported i.e. `src` and `dst` must be different (non-overlapping) images. @@ -120,6 +130,8 @@ Notes on parameters: * `borderType` - only supports [`BORDER_CONSTANT`](https://docs.opencv.org/4.10.0/d2/de8/group__core__array.html#gga209f2f4869e304c82d07739337eae7c5aed2e4346047e265c8c5a6d0276dcd838). ### [`cv::resize()`](https://docs.opencv.org/4.10.0/da/d54/group__imgproc__transform.html#ga47a974309e9102f5f08231edc7e7529d) +> ⚠️ **The operation is not bitexact with OpenCV due to rounding differences.** + Notes on parameters: * `src.type()` - only supports certain values in combination with other parameters as shown in the table below. * `dst.cols`,`dst.rows` - must be a multiple of `src.cols` and `src.rows` respectively, in combination with other parameters as shown in the table below. @@ -175,6 +187,8 @@ Notes on parameters: ### [`cv::Mat::convertTo()`](https://docs.opencv.org/4.10.0/d3/d63/classcv_1_1Mat.html#adf88c60c5b4980e05bb556080916978b) > ⚠️ **Acceleration will not work unless OpenCV is built from source patched with `opencv-4.11.patch`** +> ⚠️ **The operation is not bitexact with OpenCV due to rounding differences.** + If the `rtype` parameter is `-1` or the same as the input depth, scale and offset values using `alpha` and `beta`. Supported depths: + `CV_8U` @@ -190,6 +204,8 @@ Otherwise, if `alpha` and `beta` are 1 and 0 respectively, conversion between da | `CV_8U` | `CV_32F` | ### [`cv::exp()`](https://docs.opencv.org/4.10.0/d2/de8/group__core__array.html#ga3e10108e2162c338f1b848af619f39e5) +> ⚠️ **The operation is not bitexact with OpenCV as OpenCV is using a less precise algorithm.** + Exponential function. Currently only `CV_32F` type is supported. ### [`cv::inRange()`](https://docs.opencv.org/4.10.0/d2/de8/group__core__array.html#ga48af0ab51e36436c5d04340e036ce981) @@ -222,13 +238,17 @@ Supported map configurations: * supported `interpolation`: `INTER_NEAREST` only * `map1.type()` is `CV_16SC2` and `map2.type()` is `CV_16UC1` - fixed-point representation as generated by [`cv::convertMaps`](https://docs.opencv.org/4.11.0/da/d54/group__imgproc__transform.html#ga9156732fa8f01be9ebd1a194f2728b7f): * > ⚠️ **Acceleration will not work unless OpenCV is built from source patched with `opencv-4.11.patch`** + * > ⚠️ **The operation is not bitexact with OpenCV due to rounding differences.** * supported `interpolation`: `INTER_LINEAR` only * `map1` is 32FC1 and `map2` is 32FC1: + * > ⚠️ **The operation is not bitexact with OpenCV as OpenCV is using a less precise algorithm.** * `map1` is x coordinates (column) * `map2` is y coordinates (row) * supported `interpolation`: `INTER_NEAREST` and `INTER_LINEAR` ### [`cv::warpPerspective()`](https://docs.opencv.org/4.10.0/da/d54/group__imgproc__transform.html#gaf73673a7e8e18ec6963e3774e6a94b87) +> ⚠️ **The operation is not bitexact with OpenCV due to rounding differences.** + Performs a perspective transformation on an image. Notes on parameters: -- GitLab