nareshmlx/opencv-pr huggingface dataset:
**File:** modules/dnn/src/dnn_utils.cpp
**Change Type:** modified
**Context:** PR #24539: Add blobrecttoimage
**Review Line:** 443

**Code Changes:**
```diff
+            }
+        }
+        else
+            CV_Error(CV_StsBadArg, "Unknown padding mode");
+    }
+}
+
 
 CV__DNN_INLINE_NS_END
 }}  // namespace cv::dnn
```

Review comment:
If the only difference between two methods `Rect` and `Rect2d` in rounding - I recommend to add a note to docstring and reduce code duplication by calling `Rect2d` version and manual conversion to `Rect`
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #24539: Add blobrecttoimage

**Code Changes:**
```diff
@@ -1222,6 +1222,20 @@ CV__DNN_INLINE_NS_BEGIN
         CV_PROP_RW DataLayout datalayout; //!< Order of output dimensions. Choose DNN_LAYOUT_NCHW or DNN_LAYOUT_NHWC.
         CV_PROP_RW ImagePaddingMode paddingmode;   //!< Image padding mode. @see ImagePaddingMode.
         CV_PROP_RW Scalar borderValue;   //!< Value used in padding mode for padding.
+
+        /** @brief Get rectangle coordinates in original image system from rectangle in blob coordinates.
+         *  @param rBlob rect in blob coordinates.
+         *  @param size original input image size.
+         *  @returns rectangle in original image coordinates.
+         */
```

Review comment:
In NMSBoxes there is three type Rect, Rect2d and RotatedRect. Now in blobRect(s)ToImageRect(s) there is a scale factor error can be 0 to 2*scaleFactor pixels (2 because there is origin point and dimension) In python without this function all operation are in float
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #24539: Add blobrecttoimage

**Code Changes:**
```diff
@@ -1222,6 +1222,20 @@ CV__DNN_INLINE_NS_BEGIN
         CV_PROP_RW DataLayout datalayout; //!< Order of output dimensions. Choose DNN_LAYOUT_NCHW or DNN_LAYOUT_NHWC.
         CV_PROP_RW ImagePaddingMode paddingmode;   //!< Image padding mode. @see ImagePaddingMode.
         CV_PROP_RW Scalar borderValue;   //!< Value used in padding mode for padding.
+
+        /** @brief Get rectangle coordinates in original image system from rectangle in blob coordinates.
+         *  @param rBlob rect in blob coordinates.
+         *  @param size original input image size.
+         *  @returns rectangle in original image coordinates.
+         */
```

Review comment:
Because NMSBoxes might be applied as for relative Rect2d (values from 0 to 1) as for absolute pixel coordinates. On blobToImageRect we always return pixel coordinates and subpixel precision is redundant.
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #24539: Add blobrecttoimage

**Code Changes:**
```diff
@@ -1222,6 +1222,20 @@ CV__DNN_INLINE_NS_BEGIN
         CV_PROP_RW DataLayout datalayout; //!< Order of output dimensions. Choose DNN_LAYOUT_NCHW or DNN_LAYOUT_NHWC.
         CV_PROP_RW ImagePaddingMode paddingmode;   //!< Image padding mode. @see ImagePaddingMode.
         CV_PROP_RW Scalar borderValue;   //!< Value used in padding mode for padding.
+
+        /** @brief Get rectangle coordinates in original image system from rectangle in blob coordinates.
+         *  @param rBlob rect in blob coordinates.
+         *  @param size original input image size.
+         *  @returns rectangle in original image coordinates.
+         */
```

Review comment:
After this https://github.com/opencv/opencv/pull/24173 and https://github.com/opencv/opencv/pull/24267 there is now this I forgot this one https://github.com/opencv/opencv/pull/24261 PR for opencv is a waste of time
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #24539: Add blobrecttoimage

