nareshmlx/opencv-pr huggingface dataset:
**File:** modules/gapi/include/opencv2/gapi/gproto.hpp
**Change Type:** modified
**Context:** PR #16604: G-API: Zero-height mat is cause of crash - ### Zero-height mat is cause of crash cv::GMat in; cv::GMat a, b, c, d; std::tie(a, b, c, d) = c...

**Code Changes:**
```diff
@@ -126,6 +126,10 @@ bool GAPI_EXPORTS can_describe(const GMetaArgs& metas, const GRunArgs& args);
 // coincides with output arguments passed to computation in cpu and ocl backends
 bool GAPI_EXPORTS can_describe(const GMetaArg&  meta,  const GRunArgP& argp);
 
+// Validates input arguments
+void GAPI_EXPORTS validate_input_arg(const GRunArg& arg);
+void GAPI_EXPORTS validate_input_args(const GRunArgs& args);
+
 } // namespace cv
 
```

Review comment:
for a `GRunArgs` version I'd name it `.._args`
**File:** modules/gapi/src/api/gproto.cpp
**Change Type:** modified
**Context:** PR #16604: G-API: Zero-height mat is cause of crash - ### Zero-height mat is cause of crash cv::GMat in; cv::GMat a, b, c, d; std::tie(a, b, c, d) = c...

**Code Changes:**
```diff
@@ -197,6 +197,42 @@ bool cv::can_describe(const GMetaArgs &metas, const GRunArgs &args)
                      });
 }
 
+void cv::validate_input_arg(const GRunArg& arg)
+{
+    // FIXME: It checks only Mat argument
+    switch (arg.index())
+    {
+#if !defined(GAPI_STANDALONE)
```

Review comment:
you don't need `return` here. And please don't forget about `break` once you refactor
**File:** modules/gapi/src/api/gproto.cpp
**Change Type:** modified
**Context:** PR #16604: G-API: Zero-height mat is cause of crash - ### Zero-height mat is cause of crash cv::GMat in; cv::GMat a, b, c, d; std::tie(a, b, c, d) = c...

**Code Changes:**
```diff
@@ -197,6 +197,42 @@ bool cv::can_describe(const GMetaArgs &metas, const GRunArgs &args)
                      });
 }
 
+void cv::validate_input_arg(const GRunArg& arg)
+{
+    // FIXME: It checks only Mat argument
+    switch (arg.index())
+    {
+#if !defined(GAPI_STANDALONE)
```

Review comment:
Actually, if a type doesn't require any validation, you can just do ```c++ default: // No extra handling break; ```
**File:** modules/gapi/src/api/gproto.cpp
**Change Type:** modified
**Context:** PR #16604: G-API: Zero-height mat is cause of crash - ### Zero-height mat is cause of crash cv::GMat in; cv::GMat a, b, c, d; std::tie(a, b, c, d) = c...

**Code Changes:**
```diff
@@ -197,6 +197,42 @@ bool cv::can_describe(const GMetaArgs &metas, const GRunArgs &args)
                      });
 }
 
+void cv::validate_input_arg(const GRunArg& arg)
+{
+    // FIXME: It checks only Mat argument
+    switch (arg.index())
+    {
+#if !defined(GAPI_STANDALONE)
```

Review comment:
You don't need lambda here. Just make `validate_input_arg` the 3rd argument to `any_of`.
**File:** modules/gapi/src/api/gproto.cpp
**Change Type:** modified
**Context:** PR #16604: G-API: Zero-height mat is cause of crash - ### Zero-height mat is cause of crash cv::GMat in; cv::GMat a, b, c, d; std::tie(a, b, c, d) = c...

**Code Changes:**
```diff
@@ -197,6 +197,42 @@ bool cv::can_describe(const GMetaArgs &metas, const GRunArgs &args)
                      });
 }
 
+void cv::validate_input_arg(const GRunArg& arg)
+{
+    // FIXME: It checks only Mat argument
+    switch (arg.index())
+    {
+#if !defined(GAPI_STANDALONE)
```

Review comment:
Since we're going to `throw`, I'd just run it via `for_each`.
**File:** modules/gapi/src/compiler/gcompiled.cpp
**Change Type:** modified
**Context:** PR #16604: G-API: Zero-height mat is cause of crash - ### Zero-height mat is cause of crash cv::GMat in; cv::GMat a, b, c, d; std::tie(a, b, c, d) = c...

