nareshmlx/opencv-pr huggingface dataset:
**File:** modules/dnn/src/onnx/onnx_graph_simplifier.cpp
**Change Type:** modified
**Context:** PR #23853: dnn: disable warning when loading a fp16 model

**Code Changes:**
```diff
@@ -1125,7 +1125,7 @@ Mat getMatFromTensor(const opencv_onnx::TensorProto& tensor_proto)
     else if (datatype == opencv_onnx::TensorProto_DataType_FLOAT16)
     {
         // FIXME, for now, we only load FP16 Tensor as FP32 Mat, full support for FP16 is required in the future.
-        CV_LOG_ONCE_WARNING(NULL, "DNN: load FP16 model as FP32 model, and it takes twice the FP16 RAM requirement.");
+        CV_LOG_ONCE_INFO(NULL, "DNN: load FP16 model as FP32 model, and it takes twice the FP16 RAM requirement.");
 
         // ONNX saves float 16 data in two format: int32 and raw_data.
         // Link: https://github.com/onnx/onnx/issues/4460#issuecomment-1224373746
```

Review comment:
BTW, > `ONCE` It should not be critical. What is about `CV_LOG_ONCE_INFO` ?
**File:** modules/dnn/src/onnx/onnx_graph_simplifier.cpp
**Change Type:** modified
**Context:** PR #23853: dnn: disable warning when loading a fp16 model

**Code Changes:**
```diff
@@ -1125,7 +1125,7 @@ Mat getMatFromTensor(const opencv_onnx::TensorProto& tensor_proto)
     else if (datatype == opencv_onnx::TensorProto_DataType_FLOAT16)
     {
         // FIXME, for now, we only load FP16 Tensor as FP32 Mat, full support for FP16 is required in the future.
-        CV_LOG_ONCE_WARNING(NULL, "DNN: load FP16 model as FP32 model, and it takes twice the FP16 RAM requirement.");
+        CV_LOG_ONCE_INFO(NULL, "DNN: load FP16 model as FP32 model, and it takes twice the FP16 RAM requirement.");
 
         // ONNX saves float 16 data in two format: int32 and raw_data.
         // Link: https://github.com/onnx/onnx/issues/4460#issuecomment-1224373746
```

Review comment:
I replaced it with INFO.
**File:** .github/ISSUE_TEMPLATE/config.yml
**Change Type:** added
**Context:** PR #22560: Enable issue template chooser

**Code Changes:**
```diff
@@ -0,0 +1,5 @@
+blank_issues_enabled: true
+contact_links:
+  - name: Questions
+    url: https://forum.opencv.org/
+    about: Ask questions and discuss with OpenCV community members
```

Review comment:
https://forum.opencv.org/ :)
**File:** .github/ISSUE_TEMPLATE/bug_report.yml
**Change Type:** added
**Context:** PR #22560: Enable issue template chooser

**Code Changes:**
```diff
@@ -0,0 +1,64 @@
+name: Bug Report
+description: Create a report to help us reproduce and fix the bug
+labels: ["bug"]
+
+body:
+- type: markdown
+  attributes:
+    value: >
+      #### Thank you for contributing! Before reporting a bug, please have a look at the [FAQ](https://github.com/opencv/opencv/wiki/FAQ), make sure the issue has no duplicate and hasn't been already addressed by searching through [the existing and past issues](https://github.com/opencv/opencv/issues?page=1&q=is%3Aissue+sort%3Acreated-desc).
```

Review comment:
The line is too long.
**File:** .github/ISSUE_TEMPLATE/bug_report.yml
**Change Type:** added
**Context:** PR #22560: Enable issue template chooser

**Code Changes:**
```diff
@@ -0,0 +1,64 @@
+name: Bug Report
+description: Create a report to help us reproduce and fix the bug
+labels: ["bug"]
+
+body:
+- type: markdown
+  attributes:
+    value: >
+      #### Thank you for contributing! Before reporting a bug, please have a look at the [FAQ](https://github.com/opencv/opencv/wiki/FAQ), make sure the issue has no duplicate and hasn't been already addressed by searching through [the existing and past issues](https://github.com/opencv/opencv/issues?page=1&q=is%3Aissue+sort%3Acreated-desc).
```