**Code Changes:**
```diff
@@ -1222,6 +1222,20 @@ CV__DNN_INLINE_NS_BEGIN
         CV_PROP_RW DataLayout datalayout; //!< Order of output dimensions. Choose DNN_LAYOUT_NCHW or DNN_LAYOUT_NHWC.
         CV_PROP_RW ImagePaddingMode paddingmode;   //!< Image padding mode. @see ImagePaddingMode.
         CV_PROP_RW Scalar borderValue;   //!< Value used in padding mode for padding.
+
+        /** @brief Get rectangle coordinates in original image system from rectangle in blob coordinates.
+         *  @param rBlob rect in blob coordinates.
+         *  @param size original input image size.
+         *  @returns rectangle in original image coordinates.
+         */
```

Review comment:
Please let me add a commit to this PR to demonstrate my vision of the version with Rect2d. The proposal is useful but requires partial changes to make all the public API behaviour aligned.
**File:** modules/dnn/src/darknet/darknet_io.cpp
**Change Type:** modified
**Context:** PR #24384: Fixes #22747. Support [crop] configuration for DarkNet

**Code Changes:**
```diff
@@ -309,6 +309,48 @@ namespace cv {
                     fused_layer_names.push_back(last_layer);
                 }
 
+                void setCrop(int crop_height, int crop_width, int inp_height, int inp_width, bool noadjust)
+                {
+                    cv::dnn::LayerParams crop_param;
+                    crop_param.name = "CropLayer-name";
+                    std::vector<int> begin = {0, 0, (inp_height - crop_height) / 2, (inp_width - crop_width) / 2};
+                    std::vector<int> sizes = {-1, -1, crop_height, crop_width};
```

Review comment:
Please use boolean parameters for true/false flags: ``` bool flip = getParam<bool>(layer_params, "flip", true); ```
**File:** modules/dnn/src/darknet/darknet_io.cpp
**Change Type:** modified
**Context:** PR #24384: Fixes #22747. Support [crop] configuration for DarkNet

**Code Changes:**
```diff
@@ -309,6 +309,48 @@ namespace cv {
                     fused_layer_names.push_back(last_layer);
                 }
 
+                void setCrop(int crop_height, int crop_width, int inp_height, int inp_width, bool noadjust)
+                {
+                    cv::dnn::LayerParams crop_param;
+                    crop_param.name = "CropLayer-name";
+                    std::vector<int> begin = {0, 0, (inp_height - crop_height) / 2, (inp_width - crop_width) / 2};
+                    std::vector<int> sizes = {-1, -1, crop_height, crop_width};
```

Review comment:
Unused arguments. How layer can work without them?
**File:** modules/dnn/src/darknet/darknet_io.cpp
**Change Type:** modified
**Context:** PR #24384: Fixes #22747. Support [crop] configuration for DarkNet

**Code Changes:**
```diff
@@ -309,6 +309,48 @@ namespace cv {
                     fused_layer_names.push_back(last_layer);
                 }
 
+                void setCrop(int crop_height, int crop_width, int inp_height, int inp_width, bool noadjust)
+                {
+                    cv::dnn::LayerParams crop_param;
+                    crop_param.name = "CropLayer-name";
+                    std::vector<int> begin = {0, 0, (inp_height - crop_height) / 2, (inp_width - crop_width) / 2};
+                    std::vector<int> sizes = {-1, -1, crop_height, crop_width};
```

Review comment:
There is no "CropLayer" in OpenCV - just "Crop"
**File:** modules/dnn/src/darknet/darknet_io.cpp
**Change Type:** modified
**Context:** PR #24384: Fixes #22747. Support [crop] configuration for DarkNet

**Code Changes:**
```diff
@@ -309,6 +309,48 @@ namespace cv {
                     fused_layer_names.push_back(last_layer);
                 }
 
+                void setCrop(int crop_height, int crop_width, int inp_height, int inp_width, bool noadjust)
+                {
+                    cv::dnn::LayerParams crop_param;
+                    crop_param.name = "CropLayer-name";
+                    std::vector<int> begin = {0, 0, (inp_height - crop_height) / 2, (inp_width - crop_width) / 2};
+                    std::vector<int> sizes = {-1, -1, crop_height, crop_width};
```