**Code Changes:**
```diff
@@ -56,6 +56,7 @@ void cv::GCompiled::Priv::checkArgs(const cv::gimpl::GRuntimeArgs &args) const
                                            "for different metadata!"));
         // FIXME: Add details on what is actually wrong
     }
+    validate_input_args(args.inObjs);
 }
 
 bool cv::GCompiled::Priv::canReshape() const
```

Review comment:
This text is wrong. The object has been compiled already, here you enter the execution.
**File:** modules/gapi/src/api/gproto.cpp
**Change Type:** modified
**Context:** PR #16604: G-API: Zero-height mat is cause of crash - ### Zero-height mat is cause of crash cv::GMat in; cv::GMat a, b, c, d; std::tie(a, b, c, d) = c...

**Code Changes:**
```diff
@@ -197,6 +197,42 @@ bool cv::can_describe(const GMetaArgs &metas, const GRunArgs &args)
                      });
 }
 
+void cv::validate_input_arg(const GRunArg& arg)
+{
+    // FIXME: It checks only Mat argument
+    switch (arg.index())
+    {
+#if !defined(GAPI_STANDALONE)
```

Review comment:
std::for_each() or range based for(auto el : cont)?
**File:** modules/dnn/CMakeLists.txt
**Change Type:** modified
**Context:** PR #16218: Enable cuda4dnn on hardware without support for __half - ie. hardware with compute capability < 5.3 It compiles/link fine and I was able to...

**Code Changes:**
```diff
@@ -95,8 +95,8 @@ if(OPENCV_DNN_CUDA AND HAVE_CUDA AND HAVE_CUBLAS AND HAVE_CUDNN)
   set(CC_LIST ${CUDA_ARCH_BIN})
   separate_arguments(CC_LIST)
   foreach(cc ${CC_LIST})
-    if(cc VERSION_LESS 5.3)
-      message(FATAL_ERROR "CUDA backend for DNN module requires CC 5.3 or higher. Please remove unsupported architectures from CUDA_ARCH_BIN option.")
+    if(cc VERSION_LESS 3.0)
+      message(FATAL_ERROR "CUDA backend for DNN module requires CC 3.0 or higher. Please remove unsupported architectures from CUDA_ARCH_BIN option or disable OPENCV_DNN_CUDA=OFF.")
     endif()
   endforeach()
```

Review comment:
We can get rid of this check or drop it to 3.0.
**File:** modules/dnn/src/cuda/atomics.hpp
**Change Type:** modified
**Context:** PR #16218: Enable cuda4dnn on hardware without support for __half - ie. hardware with compute capability < 5.3 It compiles/link fine and I was able to...

**Code Changes:**
```diff
@@ -8,7 +8,12 @@
 #include <cuda_runtime.h>
 #include <cuda_fp16.h>
 
+// The 16-bit __half floating-point version of atomicAdd() is only supported by devices of compute capability 7.x and higher.
+// https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#atomicadd
 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 700
+// And half-precision floating-point operations are not supported by devices of compute capability strictly lower than 5.3
+// https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#features-and-technical-specifications
+#elif __CUDA_ARCH__ < 530
```

Review comment:
Please optimize the condition, it's very unclear for reader and add reference to CUDA documentation to make it clear, why you need the `atomicAdd` emulation, like this: https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#atomicadd
**File:** modules/dnn/src/dnn.cpp
**Change Type:** modified
**Context:** PR #16218: Enable cuda4dnn on hardware without support for __half - ie. hardware with compute capability < 5.3 It compiles/link fine and I was able to...

**Code Changes:**
```diff
@@ -152,6 +152,23 @@ class BackendRegistry
     }
 #endif
 
+#ifdef HAVE_CUDA
+    static inline bool cudaDeviceSupportsFp16() {
+        if (cv::cuda::getCudaEnabledDeviceCount() <= 0)
+            return false;
+        const int devId = cv::cuda::getDevice();
+        if (devId<0)
```

Review comment:
The `inline` isn't required. The function name is not very clear. This function only checks for FP16 support in CUDA capable devices but the name suggests that it checks for any device.
**File:** modules/dnn/src/dnn.cpp
**Change Type:** modified
**Context:** PR #16218: Enable cuda4dnn on hardware without support for __half - ie. hardware with compute capability < 5.3 It compiles/link fine and I was able to...

**Code Changes:**
```diff
@@ -152,6 +152,23 @@ class BackendRegistry
     }
 #endif
 
+#ifdef HAVE_CUDA
+    static inline bool cudaDeviceSupportsFp16() {
+        if (cv::cuda::getCudaEnabledDeviceCount() <= 0)
+            return false;
+        const int devId = cv::cuda::getDevice();
+        if (devId<0)
```