Review comment:
Most probably it's formatting issue.
**File:** .github/ISSUE_TEMPLATE/bug_report.yml
**Change Type:** added
**Context:** PR #22560: Enable issue template chooser

**Code Changes:**
```diff
@@ -0,0 +1,64 @@
+name: Bug Report
+description: Create a report to help us reproduce and fix the bug
+labels: ["bug"]
+
+body:
+- type: markdown
+  attributes:
+    value: >
+      #### Thank you for contributing! Before reporting a bug, please have a look at the [FAQ](https://github.com/opencv/opencv/wiki/FAQ), make sure the issue has no duplicate and hasn't been already addressed by searching through [the existing and past issues](https://github.com/opencv/opencv/issues?page=1&q=is%3Aissue+sort%3Acreated-desc).
```

Review comment:
I propose to add link to FAQ at least.
**File:** .github/ISSUE_TEMPLATE/bug_report.yml
**Change Type:** added
**Context:** PR #22560: Enable issue template chooser

**Code Changes:**
```diff
@@ -0,0 +1,64 @@
+name: Bug Report
+description: Create a report to help us reproduce and fix the bug
+labels: ["bug"]
+
+body:
+- type: markdown
+  attributes:
+    value: >
+      #### Thank you for contributing! Before reporting a bug, please have a look at the [FAQ](https://github.com/opencv/opencv/wiki/FAQ), make sure the issue has no duplicate and hasn't been already addressed by searching through [the existing and past issues](https://github.com/opencv/opencv/issues?page=1&q=is%3Aissue+sort%3Acreated-desc).
```

Review comment:
just updated, please have a look: https://github.com/fengyuentau/opencv/issues/new?assignees=&labels=&template=bug_report.yml
**File:** .github/ISSUE_TEMPLATE/bug_report.yml
**Change Type:** added
**Context:** PR #22560: Enable issue template chooser

**Code Changes:**
```diff
@@ -0,0 +1,64 @@
+name: Bug Report
+description: Create a report to help us reproduce and fix the bug
+labels: ["bug"]
+
+body:
+- type: markdown
+  attributes:
+    value: >
+      #### Thank you for contributing! Before reporting a bug, please have a look at the [FAQ](https://github.com/opencv/opencv/wiki/FAQ), make sure the issue has no duplicate and hasn't been already addressed by searching through [the existing and past issues](https://github.com/opencv/opencv/issues?page=1&q=is%3Aissue+sort%3Acreated-desc).
```

Review comment:
added a prompt for formatting.
**File:** .github/ISSUE_TEMPLATE/bug_report.yml
**Change Type:** added
**Context:** PR #22560: Enable issue template chooser
**Review Line:** 61

**Code Changes:**
```diff
+- type: checkboxes
+  attributes:
+    label: Issue submission checklist
+    options:
+      - label: I report the issue, it's not a question
+        required: true
+      - label: I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
+      - label: I updated to the latest OpenCV version and the issue is still there
+      - label: There is reproducer code and related data files (videos, images, onnx, etc)
```

Review comment:
Perhaps it would be better not to make all check boxes "required", because some issues do not have reproducer code or related data file or reporter does not have ability to check if the problem exists in the latest OpenCV release, etc. We make people "lie" by demanding checking all boxes to file an issue :smiley: Alternatively some statements can be rephrased, e.g. "I've attached a reproducer or this statement is not applicable"
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #23654: DNN: add the Winograd fp16 support
**Review Line:** 1462

**Code Changes:**
```diff
@@ -1458,6 +1458,9 @@ CV__DNN_INLINE_NS_BEGIN
          /// @sa Net::setPreferableTarget
          CV_WRAP Model& setPreferableTarget(dnn::Target targetId);
 
+         /// @sa Net::enableWinograd
+         CV_WRAP Model& enableWinograd(bool useWinograd);
+
          CV_DEPRECATED_EXTERNAL
          operator Net&() const { return getNetwork_(); }
 
```

Review comment:
Add a new function for `dnn::Model`, this will fail at default CI API check.
**File:** cmake/checks/cpu_fp16.cpp
**Change Type:** modified
**Context:** PR #23654: DNN: add the Winograd fp16 support

**Code Changes:**
```diff
@@ -15,12 +15,12 @@ int test()
 #include "arm_neon.h"
 int test()
 {
-    const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
-    short dst[8];
-    float32x4_t v_src = *(float32x4_t*)src;
+    const float src[] = { 0.0f, 1.0f, 2.0f, 3.0f };
+    short dst[4];
+    float32x4_t v_src = vld1q_f32(src);
```