Review comment:
Let's avoid using default values here - the arguments are required.
**File:** modules/dnn/src/darknet/darknet_io.cpp
**Change Type:** modified
**Context:** PR #24384: Fixes #22747. Support [crop] configuration for DarkNet

**Code Changes:**
```diff
@@ -309,6 +309,48 @@ namespace cv {
                     fused_layer_names.push_back(last_layer);
                 }
 
+                void setCrop(int crop_height, int crop_width, int inp_height, int inp_width, bool noadjust)
+                {
+                    cv::dnn::LayerParams crop_param;
+                    crop_param.name = "CropLayer-name";
+                    std::vector<int> begin = {0, 0, (inp_height - crop_height) / 2, (inp_width - crop_width) / 2};
+                    std::vector<int> sizes = {-1, -1, crop_height, crop_width};
```

Review comment:
Moreover, there is no `crop_height` and `crop_width` attributes for Crop. You need to utilize Slice with it's `begin`, `end` or `size` (https://github.com/opencv/opencv/blob/4.x/modules/dnn/src/layers/slice_layer.cpp): ```cpp std::vector<int> begin = {0, 0, 0, 0}; std::vector<int> sizes = {-1, -1, crop_height, crop_width}; crop_param.set("begin", DictValue::arrayInt(&begin[0], begin.size())); crop_param.set("size", DictValue::arrayInt(&sizes[0], sizes.size())); crop_param.type = "Slice"; ```
**File:** modules/dnn/src/darknet/darknet_io.cpp
**Change Type:** modified
**Context:** PR #24384: Fixes #22747. Support [crop] configuration for DarkNet

**Code Changes:**
```diff
@@ -309,6 +309,48 @@ namespace cv {
                     fused_layer_names.push_back(last_layer);
                 }
 
+                void setCrop(int crop_height, int crop_width, int inp_height, int inp_width, bool noadjust)
+                {
+                    cv::dnn::LayerParams crop_param;
+                    crop_param.name = "CropLayer-name";
+                    std::vector<int> begin = {0, 0, (inp_height - crop_height) / 2, (inp_width - crop_width) / 2};
+                    std::vector<int> sizes = {-1, -1, crop_height, crop_width};
```

Review comment:
if `crop_height` and `crop_width` are not attributes for crop. Why did we generate test data using those parameters in `opencv_extra`
**File:** modules/dnn/src/darknet/darknet_io.cpp
**Change Type:** modified
**Context:** PR #24384: Fixes #22747. Support [crop] configuration for DarkNet

**Code Changes:**
```diff
@@ -309,6 +309,48 @@ namespace cv {
                     fused_layer_names.push_back(last_layer);
                 }
 
+                void setCrop(int crop_height, int crop_width, int inp_height, int inp_width, bool noadjust)
+                {
+                    cv::dnn::LayerParams crop_param;
+                    crop_param.name = "CropLayer-name";
+                    std::vector<int> begin = {0, 0, (inp_height - crop_height) / 2, (inp_width - crop_width) / 2};
+                    std::vector<int> sizes = {-1, -1, crop_height, crop_width};
```

Review comment:
These are native Darknet names and this is ok for test data. Importer should remap this parameters to expected ones by OpenCV
**File:** modules/dnn/src/darknet/darknet_io.cpp
**Change Type:** modified
**Context:** PR #24384: Fixes #22747. Support [crop] configuration for DarkNet

**Code Changes:**
```diff
@@ -309,6 +309,48 @@ namespace cv {
                     fused_layer_names.push_back(last_layer);
                 }
 
+                void setCrop(int crop_height, int crop_width, int inp_height, int inp_width, bool noadjust)
+                {
+                    cv::dnn::LayerParams crop_param;
+                    crop_param.name = "CropLayer-name";
+                    std::vector<int> begin = {0, 0, (inp_height - crop_height) / 2, (inp_width - crop_width) / 2};
+                    std::vector<int> sizes = {-1, -1, crop_height, crop_width};
```