Review comment:
Something like `currentCudaDeviceSupportsFp16()`?
**File:** modules/dnn/src/cuda/atomics.hpp
**Change Type:** modified
**Context:** PR #16218: Enable cuda4dnn on hardware without support for __half - ie. hardware with compute capability < 5.3 It compiles/link fine and I was able to...

**Code Changes:**
```diff
@@ -8,7 +8,12 @@
 #include <cuda_runtime.h>
 #include <cuda_fp16.h>
 
+// The 16-bit __half floating-point version of atomicAdd() is only supported by devices of compute capability 7.x and higher.
+// https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#atomicadd
 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 700
+// And half-precision floating-point operations are not supported by devices of compute capability strictly lower than 5.3
+// https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#features-and-technical-specifications
+#elif __CUDA_ARCH__ < 530
```

Review comment:
Is it better now? Say hello to Sergei!
**File:** modules/dnn/CMakeLists.txt
**Change Type:** modified
**Context:** PR #16218: Enable cuda4dnn on hardware without support for __half - ie. hardware with compute capability < 5.3 It compiles/link fine and I was able to...

**Code Changes:**
```diff
@@ -95,8 +95,8 @@ if(OPENCV_DNN_CUDA AND HAVE_CUDA AND HAVE_CUBLAS AND HAVE_CUDNN)
   set(CC_LIST ${CUDA_ARCH_BIN})
   separate_arguments(CC_LIST)
   foreach(cc ${CC_LIST})
-    if(cc VERSION_LESS 5.3)
-      message(FATAL_ERROR "CUDA backend for DNN module requires CC 5.3 or higher. Please remove unsupported architectures from CUDA_ARCH_BIN option.")
+    if(cc VERSION_LESS 3.0)
+      message(FATAL_ERROR "CUDA backend for DNN module requires CC 3.0 or higher. Please remove unsupported architectures from CUDA_ARCH_BIN option or disable OPENCV_DNN_CUDA=OFF.")
     endif()
   endforeach()
```

Review comment:
Please add this CMake hint to error message: > "or disable OPENCV_DNN_CUDA=OFF"
**File:** .github/ISSUE_TEMPLATE.md
**Change Type:** modified
**Context:** PR #16690: Added checklist and recommendations to issue template

**Code Changes:**
```diff
@@ -1,23 +1,8 @@
-<!--
-If you have a question rather than reporting a bug please go to http://answers.opencv.org where you get much faster responses.
-If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).
-
-Please:
-
-* Read the documentation to test with the latest developer build.
-* Check if other person has already created the same issue to avoid duplicates. You can comment on it if there already is an issue.
-* Try to be as detailed as possible in your report.
```

Review comment:
```.diff -Stackoverflow +StackOverflow ``` Ref: https://twitter.com/StackOverflow > disucss > probelem typos
**File:** .github/ISSUE_TEMPLATE.md
**Change Type:** modified
**Context:** PR #16690: Added checklist and recommendations to issue template
**Review Line:** 42

**Code Changes:**
```diff
+   * OpenCV documentation: https://docs.opencv.org
+   * FAQ page: https://github.com/opencv/opencv/wiki/FAQ
+   * OpenCV forum: https://answers.opencv.org
+   * OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
+   * Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
+   -->
+ - [ ] I updated to latest OpenCV version and the issue is still there
+   <!--
+   master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
+   OpenCV team supports only latest release for each branch.
+   The ticket is closed, if the problem is not reproduced with modern version.
```

Review comment:
Add this link: `https://github.com/opencv/opencv/issues?q=is%3Aissue` (parameter is required to show closed issues too)
**File:** modules/gapi/include/opencv2/gapi/own/mat.hpp
**Change Type:** modified
**Context:** PR #16577: G-API: Fix. own::Mat successfully creates a {-1, -1} mat. - ### own::Mat successfully created a mat with negative dimensions. Method `creat...
**Review Line:** 233

**Code Changes:**
```diff
@@ -230,6 +230,7 @@ namespace cv { namespace gapi { namespace own {
         */
         void create(Size _size, int _type)
         {
+            GAPI_Assert(_size.height >= 0 && _size.width >= 0);
             if (_size != Size{cols, rows} )
             {
                 Mat tmp{_size.height, _size.width, _type, nullptr};
```