Review comment:
Do we really should just pass compilation check in that case here?
**File:** cmake/checks/cpu_fp16.cpp
**Change Type:** modified
**Context:** PR #23654: DNN: add the Winograd fp16 support

**Code Changes:**
```diff
@@ -15,12 +15,12 @@ int test()
 #include "arm_neon.h"
 int test()
 {
-    const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
-    short dst[8];
-    float32x4_t v_src = *(float32x4_t*)src;
+    const float src[] = { 0.0f, 1.0f, 2.0f, 3.0f };
+    short dst[4];
+    float32x4_t v_src = vld1q_f32(src);
```

Review comment:
I'm not very familiar with compiling. The `vfmaq_laneq_f16` can only be used when `__ARM_FEATURE_FP16_VECTOR_ARITHMETIC` is defined. The idea is to set the `CV_FP16` only when `vfmaq_laneq_f16` is usable on ARM platform. What's your opinion on this part code?
**File:** cmake/checks/cpu_fp16.cpp
**Change Type:** modified
**Context:** PR #23654: DNN: add the Winograd fp16 support

**Code Changes:**
```diff
@@ -15,12 +15,12 @@ int test()
 #include "arm_neon.h"
 int test()
 {
-    const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
-    short dst[8];
-    float32x4_t v_src = *(float32x4_t*)src;
+    const float src[] = { 0.0f, 1.0f, 2.0f, 3.0f };
+    short dst[4];
+    float32x4_t v_src = vld1q_f32(src);
```

Review comment:
It is a compilation check (check of compiler features and compiler flags). If compiler is old and doesn't provide `__ARM_FEATURE_FP16_VECTOR_ARITHMETIC` but provide "basic" FP16 support then this check should pass. Currently it doesn't try to compile any FP16 code (just `return 0`). Finally it would fail during compilation of OpenCV code if there is no `__ARM_FEATURE_FP16_VECTOR_ARITHMETIC`. According to `haveFP16_ARM()`, perhaps we need a new `FP16_ARMv82` compiler feature with separate `cmake/checks/cpu_fp16_armv82.cpp` besides of `NEON` and `FP16`. At least it should include definition check in a reverse form: ``` #ifndef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC #error "__ARM_FEATURE_FP16_VECTOR_ARITHMETIC must be defined" #endif ``` Not sure if we need runtime check for that feature at all (`haveFP16_ARM()`). Anyway runtime checks of CPU features should be performed in system.cpp/HWFeatures (but without direct usage of compiler instructions). Also such detection could be skipped (assumed that baseline is always available) - similar to `CV_FP16`: ``` #if CV_FP16 CV_LOG_INFO(NULL, "- FP16 instructions is enabled via build flags"); have[CV_CPU_FP16] = true; ``` `system.cpp` doesn't support `longjmp()` approach for proper detection (as there is baseline compiler flags only).
**File:** cmake/checks/cpu_fp16.cpp
**Change Type:** modified
**Context:** PR #23654: DNN: add the Winograd fp16 support

**Code Changes:**
```diff
@@ -15,12 +15,12 @@ int test()
 #include "arm_neon.h"
 int test()
 {
-    const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
-    short dst[8];
-    float32x4_t v_src = *(float32x4_t*)src;
+    const float src[] = { 0.0f, 1.0f, 2.0f, 3.0f };
+    short dst[4];
+    float32x4_t v_src = vld1q_f32(src);
```

Review comment:
> perhaps we need a new FP16_ARMv82 compiler feature with separate cmake/checks/cpu_fp16_armv82.cpp besides of NEON and FP16. I agree with this. But I don't have much time to spend on it recently. I think this patch will have no harm since the `CV_FP16` macro is not used before this patch. How about leaving this into the future to optimize? > Not sure if we need runtime check for that feature at all (haveFP16_ARM()). The runtime check is supplied for opencv binary. Compiler opencv arm binary once, and run every arm chip. BTW, I found a flag maybe useful, `CV_TRY_NEON_DOTPROD`. It was defined by following: ``` ocv_update(CPU_NEON_DOTPROD_FLAGS_ON "-march=armv8.2-a+dotprod") ```
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24364: Bugfix/qrcode version estimator