Review comment:
Okay. I will replace it with the code snippet you gave.
**File:** modules/dnn/src/darknet/darknet_io.cpp
**Change Type:** modified
**Context:** PR #24384: Fixes #22747. Support [crop] configuration for DarkNet

**Code Changes:**
```diff
@@ -309,6 +309,48 @@ namespace cv {
                     fused_layer_names.push_back(last_layer);
                 }
 
+                void setCrop(int crop_height, int crop_width, int inp_height, int inp_width, bool noadjust)
+                {
+                    cv::dnn::LayerParams crop_param;
+                    crop_param.name = "CropLayer-name";
+                    std::vector<int> begin = {0, 0, (inp_height - crop_height) / 2, (inp_width - crop_width) / 2};
+                    std::vector<int> sizes = {-1, -1, crop_height, crop_width};
```

Review comment:
What can I use instead of default values? The function demands initial values.
**File:** modules/dnn/src/darknet/darknet_io.cpp
**Change Type:** modified
**Context:** PR #24384: Fixes #22747. Support [crop] configuration for DarkNet

**Code Changes:**
```diff
@@ -309,6 +309,48 @@ namespace cv {
                     fused_layer_names.push_back(last_layer);
                 }
 
+                void setCrop(int crop_height, int crop_width, int inp_height, int inp_width, bool noadjust)
+                {
+                    cv::dnn::LayerParams crop_param;
+                    crop_param.name = "CropLayer-name";
+                    std::vector<int> begin = {0, 0, (inp_height - crop_height) / 2, (inp_width - crop_width) / 2};
+                    std::vector<int> sizes = {-1, -1, crop_height, crop_width};
```

Review comment:
Use zero values and check that after retrieving they are not zero (means values are presented)
**File:** samples/android/tutorial-4-opencl/jni/CLprocessor.cpp
**Change Type:** modified
**Context:** PR #24715: Update android opencl sample

**Code Changes:**
```diff
@@ -1,7 +1,7 @@
 #ifdef OPENCL_FOUND
 #define __CL_ENABLE_EXCEPTIONS
 #define CL_USE_DEPRECATED_OPENCL_1_1_APIS /*let's give a chance for OpenCL 1.1 devices*/
-#include <CL/cl.hpp>
+#include <CL/opencl.hpp>
 #endif
 
 #include <GLES2/gl2.h>
@@ -87,10 +87,11 @@ cl::CommandQueue theQueue;
```

Review comment:
please remove extra debug logs.
**File:** samples/android/tutorial-4-opencl/jni/CMakeLists.txt
**Change Type:** modified
**Context:** PR #24715: Update android opencl sample
**Review Line:** 41

**Code Changes:**
```diff
+  target_link_libraries(${target} -lOpenCL)
+
   add_definitions("-DOPENCL_FOUND")
+  add_definitions("-DCL_HPP_MINIMUM_OPENCL_VERSION=120")
+  add_definitions("-DCL_HPP_TARGET_OPENCL_VERSION=120")
+  add_definitions("-DCL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY")
 endif()
```

Review comment:
Please add comment that the macros related to OpenCL SDK, but not OpenCV.
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #24546: Check Checkerboard Corners

**Code Changes:**
```diff
@@ -479,8 +479,7 @@ bool findChessboardCorners(InputArray image_, Size pattern_size,
 
     bool found = false;
 
-    const int min_dilations = 0;
-    const int max_dilations = 7;
+    const bool is_plain = (flags & CALIB_CB_PLAIN) != 0;
 
     int type = image_.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
     Mat img = image_.getMat();
```