Review comment:
Why 0 values are allowed?
**File:** modules/gapi/include/opencv2/gapi/own/mat.hpp
**Change Type:** modified
**Context:** PR #16577: G-API: Fix. own::Mat successfully creates a {-1, -1} mat. - ### own::Mat successfully created a mat with negative dimensions. Method `creat...
**Review Line:** 233

**Code Changes:**
```diff
@@ -230,6 +230,7 @@ namespace cv { namespace gapi { namespace own {
         */
         void create(Size _size, int _type)
         {
+            GAPI_Assert(_size.height >= 0 && _size.width >= 0);
             if (_size != Size{cols, rows} )
             {
                 Mat tmp{_size.height, _size.width, _type, nullptr};
```

Review comment:
Because `CV_Assert( s >= 0 )` is used in cv::Mat in `create(...)` in `setSize(...)`. cv::Mat successfully creates Size{0, 0} mat. It is a similar check for own::Mat.
**File:** modules/gapi/test/own/mat_tests.cpp
**Change Type:** modified
**Context:** PR #16577: G-API: Fix. own::Mat successfully creates a {-1, -1} mat. - ### own::Mat successfully created a mat with negative dimensions. Method `creat...

**Code Changes:**
```diff
@@ -588,4 +588,23 @@ TEST(OwnMat, ROIView)
         << to_ocv(roi_view) << std::endl
         << expected_cv_mat  << std::endl;
 }
+
+TEST(OwnMat, CreateWithNegativeDims)
+{
+    Mat own_mat;
+    ASSERT_ANY_THROW(own_mat.create(cv::Size{-1, -1}, CV_8U));
+}
```

Review comment:
What if just one of dimensions is negative? Can I create a Mat with zero height?
**File:** modules/gapi/include/opencv2/gapi/own/mat.hpp
**Change Type:** modified
**Context:** PR #16577: G-API: Fix. own::Mat successfully creates a {-1, -1} mat. - ### own::Mat successfully created a mat with negative dimensions. Method `creat...
**Review Line:** 233

**Code Changes:**
```diff
@@ -230,6 +230,7 @@ namespace cv { namespace gapi { namespace own {
         */
         void create(Size _size, int _type)
         {
+            GAPI_Assert(_size.height >= 0 && _size.width >= 0);
             if (_size != Size{cols, rows} )
             {
                 Mat tmp{_size.height, _size.width, _type, nullptr};
```

Review comment:
so `create(cv::Size(0,0))` is valid?
**File:** modules/gapi/test/own/mat_tests.cpp
**Change Type:** modified
**Context:** PR #16577: G-API: Fix. own::Mat successfully creates a {-1, -1} mat. - ### own::Mat successfully created a mat with negative dimensions. Method `creat...

**Code Changes:**
```diff
@@ -588,4 +588,23 @@ TEST(OwnMat, ROIView)
         << to_ocv(roi_view) << std::endl
         << expected_cv_mat  << std::endl;
 }
+
+TEST(OwnMat, CreateWithNegativeDims)
+{
+    Mat own_mat;
+    ASSERT_ANY_THROW(own_mat.create(cv::Size{-1, -1}, CV_8U));
+}
```

Review comment:
You can't create own::Mat if just one of dimensions is negative. And you can create own::Mat with zero height.
**File:** modules/gapi/test/own/mat_tests.cpp
**Change Type:** modified
**Context:** PR #16577: G-API: Fix. own::Mat successfully creates a {-1, -1} mat. - ### own::Mat successfully created a mat with negative dimensions. Method `creat...

**Code Changes:**
```diff
@@ -588,4 +588,23 @@ TEST(OwnMat, ROIView)
         << to_ocv(roi_view) << std::endl
         << expected_cv_mat  << std::endl;
 }
+
+TEST(OwnMat, CreateWithNegativeDims)
+{
+    Mat own_mat;
+    ASSERT_ANY_THROW(own_mat.create(cv::Size{-1, -1}, CV_8U));
+}
```

Review comment:
> You can't create own::Mat if just one of dimensions is negative. My point was that this needs to be demonstrated by tests > And you can create own::Mat with zero height. What's the reason in a Mat with zero height? Can we also create a cv::Mat with zero height?
**File:** modules/gapi/test/own/mat_tests.cpp
**Change Type:** modified
**Context:** PR #16577: G-API: Fix. own::Mat successfully creates a {-1, -1} mat. - ### own::Mat successfully created a mat with negative dimensions. Method `creat...