**Code Changes:**
```diff
@@ -196,17 +196,18 @@ class QRCodeEncoderImpl : public QRCodeEncoder
     uint8_t total_num;
     vector<Mat> final_qrcodes;
 
-    Ptr<VersionInfo> version_info;
-    Ptr<BlockParams> cur_ecc_params;
+    const VersionInfo* version_info;
+    const BlockParams* cur_ecc_params;
 
-    bool isNumeric(const std::string& input);
```

Review comment:
`version_capacity_database[MAX_VERSION]`
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24364: Bugfix/qrcode version estimator

**Code Changes:**
```diff
@@ -196,17 +196,18 @@ class QRCodeEncoderImpl : public QRCodeEncoder
     uint8_t total_num;
     vector<Mat> final_qrcodes;
 
-    Ptr<VersionInfo> version_info;
-    Ptr<BlockParams> cur_ecc_params;
+    const VersionInfo* version_info;
+    const BlockParams* cur_ecc_params;
 
-    bool isNumeric(const std::string& input);
```

Review comment:
Unsafe access to array may occur in case of `-1`. Please do switch by mode.
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24364: Bugfix/qrcode version estimator

**Code Changes:**
```diff
@@ -196,17 +196,18 @@ class QRCodeEncoderImpl : public QRCodeEncoder
     uint8_t total_num;
     vector<Mat> final_qrcodes;
 
-    Ptr<VersionInfo> version_info;
-    Ptr<BlockParams> cur_ecc_params;
+    const VersionInfo* version_info;
+    const BlockParams* cur_ecc_params;
 
-    bool isNumeric(const std::string& input);
```

Review comment:
Use `MAX_VERSION` from https://github.com/opencv/opencv/blob/c2f909fc86cae0e44ccd9a27dd52578682920f29/modules/objdetect/src/qrcode_encoder_table.inl.hpp#L14
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24364: Bugfix/qrcode version estimator
**Review Line:** 707

**Code Changes:**
```diff
+    if (mode != nullptr)
+    {
+        *mode = selected_mode;
+    }
+
     return true;
 }
 
```

Review comment:
There is no option for this method to return `false`
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24364: Bugfix/qrcode version estimator
**Review Line:** 319

**Code Changes:**
```diff
+    if (version < MAX_VERSION)
     {
-        possible_version.push_back(3);
+        possible_version.push_back(version + 1);
     }
+
     return true;
 }
 
 int QRCodeEncoderImpl::versionAuto(const std::string& input_str)
 {
```

Review comment:
Two similar if statements `if (version < MAX_VERSION)`
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24364: Bugfix/qrcode version estimator

**Code Changes:**
```diff
@@ -196,17 +196,18 @@ class QRCodeEncoderImpl : public QRCodeEncoder
     uint8_t total_num;
     vector<Mat> final_qrcodes;
 
-    Ptr<VersionInfo> version_info;
-    Ptr<BlockParams> cur_ecc_params;
+    const VersionInfo* version_info;
+    const BlockParams* cur_ecc_params;
 
-    bool isNumeric(const std::string& input);
```

Review comment:
I see that several functions depend on a weak condition from `findVersionCapacity`: ```cpp for (int i = version_begin; i < version_end; i++) ``` Thus we collect some versions in array but have to keep an extra value for upper limit. Can you please reimplement this to something more obvious? Just collect the versions in a vector and iterate over it: ``` int QRCodeEncoderImpl::findVersionCapacity(const int input_length, const int ecc, const std::vector<int>& versions) { ... for (int version : versions) { ... } ```
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24364: Bugfix/qrcode version estimator

**Code Changes:**
```diff
@@ -196,17 +196,18 @@ class QRCodeEncoderImpl : public QRCodeEncoder
     uint8_t total_num;
     vector<Mat> final_qrcodes;
 
-    Ptr<VersionInfo> version_info;
-    Ptr<BlockParams> cur_ecc_params;
+    const VersionInfo* version_info;
+    const BlockParams* cur_ecc_params;
 
-    bool isNumeric(const std::string& input);
```

Review comment:
Ptr is redundant here. The loop body does not own database items. You can use raw pointer here.
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24364: Bugfix/qrcode version estimator

