nareshmlx/opencv-pr huggingface dataset:
**File:** modules/3d/src/rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,402 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "precomp.hpp"
+
+namespace cv {
+
+TriangleRasterizeSettings::TriangleRasterizeSettings()
```

Review comment:
``` col[i] = colors.empty() ? {0, 0, 0}: colors.at<Vec3f>(idx); ```
**File:** modules/3d/src/rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,402 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "precomp.hpp"
+
+namespace cv {
+
+TriangleRasterizeSettings::TriangleRasterizeSettings()
```

Review comment:
I propose to remove related code, if it's not ready.
**File:** modules/3d/include/opencv2/3d.hpp
**Change Type:** modified
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -2809,6 +2809,136 @@ CV_EXPORTS_W void loadMesh(const String &filename, OutputArray vertices, OutputA
 CV_EXPORTS_W void saveMesh(const String &filename, InputArray vertices, InputArrayOfArrays indices,
                            InputArray normals = noArray(), InputArray colors = noArray());
 
+
+//! Triangle fill settings
+enum TriangleShadingType
+{
+    RASTERIZE_SHADING_WHITE  = 0, //!< a white color is used for the whole triangle
+    RASTERIZE_SHADING_FLAT   = 1, //!< a color of 1st vertex of each triangle is used
```

Review comment:
It's easy for `K` but implementing distortion looks like a separate feature for a new PR
**File:** modules/3d/src/rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,402 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "precomp.hpp"
+
+namespace cv {
+
+TriangleRasterizeSettings::TriangleRasterizeSettings()
```

Review comment:
Input matrix can be 4x3 or 4x4; this way of initialization seems to be the most simple and universal
**File:** modules/3d/src/rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,402 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "precomp.hpp"
+
+namespace cv {
+
+TriangleRasterizeSettings::TriangleRasterizeSettings()
```

Review comment:
forgotten TODO, removed it
**File:** modules/3d/src/rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,402 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "precomp.hpp"
+
+namespace cv {
+
+TriangleRasterizeSettings::TriangleRasterizeSettings()
```

Review comment:
That second transposition is performed on 1xN matrix so it's almost free in terms of performance
**File:** modules/3d/include/opencv2/3d.hpp
**Change Type:** modified
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -2809,6 +2809,136 @@ CV_EXPORTS_W void loadMesh(const String &filename, OutputArray vertices, OutputA
 CV_EXPORTS_W void saveMesh(const String &filename, InputArray vertices, InputArrayOfArrays indices,
                            InputArray normals = noArray(), InputArray colors = noArray());
 
+
+//! Triangle fill settings
+enum TriangleShadingType
+{
+    RASTERIZE_SHADING_WHITE  = 0, //!< a white color is used for the whole triangle
+    RASTERIZE_SHADING_FLAT   = 1, //!< a color of 1st vertex of each triangle is used
```

Review comment:
RasterizeSettings => TriangleRasterizeSettings; RasterizeSettings is too generic name
**File:** modules/3d/include/opencv2/3d.hpp
**Change Type:** modified
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -2809,6 +2809,136 @@ CV_EXPORTS_W void loadMesh(const String &filename, OutputArray vertices, OutputA
 CV_EXPORTS_W void saveMesh(const String &filename, InputArray vertices, InputArrayOfArrays indices,
                            InputArray normals = noArray(), InputArray colors = noArray());
 
+
+//! Triangle fill settings
+enum TriangleShadingType
+{
+    RASTERIZE_SHADING_WHITE  = 0, //!< a white color is used for the whole triangle
+    RASTERIZE_SHADING_FLAT   = 1, //!< a color of 1st vertex of each triangle is used
```

Review comment:
ShadingType => TriangleShadingType? or make this enumeration nested to TriangleRasterizeSettings
**File:** modules/3d/include/opencv2/3d.hpp
**Change Type:** modified
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -2809,6 +2809,136 @@ CV_EXPORTS_W void loadMesh(const String &filename, OutputArray vertices, OutputA
 CV_EXPORTS_W void saveMesh(const String &filename, InputArray vertices, InputArrayOfArrays indices,
                            InputArray normals = noArray(), InputArray colors = noArray());
 
+
+//! Triangle fill settings
+enum TriangleShadingType
+{
+    RASTERIZE_SHADING_WHITE  = 0, //!< a white color is used for the whole triangle
+    RASTERIZE_SHADING_FLAT   = 1, //!< a color of 1st vertex of each triangle is used
```

Review comment:
CullingMode => TriangleCullingMode. Or put it inside TriangleRasterizeSettings
**File:** modules/3d/include/opencv2/3d.hpp
**Change Type:** modified
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -2809,6 +2809,136 @@ CV_EXPORTS_W void loadMesh(const String &filename, OutputArray vertices, OutputA
 CV_EXPORTS_W void saveMesh(const String &filename, InputArray vertices, InputArrayOfArrays indices,
                            InputArray normals = noArray(), InputArray colors = noArray());
 
+
+//! Triangle fill settings
+enum TriangleShadingType
+{
+    RASTERIZE_SHADING_WHITE  = 0, //!< a white color is used for the whole triangle
+    RASTERIZE_SHADING_FLAT   = 1, //!< a color of 1st vertex of each triangle is used
```

Review comment:
all of the drawing functions assume that the "canvas" is already allocated and initialized. This function creates depthbuf and colorbuf. Which is not quite convenient. Can we use InputOutputArray for both buffers? And then `width` and `height` are not needed.
**File:** modules/3d/include/opencv2/3d.hpp
**Change Type:** modified
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -2809,6 +2809,136 @@ CV_EXPORTS_W void loadMesh(const String &filename, OutputArray vertices, OutputA
 CV_EXPORTS_W void saveMesh(const String &filename, InputArray vertices, InputArrayOfArrays indices,
                            InputArray normals = noArray(), InputArray colors = noArray());
 
+
+//! Triangle fill settings
+enum TriangleShadingType
+{
+    RASTERIZE_SHADING_WHITE  = 0, //!< a white color is used for the whole triangle
+    RASTERIZE_SHADING_FLAT   = 1, //!< a color of 1st vertex of each triangle is used
```

Review comment:
My first attempt was to make this enum nested but it lead me to quite bulky code: ```cpp if (mode == TriangleRasterizeSettings::ShadingType::Flat || mode == TriangleRasterizeSettings::ShadingType::Shaded) ``` I think `TriangleShadingType` would look better. The same about `TriangleCullingMode` and `TriangleRasterizeSettings`.
**File:** modules/3d/include/opencv2/3d.hpp
**Change Type:** modified
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -2809,6 +2809,136 @@ CV_EXPORTS_W void loadMesh(const String &filename, OutputArray vertices, OutputA
 CV_EXPORTS_W void saveMesh(const String &filename, InputArray vertices, InputArrayOfArrays indices,
                            InputArray normals = noArray(), InputArray colors = noArray());
 
+
+//! Triangle fill settings
+enum TriangleShadingType
+{
+    RASTERIZE_SHADING_WHITE  = 0, //!< a white color is used for the whole triangle
+    RASTERIZE_SHADING_FLAT   = 1, //!< a color of 1st vertex of each triangle is used
```

Review comment:
1. `InputOutputArray` indeed fits better. 2. We can require a user to initialize RGB/Depth images before drawing into them. But if a user wants to use their own empty Depth buffer then it should be prefilled with `zFar` value - is it convenient?
**File:** modules/3d/include/opencv2/3d.hpp
**Change Type:** modified
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -2809,6 +2809,136 @@ CV_EXPORTS_W void loadMesh(const String &filename, OutputArray vertices, OutputA
 CV_EXPORTS_W void saveMesh(const String &filename, InputArray vertices, InputArrayOfArrays indices,
                            InputArray normals = noArray(), InputArray colors = noArray());
 
+
+//! Triangle fill settings
+enum TriangleShadingType
+{
+    RASTERIZE_SHADING_WHITE  = 0, //!< a white color is used for the whole triangle
+    RASTERIZE_SHADING_FLAT   = 1, //!< a color of 1st vertex of each triangle is used
```

Review comment:
Why do you need "setXXX" methods?
**File:** modules/3d/perf/perf_rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,344 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "perf_precomp.hpp"
+
+namespace opencv_test
+{
+
```

Review comment:
Please reduce line length and use common formatting.
**File:** modules/3d/perf/perf_rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,344 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "perf_precomp.hpp"
+
+namespace opencv_test
+{
+
```

Review comment:
Is it BGR intentionally?
**File:** modules/3d/src/rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,402 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "precomp.hpp"
+
+namespace cv {
+
+TriangleRasterizeSettings::TriangleRasterizeSettings()
```

Review comment:
.t() may happen twice.
**File:** modules/3d/include/opencv2/3d.hpp
**Change Type:** modified
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -2809,6 +2809,136 @@ CV_EXPORTS_W void loadMesh(const String &filename, OutputArray vertices, OutputA
 CV_EXPORTS_W void saveMesh(const String &filename, InputArray vertices, InputArrayOfArrays indices,
                            InputArray normals = noArray(), InputArray colors = noArray());
 
+
+//! Triangle fill settings
+enum TriangleShadingType
+{
+    RASTERIZE_SHADING_WHITE  = 0, //!< a white color is used for the whole triangle
+    RASTERIZE_SHADING_FLAT   = 1, //!< a color of 1st vertex of each triangle is used
```

Review comment:
Did it the same way as we've done it in `LevMarq::Settings` after a long discussion. This lets us pass settings in the same line with the function call: ```cpp triangleRasterize(vert, idx, col, pose, fov, zNear, zFar, TriangleRasterizeSettings().setShadingType(TriangleShadingType::Flat)); ```
**File:** modules/3d/src/rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,402 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "precomp.hpp"
+
+namespace cv {
+
+TriangleRasterizeSettings::TriangleRasterizeSettings()
```

Review comment:
Already [discussed](https://github.com/opencv/opencv/pull/24459#discussion_r1456037998): > That second transposition is performed on 1xN matrix so it's almost free in terms of performance Since it's not obvious, I'll add an explaining comment.
**File:** modules/3d/include/opencv2/3d.hpp
**Change Type:** modified
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -2809,6 +2809,136 @@ CV_EXPORTS_W void loadMesh(const String &filename, OutputArray vertices, OutputA
 CV_EXPORTS_W void saveMesh(const String &filename, InputArray vertices, InputArrayOfArrays indices,
                            InputArray normals = noArray(), InputArray colors = noArray());
 
+
+//! Triangle fill settings
+enum TriangleShadingType
+{
+    RASTERIZE_SHADING_WHITE  = 0, //!< a white color is used for the whole triangle
+    RASTERIZE_SHADING_FLAT   = 1, //!< a color of 1st vertex of each triangle is used
```

Review comment:
The renderer is colorspace-agnostic in fact, it just fills triangles with the values from `colors` array. I think this is the most convenient behaviour since it can be used to interpolate the data of arbitrary nature, e.g. coordinates or normals. * I will change the vertex color format in test to BGR to get rid of extra `cvtColor` calls after the render * For further compatibility purposes, I will add the formal limitation for colors to be in [0; 1]. The current code is working with any value range though.
**File:** modules/3d/perf/perf_rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,344 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "perf_precomp.hpp"
+
+namespace opencv_test
+{
+
```

Review comment:
See the comment [above](https://github.com/opencv/opencv/pull/24459#discussion_r1473650323)
**File:** modules/3d/src/rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,402 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "precomp.hpp"
+
+namespace cv {
+
+TriangleRasterizeSettings::TriangleRasterizeSettings()
```

Review comment:
> CV_EXPORTS Not needed in .cpp files.
**File:** samples/opengl/opengl_testdata_generator.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,460 @@
+#include <iostream>
+
+#ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN 1
+#define NOMINMAX 1
+#include <windows.h>
+#endif
+
+#if defined(__APPLE__)
```

Review comment:
We don't have license headers in samples.
**File:** modules/3d/include/opencv2/3d.hpp
**Change Type:** modified
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -2809,6 +2809,136 @@ CV_EXPORTS_W void loadMesh(const String &filename, OutputArray vertices, OutputA
 CV_EXPORTS_W void saveMesh(const String &filename, InputArray vertices, InputArrayOfArrays indices,
                            InputArray normals = noArray(), InputArray colors = noArray());
 
+
+//! Triangle fill settings
+enum TriangleShadingType
+{
+    RASTERIZE_SHADING_WHITE  = 0, //!< a white color is used for the whole triangle
+    RASTERIZE_SHADING_FLAT   = 1, //!< a color of 1st vertex of each triangle is used
```

Review comment:
constants names: - must be uppercase - must have prefix to avoid conflicts
**File:** modules/3d/include/opencv2/3d.hpp
**Change Type:** modified
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -2809,6 +2809,136 @@ CV_EXPORTS_W void loadMesh(const String &filename, OutputArray vertices, OutputA
 CV_EXPORTS_W void saveMesh(const String &filename, InputArray vertices, InputArrayOfArrays indices,
                            InputArray normals = noArray(), InputArray colors = noArray());
 
+
+//! Triangle fill settings
+enum TriangleShadingType
+{
+    RASTERIZE_SHADING_WHITE  = 0, //!< a white color is used for the whole triangle
+    RASTERIZE_SHADING_FLAT   = 1, //!< a color of 1st vertex of each triangle is used
```

Review comment:
> RasterizeSettings renamed --- parameter is optional, defaults are not described.
**File:** modules/3d/perf/perf_rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,344 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "perf_precomp.hpp"
+
+namespace opencv_test
+{
+
```

Review comment:
1. `stringstream` => `ostringstream` 2. `return ss.str();`
**File:** modules/3d/test/test_rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function
**Review Line:** 395

**Code Changes:**
```diff
+        }
+        break;
+
+        default:
+            CV_Error(Error::StsBadArg, "Unknown model type");
+            break;
+        }
+    }
+
+    Vec3d position;
+    Vec3d lookat;
```

Review comment:
raise error of unsupported cases?
**File:** modules/3d/test/test_rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,948 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "test_precomp.hpp"
+
+namespace opencv_test { namespace {
+using namespace cv;
+
```

Review comment:
Signature for `_EQ` is `ASSERT_EQ(expected_reference, actual_result);`. Correct order of parameters are required to emit valid error messages. Reference: https://github.com/opencv/opencv/blob/4.0.0/modules/ts/include/opencv2/ts/ts_gtest.h#L8196-L8200 ``` GTEST_API_ AssertionResult EqFailure(const char* expected_expression, const char* actual_expression, const std::string& expected_value, const std::string& actual_value, bool ignoring_case); ```
**File:** modules/3d/test/test_rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,948 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "test_precomp.hpp"
+
+namespace opencv_test { namespace {
+using namespace cv;
+
```

Review comment:
`norm(... NORM_INF)`
**File:** modules/3d/test/test_rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function

**Code Changes:**
```diff
@@ -0,0 +1,948 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "test_precomp.hpp"
+
+namespace opencv_test { namespace {
+using namespace cv;
+
```

Review comment:
`EXPECT_EQ(0, cv::norm(color_buf, NORM_INF));`
**File:** modules/3d/perf/perf_rendering.cpp
**Change Type:** added
**Context:** PR #24459: Triangle rasterization function
**Review Line:** 10

**Code Changes:**
```diff
+#include "perf_precomp.hpp"
+
+namespace opencv_test
+{
+
+// that was easier than using CV_ENUM() macro
+namespace
+{
+using namespace cv;
+struct ShadingTypeEnum
+{
```

Review comment:
When talking about `enum class` this is 100% true. For ordinary enum our macro is more convenient but even though: * it doesn't have an operator to convert to the original enum type, just to int, which leads to compile errors * it generates bulky names with prefixes and so on * it does not protect you from listing several values with the same corresponding int value I think we need a better enum macro. But until we have one, I'd better use my workaround.
**File:** modules/gapi/src/backends/ov/govbackend.cpp
**Change Type:** modified
**Context:** PR #24704: Fixed support of mean/scale preprocessing in OV backend for non-real types
**Review Line:** 809

**Code Changes:**
```diff
+        if (mean_vec || scale_vec) {
+            GAPI_Assert(cv::util::holds_alternative<cv::GMatDesc>(input_meta));
+            const auto depth = cv::util::get<cv::GMatDesc>(input_meta).depth;
+            const bool depth_is_real = (depth == CV_32F) || (depth == CV_16F);
+            if (!depth_is_real) {
+                input_info.preprocess().convert_element_type(toOV(CV_32F));
+            }
+        }
         if (mean_vec) {
             input_info.preprocess().mean(*mean_vec);
         }
```

Review comment:
Could you put a comment why do we need this? Having LOG_DEBUG would be also great
**File:** platforms/android/build-tests/test_gradle.sh
**Change Type:** modified
**Context:** PR #24956: Added offline option for Android builds
**Review Line:** 38

**Code Changes:**
```diff
 echo "Android SDK: ${ANDROID_HOME}"
 echo "Android NDK: ${ANDROID_NDK}"
@@ -35,7 +36,7 @@ echo "ndk.dir=${ANDROID_NDK}" > "test-gradle/samples/local.properties"
 echo "cmake.dir=$(dirname $(dirname $(which cmake)))" >> "test-gradle/samples/local.properties"
 
 echo "Run gradle ..."
-(cd "test-gradle/samples"; ./gradlew -i assemble)
+(cd "test-gradle/samples"; ./gradlew ${OPENCV_GRADLE_VERBOSE_OPTIONS} assemble)
 
 echo "#"
 echo "# Done!"
```

Review comment:
It is better to use dedicated variable for debugging and do not break clean user builds: https://github.com/opencv/opencv/blob/4.9.0/cmake/android/android_gradle_projects.cmake#L185
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added
**Review Line:** 102

**Code Changes:**
```diff
+  ocv_update(ANDROID_GRADLE_BUILD_FEATURE_AIDL "buildFeatures { aidl true }")
+else()
+  ocv_update(ANDROID_GRADLE_JAVA_VERSION_INIT "1_8")
+  ocv_update(ANDROID_GRADLE_BUILD_FEATURE_AIDL "")
+endif()
+
+set(ANDROID_GRADLE_JAVA_VERSION "${ANDROID_GRADLE_JAVA_VERSION_INIT}" CACHE STRING "Android Gradle Java version")
+message(STATUS "Android Gradle Java version: ${ANDROID_GRADLE_JAVA_VERSION}")
+
 # force reusing of the same CMake version
 if(NOT OPENCV_SKIP_ANDROID_FORCE_CMAKE)
```

Review comment:
No need extra space here.
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added
**Review Line:** 102

**Code Changes:**
```diff
+  ocv_update(ANDROID_GRADLE_BUILD_FEATURE_AIDL "buildFeatures { aidl true }")
+else()
+  ocv_update(ANDROID_GRADLE_JAVA_VERSION_INIT "1_8")
+  ocv_update(ANDROID_GRADLE_BUILD_FEATURE_AIDL "")
+endif()
+
+set(ANDROID_GRADLE_JAVA_VERSION "${ANDROID_GRADLE_JAVA_VERSION_INIT}" CACHE STRING "Android Gradle Java version")
+message(STATUS "Android Gradle Java version: ${ANDROID_GRADLE_JAVA_VERSION}")
+
 # force reusing of the same CMake version
 if(NOT OPENCV_SKIP_ANDROID_FORCE_CMAKE)
```

Review comment:
I removed it.