**Code Changes:**
```diff
@@ -588,4 +588,23 @@ TEST(OwnMat, ROIView)
         << to_ocv(roi_view) << std::endl
         << expected_cv_mat  << std::endl;
 }
+
+TEST(OwnMat, CreateWithNegativeDims)
+{
+    Mat own_mat;
+    ASSERT_ANY_THROW(own_mat.create(cv::Size{-1, -1}, CV_8U));
+}
```

Review comment:
We can create cv::Mat with zero dimensions. We can use constructor or create method for this. But cv::Mat with zero dimensions isn't use anywhere.
**File:** modules/gapi/test/own/mat_tests.cpp
**Change Type:** modified
**Context:** PR #16577: G-API: Fix. own::Mat successfully creates a {-1, -1} mat. - ### own::Mat successfully created a mat with negative dimensions. Method `creat...

**Code Changes:**
```diff
@@ -588,4 +588,23 @@ TEST(OwnMat, ROIView)
         << to_ocv(roi_view) << std::endl
         << expected_cv_mat  << std::endl;
 }
+
+TEST(OwnMat, CreateWithNegativeDims)
+{
+    Mat own_mat;
+    ASSERT_ANY_THROW(own_mat.create(cv::Size{-1, -1}, CV_8U));
+}
```

Review comment:
Just figured out that the title of this test doesn't reflect the meaning of this test. Also you can split this test into two or three, highlighting what aspects do you verify with this test.
**File:** modules/gapi/test/own/mat_tests.cpp
**Change Type:** modified
**Context:** PR #16577: G-API: Fix. own::Mat successfully creates a {-1, -1} mat. - ### own::Mat successfully created a mat with negative dimensions. Method `creat...

**Code Changes:**
```diff
@@ -588,4 +588,23 @@ TEST(OwnMat, ROIView)
         << to_ocv(roi_view) << std::endl
         << expected_cv_mat  << std::endl;
 }
+
+TEST(OwnMat, CreateWithNegativeDims)
+{
+    Mat own_mat;
+    ASSERT_ANY_THROW(own_mat.create(cv::Size{-1, -1}, CV_8U));
+}
```

Review comment:
Fixed. Divided test into three. Changed names for tests.
**File:** modules/gapi/test/own/mat_tests.cpp
**Change Type:** modified
**Context:** PR #16577: G-API: Fix. own::Mat successfully creates a {-1, -1} mat. - ### own::Mat successfully created a mat with negative dimensions. Method `creat...

**Code Changes:**
```diff
@@ -588,4 +588,23 @@ TEST(OwnMat, ROIView)
         << to_ocv(roi_view) << std::endl
         << expected_cv_mat  << std::endl;
 }
+
+TEST(OwnMat, CreateWithNegativeDims)
+{
+    Mat own_mat;
+    ASSERT_ANY_THROW(own_mat.create(cv::Size{-1, -1}, CV_8U));
+}
```

Review comment:
std::exception is base class it coverage all exceptions, better to use `EXPECT_ANY_THROW` if you don't want to clarify exception type
**File:** modules/gapi/test/own/mat_tests.cpp
**Change Type:** modified
**Context:** PR #16577: G-API: Fix. own::Mat successfully creates a {-1, -1} mat. - ### own::Mat successfully created a mat with negative dimensions. Method `creat...

**Code Changes:**
```diff
@@ -588,4 +588,23 @@ TEST(OwnMat, ROIView)
         << to_ocv(roi_view) << std::endl
         << expected_cv_mat  << std::endl;
 }
+
+TEST(OwnMat, CreateWithNegativeDims)
+{
+    Mat own_mat;
+    ASSERT_ANY_THROW(own_mat.create(cv::Size{-1, -1}, CV_8U));
+}
```

Review comment:
Split this into small tests for specific cases instead of one large test with a bunch of checks This way you will see that comments will be unnecessary
**File:** modules/gapi/test/own/mat_tests.cpp
**Change Type:** modified
**Context:** PR #16577: G-API: Fix. own::Mat successfully creates a {-1, -1} mat. - ### own::Mat successfully created a mat with negative dimensions. Method `creat...

**Code Changes:**
```diff
@@ -588,4 +588,23 @@ TEST(OwnMat, ROIView)
         << to_ocv(roi_view) << std::endl
         << expected_cv_mat  << std::endl;
 }
+
+TEST(OwnMat, CreateWithNegativeDims)
+{
+    Mat own_mat;
+    ASSERT_ANY_THROW(own_mat.create(cv::Size{-1, -1}, CV_8U));
+}
```