**Code Changes:**
```diff
@@ -196,17 +196,18 @@ class QRCodeEncoderImpl : public QRCodeEncoder
     uint8_t total_num;
     vector<Mat> final_qrcodes;
 
-    Ptr<VersionInfo> version_info;
-    Ptr<BlockParams> cur_ecc_params;
+    const VersionInfo* version_info;
+    const BlockParams* cur_ecc_params;
 
-    bool isNumeric(const std::string& input);
```

Review comment:
No need to use Ptr here.
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24364: Bugfix/qrcode version estimator
**Review Line:** 319

**Code Changes:**
```diff
+    if (version < MAX_VERSION)
     {
-        possible_version.push_back(3);
+        possible_version.push_back(version + 1);
     }
+
     return true;
 }
 
 int QRCodeEncoderImpl::versionAuto(const std::string& input_str)
 {
```

Review comment:
Why do not push all versions between `version` and `MAX_VERSION`?
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24364: Bugfix/qrcode version estimator

**Code Changes:**
```diff
@@ -196,17 +196,18 @@ class QRCodeEncoderImpl : public QRCodeEncoder
     uint8_t total_num;
     vector<Mat> final_qrcodes;
 
-    Ptr<VersionInfo> version_info;
-    Ptr<BlockParams> cur_ecc_params;
+    const VersionInfo* version_info;
+    const BlockParams* cur_ecc_params;
 
-    bool isNumeric(const std::string& input);
```

Review comment:
Sure, replaced
**File:** modules/gapi/src/backends/onnx/dml_ep.cpp
**Change Type:** modified
**Context:** PR #24060: G-API: Advanced device selection for ONNX DirectML Execution Provider

**Code Changes:**
```diff
@@ -13,13 +13,240 @@
 #ifdef HAVE_ONNX_DML
 #include "../providers/dml/dml_provider_factory.h"
 
+#ifdef HAVE_DIRECTML
+
+#undef WINVER
+#define WINVER 0x0A00
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0A00
```

Review comment:
Well, probably should be more descriptive
**File:** modules/gapi/src/backends/onnx/dml_ep.cpp
**Change Type:** modified
**Context:** PR #24060: G-API: Advanced device selection for ONNX DirectML Execution Provider
**Review Line:** 19

**Code Changes:**
```diff
 #include "../providers/dml/dml_provider_factory.h"
 
+#ifdef HAVE_DIRECTML
+
+#undef WINVER
+#define WINVER 0x0A00
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0A00
+
+#include <initguid.h>
+
```

Review comment:
OpenCV defines `Windows 7` there: https://github.com/opencv/opencv/blob/4.x/cmake/OpenCVCompilerOptions.cmake#L477-L478
**File:** modules/gapi/src/backends/onnx/dml_ep.cpp
**Change Type:** modified
**Context:** PR #24060: G-API: Advanced device selection for ONNX DirectML Execution Provider
**Review Line:** 19

**Code Changes:**
```diff
 #include "../providers/dml/dml_provider_factory.h"
 
+#ifdef HAVE_DIRECTML
+
+#undef WINVER
+#define WINVER 0x0A00
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0A00
+
+#include <initguid.h>
+
```