Review comment:
Maybe It would be better to use separate variable instead of checking flags each time: ```.cpp const bool isPlainMode = flags & CALIB_CB_PLAIN;` ``` Not sure about naming though, this function uses `snake_case` for most variables, so it might be `is_plain` for example. It is better to use regular `if` layout, not one line: ```.cpp if (...) func(); ```
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #24546: Check Checkerboard Corners

**Code Changes:**
```diff
@@ -479,8 +479,7 @@ bool findChessboardCorners(InputArray image_, Size pattern_size,
 
     bool found = false;
 
-    const int min_dilations = 0;
-    const int max_dilations = 7;
+    const bool is_plain = (flags & CALIB_CB_PLAIN) != 0;
 
     int type = image_.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
     Mat img = image_.getMat();
```

Review comment:
This variable can be initialized with correct value: ```.cpp const int max_dilations = isPlainMode ? 0 : 7; ``` Declaration can be moved down - to the place where it is actually used.
**File:** modules/calib3d/include/opencv2/calib3d.hpp
**Change Type:** modified
**Context:** PR #24546: Check Checkerboard Corners
**Review Line:** 1239

**Code Changes:**
```diff
 enum { CALIB_CB_SYMMETRIC_GRID  = 1,
@@ -1235,6 +1236,10 @@ square-like shape) to filter out false quads extracted at the contour retrieval
 -   @ref CALIB_CB_FAST_CHECK Run a fast check on the image that looks for chessboard corners,
 and shortcut the call if none is found. This can drastically speed up the call in the
 degenerate condition when no chessboard is observed.
+-   @ref CALIB_CB_PLAIN All other flags are ignored. The input image is taken as is.
+No image processing is done to improve to find the checkerboard. This has the effect of speeding up the
+execution of the function but could lead to not recognizing the checkerboard if the image
+is not previously binarized in the appropriate manner.
 
 The function attempts to determine whether the input image is a view of the chessboard pattern and
```

Review comment:
This flag implies that binarized image is passed as an input, yet there is still a `cvtColor` call still left. Maybe an exception should be thrown if color image is passed with this flag enabled.
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #24546: Check Checkerboard Corners

**Code Changes:**
```diff
@@ -479,8 +479,7 @@ bool findChessboardCorners(InputArray image_, Size pattern_size,
 
     bool found = false;
 
-    const int min_dilations = 0;
-    const int max_dilations = 7;
+    const bool is_plain = (flags & CALIB_CB_PLAIN) != 0;
 
     int type = image_.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
     Mat img = image_.getMat();
```

Review comment:
This file use 4 spaces indent.
**File:** modules/calib3d/include/opencv2/calib3d.hpp
**Change Type:** modified
**Context:** PR #24546: Check Checkerboard Corners
**Review Line:** 1239

**Code Changes:**
```diff
 enum { CALIB_CB_SYMMETRIC_GRID  = 1,
@@ -1235,6 +1236,10 @@ square-like shape) to filter out false quads extracted at the contour retrieval
 -   @ref CALIB_CB_FAST_CHECK Run a fast check on the image that looks for chessboard corners,
 and shortcut the call if none is found. This can drastically speed up the call in the
 degenerate condition when no chessboard is observed.
+-   @ref CALIB_CB_PLAIN All other flags are ignored. The input image is taken as is.
+No image processing is done to improve to find the checkerboard. This has the effect of speeding up the
+execution of the function but could lead to not recognizing the checkerboard if the image
+is not previously binarized in the appropriate manner.
 
 The function attempts to determine whether the input image is a view of the chessboard pattern and
```

Review comment:
Hi, I added these lines below I don't know if that's what you meant: ``` if (is_plain) CV_CheckType(type, depth == CV_8U && cn == 1 ), "Only 8-bit grayscale images are supported whit CALIB_CB_PLAIN flag enable"); ```
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #24546: Check Checkerboard Corners

**Code Changes:**
```diff
@@ -479,8 +479,7 @@ bool findChessboardCorners(InputArray image_, Size pattern_size,
 
     bool found = false;
 
-    const int min_dilations = 0;
-    const int max_dilations = 7;
+    const bool is_plain = (flags & CALIB_CB_PLAIN) != 0;
 
     int type = image_.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
     Mat img = image_.getMat();
```

Review comment:
```suggestion if (flags & CALIB_CB_FAST_CHECK && !is_plain) ```
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #24546: Check Checkerboard Corners

**Code Changes:**
```diff
@@ -479,8 +479,7 @@ bool findChessboardCorners(InputArray image_, Size pattern_size,
 
     bool found = false;
 
-    const int min_dilations = 0;
-    const int max_dilations = 7;
+    const bool is_plain = (flags & CALIB_CB_PLAIN) != 0;
 
     int type = image_.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
     Mat img = image_.getMat();
```

Review comment:
```suggestion if (!found && !is_plain) ```
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #24546: Check Checkerboard Corners

**Code Changes:**
```diff
@@ -479,8 +479,7 @@ bool findChessboardCorners(InputArray image_, Size pattern_size,
 
     bool found = false;
 
-    const int min_dilations = 0;
-    const int max_dilations = 7;
+    const bool is_plain = (flags & CALIB_CB_PLAIN) != 0;
 
     int type = image_.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
     Mat img = image_.getMat();
```

Review comment:
```suggestion CV_CheckType(type, depth == CV_8U && cn == 1, "Only 8-bit grayscale images are supported whith CALIB_CB_PLAIN flag enable"); ```
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #24546: Check Checkerboard Corners

**Code Changes:**
```diff
@@ -479,8 +479,7 @@ bool findChessboardCorners(InputArray image_, Size pattern_size,
 
     bool found = false;
 
-    const int min_dilations = 0;
-    const int max_dilations = 7;
+    const bool is_plain = (flags & CALIB_CB_PLAIN) != 0;
 
     int type = image_.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
     Mat img = image_.getMat();
```

Review comment:
BTW, wouldn't it be useful to have both PLAIN and FAST_CHECK flags enabled?
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #24546: Check Checkerboard Corners

**Code Changes:**
```diff
@@ -479,8 +479,7 @@ bool findChessboardCorners(InputArray image_, Size pattern_size,
 
     bool found = false;
 
-    const int min_dilations = 0;
-    const int max_dilations = 7;
+    const bool is_plain = (flags & CALIB_CB_PLAIN) != 0;
 
     int type = image_.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
     Mat img = image_.getMat();
```

Review comment:
Hi mshabunin I'm not so sure about the idea of having both CALIB_CB_PLAIN and CALIB_CB_FAST_CHECK active at the same time. The basic idea with CALIB_CB_PLAIN is to have a function that in fact does "nothing" in the sense that all image processing (binarization) is done externally
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #24546: Check Checkerboard Corners

**Code Changes:**
```diff
@@ -479,8 +479,7 @@ bool findChessboardCorners(InputArray image_, Size pattern_size,
 
     bool found = false;
 
-    const int min_dilations = 0;
-    const int max_dilations = 7;
+    const bool is_plain = (flags & CALIB_CB_PLAIN) != 0;
 
     int type = image_.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
     Mat img = image_.getMat();
```

Review comment:
There is windows build warning here: ``` opencv\modules\calib3d\src\calibinit.cpp(482): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) [build\modules\calib3d\opencv_calib3d.vcxproj] ``` https://pullrequest.opencv.org/buildbot/builders/precommit_windows64/builds/103677/steps/compile%20release/logs/warnings%20%281%29 Perhaps it should be either explicitly casted to `bool` or transformed to bool expression (`flags & CB_PLAIN == CB_PLAIN`).
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #24546: Check Checkerboard Corners

**Code Changes:**
```diff
@@ -479,8 +479,7 @@ bool findChessboardCorners(InputArray image_, Size pattern_size,
 
     bool found = false;
 
-    const int min_dilations = 0;
-    const int max_dilations = 7;
+    const bool is_plain = (flags & CALIB_CB_PLAIN) != 0;
 
     int type = image_.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
     Mat img = image_.getMat();
```

Review comment:
I meant casting the whole expression to bool: `static_cast<bool>(flags & CB_PLAIN)` (or C-style cast). Let's try the method from [VS documentation](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4800?view=msvc-170) instead: `(flags & CALIB_CB_PLAIN) != 0`