Review comment:
Is it really necessary to pass `nullptr` here ?
**File:** modules/gapi/test/own/mat_tests.cpp
**Change Type:** modified
**Context:** PR #16577: G-API: Fix. own::Mat successfully creates a {-1, -1} mat. - ### own::Mat successfully created a mat with negative dimensions. Method `creat...

**Code Changes:**
```diff
@@ -588,4 +588,23 @@ TEST(OwnMat, ROIView)
         << to_ocv(roi_view) << std::endl
         << expected_cv_mat  << std::endl;
 }
+
+TEST(OwnMat, CreateWithNegativeDims)
+{
+    Mat own_mat;
+    ASSERT_ANY_THROW(own_mat.create(cv::Size{-1, -1}, CV_8U));
+}
```

Review comment:
own::Mat's constructor is `Mat(int, int, int, void* _data, size_t)`. I should put something in `_data`.
**File:** modules/core/include/opencv2/core/cuda.hpp
**Change Type:** modified
**Context:** PR #16513: Allow access to CUDA pointers for interoperability with other libraries - This is a proposal for adding `CV_WRAP` compatible `cudaPtr()` ge...
**Review Line:** 688

**Code Changes:**
```diff
@@ -681,6 +684,9 @@ class CV_EXPORTS_W Stream
     //! returns true if stream object is not default (!= 0)
     operator bool_type() const;
 
+    //! return Pointer to CUDA stream
+    CV_WRAP void* cudaPtr() const;
+
     class Impl;
 
 private:
```

Review comment:
There is `StreamAccessor` to do it: https://docs.opencv.org/master/d6/df1/structcv_1_1cuda_1_1StreamAccessor.html. I think it's better to wrap accessor rather expose private fields.
**File:** modules/core/include/opencv2/core/cuda.inl.hpp
**Change Type:** modified
**Context:** PR #16513: Allow access to CUDA pointers for interoperability with other libraries - This is a proposal for adding `CV_WRAP` compatible `cudaPtr()` ge...
**Review Line:** 349

**Code Changes:**
```diff
 }
 
+inline
+void* GpuMat::cudaPtr() const
+{
+    return data;
+}
+
 static inline
 GpuMat createContinuous(int rows, int cols, int type)
 {
```

Review comment:
There is `CV_PROP_RW` macro that allows to expose object properties to Python and other languages. You do not need own method for it.
**File:** modules/core/include/opencv2/core/cuda.inl.hpp
**Change Type:** modified
**Context:** PR #16513: Allow access to CUDA pointers for interoperability with other libraries - This is a proposal for adding `CV_WRAP` compatible `cudaPtr()` ge...
**Review Line:** 349

**Code Changes:**
```diff
 }
 
+inline
+void* GpuMat::cudaPtr() const
+{
+    return data;
+}
+
 static inline
 GpuMat createContinuous(int rows, int cols, int type)
 {
```

Review comment:
I believe current approach is fine. We should not allow changing of this pointer through `CV_PROP_RW`.
**File:** modules/core/include/opencv2/core/cuda.hpp
**Change Type:** modified
**Context:** PR #16513: Allow access to CUDA pointers for interoperability with other libraries - This is a proposal for adding `CV_WRAP` compatible `cudaPtr()` ge...
**Review Line:** 688

**Code Changes:**
```diff
@@ -681,6 +684,9 @@ class CV_EXPORTS_W Stream
     //! returns true if stream object is not default (!= 0)
     operator bool_type() const;
 
+    //! return Pointer to CUDA stream
+    CV_WRAP void* cudaPtr() const;
+
     class Impl;
 
 private:
```

Review comment:
> StreamAccessor Not sure that this can help to reach the final goal: > to implement `__cuda_array_interface__` within the `GpuMat` python binding
**File:** samples/cpp/camshiftdemo.cpp
**Change Type:** modified
**Context:** PR #16652: Using argv[0] represent binary executable files' name in help() function in sample codes instead of cpp files' name.

**Code Changes:**
```diff
@@ -1,4 +1,4 @@
-#include <opencv2/core/utility.hpp>
+#include "opencv2/core/utility.hpp"
 #include "opencv2/video/tracking.hpp"
 #include "opencv2/imgproc.hpp"
 #include "opencv2/videoio.hpp"
@@ -57,13 +57,13 @@ string hot_keys =
     "\tp - pause video\n"
     "To initialize tracking, select the object with mouse\n";
 
```

Review comment:
Please remove `./camshiftdemo`, `argv[0]` does it for you.