Review comment:
But `DXCore` minimum required version is `Windows 10`: Taken from system header: `<dxcore.h>` ![image](https://github.com/opencv/opencv/assets/22346834/f9c9d793-5cb6-4347-8d57-8f250f18983a)
**File:** modules/gapi/src/backends/onnx/dml_ep.cpp
**Change Type:** modified
**Context:** PR #24060: G-API: Advanced device selection for ONNX DirectML Execution Provider

**Code Changes:**
```diff
@@ -13,13 +13,240 @@
 #ifdef HAVE_ONNX_DML
 #include "../providers/dml/dml_provider_factory.h"
 
+#ifdef HAVE_DIRECTML
+
+#undef WINVER
+#define WINVER 0x0A00
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0A00
```

Review comment:
Should be properly deinitialized
**File:** modules/gapi/CMakeLists.txt
**Change Type:** modified
**Context:** PR #24060: G-API: Advanced device selection for ONNX DirectML Execution Provider

**Code Changes:**
```diff
@@ -364,6 +364,10 @@ if(WIN32)
   ocv_target_link_libraries(${the_module} PRIVATE wsock32 ws2_32)
 endif()
 
+if(HAVE_DIRECTML)
+  ocv_target_compile_definitions(${the_module} PRIVATE HAVE_DIRECTML=1)
+endif()
+
 if(HAVE_ONNX)
   ocv_target_link_libraries(${the_module} PRIVATE ${ONNX_LIBRARY})
```

Review comment:
Yes, we need to have something like `OpenCVDetectDirectML.cmake`
**File:** modules/gapi/src/backends/onnx/dml_ep.cpp
**Change Type:** modified
**Context:** PR #24060: G-API: Advanced device selection for ONNX DirectML Execution Provider
**Review Line:** 238

**Code Changes:**
```diff
+        std::stringstream error_msg;
+        error_msg << "ONNX Backend: No DirectML adapters found match to \"" << adapter_name << "\"";
+        cv::util::throw_error(std::runtime_error(error_msg.str()));
+    } else if (selected_adapters.size() > 1) {
+        std::stringstream error_msg;
+        error_msg << "ONNX Backend: More than one adapter matches to \"" << adapter_name << "\":\n";
+        for (const auto &selected_adapter : selected_adapters) {
+            error_msg << selected_adapter.description << "\n";
+        }
+        cv::util::throw_error(std::runtime_error(error_msg.str()));
+    }
```

Review comment:
How is that possible?
**File:** modules/gapi/src/backends/onnx/dml_ep.cpp
**Change Type:** modified
**Context:** PR #24060: G-API: Advanced device selection for ONNX DirectML Execution Provider
**Review Line:** 238

**Code Changes:**
```diff
+        std::stringstream error_msg;
+        error_msg << "ONNX Backend: No DirectML adapters found match to \"" << adapter_name << "\"";
+        cv::util::throw_error(std::runtime_error(error_msg.str()));
+    } else if (selected_adapters.size() > 1) {
+        std::stringstream error_msg;
+        error_msg << "ONNX Backend: More than one adapter matches to \"" << adapter_name << "\":\n";
+        for (const auto &selected_adapter : selected_adapters) {
+            error_msg << selected_adapter.description << "\n";
+        }
+        cv::util::throw_error(std::runtime_error(error_msg.str()));
+    }
```

Review comment:
Let's say user has 2 GPU devices with names "GPU: 0" and "GPU: 1" if they provide "GPU" as the `adapter name` there will be exception. Perhaps we may select the first matched adapter not to annoy user.
**File:** modules/gapi/src/backends/onnx/dml_ep.cpp
**Change Type:** modified
**Context:** PR #24060: G-API: Advanced device selection for ONNX DirectML Execution Provider

**Code Changes:**
```diff
@@ -13,13 +13,240 @@
 #ifdef HAVE_ONNX_DML
 #include "../providers/dml/dml_provider_factory.h"
 
+#ifdef HAVE_DIRECTML
+
+#undef WINVER
+#define WINVER 0x0A00
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0A00
```

Review comment:
Done, implemented `OpenCVDetectDirectML.cmake` to figure out if all necessary libs for `directml` exist.
**File:** modules/gapi/src/backends/onnx/dml_ep.cpp
**Change Type:** modified
**Context:** PR #24060: G-API: Advanced device selection for ONNX DirectML Execution Provider
**Review Line:** 19

**Code Changes:**
```diff
 #include "../providers/dml/dml_provider_factory.h"
 
+#ifdef HAVE_DIRECTML
+
+#undef WINVER
+#define WINVER 0x0A00
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0A00
+
+#include <initguid.h>
+
```

Review comment:
1. I propose to set `WINVER` globally in CMake. 2. Cmake should print this during configuration.
**File:** modules/gapi/src/backends/onnx/dml_ep.cpp
**Change Type:** modified
**Context:** PR #24060: G-API: Advanced device selection for ONNX DirectML Execution Provider
**Review Line:** 19

**Code Changes:**
```diff
 #include "../providers/dml/dml_provider_factory.h"
 
+#ifdef HAVE_DIRECTML
+
+#undef WINVER
+#define WINVER 0x0A00
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0A00
+
+#include <initguid.h>
+
```

Review comment:
It's already defined in cmake: https://github.com/opencv/opencv/blob/4.x/cmake/platforms/OpenCV-WinRT.cmake#L18 This is how `videoio` handles that: https://github.com/opencv/opencv/blob/4.x/modules/videoio/src/cap_msmf.cpp#L13-L17