nareshmlx/opencv-pr huggingface dataset:
**File:** cmake/OpenCVFindLAPACK.cmake
**Change Type:** modified
**Context:** PR #21114: Fix compile against lapack-3.10.0 - part 1

**Code Changes:**
```diff
@@ -51,6 +51,23 @@ macro(ocv_lapack_check)
     if(NOT "${OPENCV_CBLAS_H_PATH_${_lapack_impl}}" STREQUAL "${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}")
       list(APPEND _lapack_content "#include \"${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}\"")
     endif()
+    list(APPEND _lapack_content "
+#if defined(LAPACK_GLOBAL) || defined(LAPACK_NAME)
+/*
+ * Using netlib's reference LAPACK implementation version >= 3.4.0 (first with C interface).
+ * Use LAPACK_xxxx to transparently (via predefined lapack macros) deal with pre and post 3.9.1 versions.
+ * LAPACK 3.9.1 introduces LAPACK_FORTRAN_STRLEN_END and modifies (through preprocessing) the declarations of the following functions used in opencv
```

Review comment:
> LAPACK_FUNC Please use `OPENCV_` / `OCV_` prefix.
**File:** cmake/OpenCVFindLAPACK.cmake
**Change Type:** modified
**Context:** PR #21114: Fix compile against lapack-3.10.0 - part 1

**Code Changes:**
```diff
@@ -51,6 +51,23 @@ macro(ocv_lapack_check)
     if(NOT "${OPENCV_CBLAS_H_PATH_${_lapack_impl}}" STREQUAL "${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}")
       list(APPEND _lapack_content "#include \"${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}\"")
     endif()
+    list(APPEND _lapack_content "
+#if defined(LAPACK_GLOBAL) || defined(LAPACK_NAME)
+/*
+ * Using netlib's reference LAPACK implementation version >= 3.4.0 (first with C interface).
+ * Use LAPACK_xxxx to transparently (via predefined lapack macros) deal with pre and post 3.9.1 versions.
+ * LAPACK 3.9.1 introduces LAPACK_FORTRAN_STRLEN_END and modifies (through preprocessing) the declarations of the following functions used in opencv
```

Review comment:
`-DOPENCV_USE_LAPACK_PREFIX=LAPACK_` It makes sense to define prefix in CMake. --- Moreover, we don't need global compiler definition at all. It is a generated file. So generate this content through CMake conditions.
**File:** cmake/OpenCVFindLAPACK.cmake
**Change Type:** modified
**Context:** PR #21114: Fix compile against lapack-3.10.0 - part 1

**Code Changes:**
```diff
@@ -51,6 +51,23 @@ macro(ocv_lapack_check)
     if(NOT "${OPENCV_CBLAS_H_PATH_${_lapack_impl}}" STREQUAL "${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}")
       list(APPEND _lapack_content "#include \"${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}\"")
     endif()
+    list(APPEND _lapack_content "
+#if defined(LAPACK_GLOBAL) || defined(LAPACK_NAME)
+/*
+ * Using netlib's reference LAPACK implementation version >= 3.4.0 (first with C interface).
+ * Use LAPACK_xxxx to transparently (via predefined lapack macros) deal with pre and post 3.9.1 versions.
+ * LAPACK 3.9.1 introduces LAPACK_FORTRAN_STRLEN_END and modifies (through preprocessing) the declarations of the following functions used in opencv
```

Review comment:
I just use CONFIG so as to have access to LAPACK_VERSION. If I don't add CONFIG LAPACK_VERSION is undefined.
**File:** cmake/OpenCVFindLAPACK.cmake
**Change Type:** modified
**Context:** PR #21114: Fix compile against lapack-3.10.0 - part 1

**Code Changes:**
```diff
@@ -51,6 +51,23 @@ macro(ocv_lapack_check)
     if(NOT "${OPENCV_CBLAS_H_PATH_${_lapack_impl}}" STREQUAL "${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}")
       list(APPEND _lapack_content "#include \"${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}\"")
     endif()
+    list(APPEND _lapack_content "
+#if defined(LAPACK_GLOBAL) || defined(LAPACK_NAME)
+/*
+ * Using netlib's reference LAPACK implementation version >= 3.4.0 (first with C interface).
+ * Use LAPACK_xxxx to transparently (via predefined lapack macros) deal with pre and post 3.9.1 versions.
+ * LAPACK 3.9.1 introduces LAPACK_FORTRAN_STRLEN_END and modifies (through preprocessing) the declarations of the following functions used in opencv
```

Review comment:
Ok will remove the global alltogether and generate based in CMake conditions
**File:** samples/dnn/scene_text_recognition.cpp
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -0,0 +1,144 @@
+#include <iostream>
+#include <fstream>
+
+#include <opencv2/imgproc.hpp>
+#include <opencv2/highgui.hpp>
+#include <opencv2/dnn/dnn.hpp>
+
+using namespace cv;
+using namespace cv::dnn;
```

Review comment:
`decodeSeq[-1]` `-1` is illegal, maybe use `decodeSeq.back()` instead ?
**File:** samples/dnn/scene_text_detection.cpp
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -0,0 +1,151 @@
+#include <iostream>
+#include <fstream>
+#include <regex>
+
+#include <opencv2/imgproc.hpp>
+#include <opencv2/highgui.hpp>
+#include <opencv2/dnn/dnn.hpp>
+
+using namespace cv;
```

Review comment:
just curious -- is there a pretrained onnx model (link) ?
**File:** samples/dnn/scene_text_detection.cpp
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -0,0 +1,151 @@
+#include <iostream>
+#include <fstream>
+#include <regex>
+
+#include <opencv2/imgproc.hpp>
+#include <opencv2/highgui.hpp>
+#include <opencv2/dnn/dnn.hpp>
+
+using namespace cv;
```

Review comment:
Maybe I can upload models to Google Drive. I am not sure about it, and I will ask my mentor.
**File:** modules/dnn/test/test_model.cpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -110,6 +110,155 @@ class Test_Model : public DNNTestLayer
         model.segment(frame, mask);
         normAssert(mask, exp, "", norm, norm);
     }
+
+    void testTextRecognitionModel(const std::string& weights, const std::string& cfg,
+                                  const std::string& imgPath, const std::string& seq,
+                                  const std::string& decodeType, const std::vector<std::string>& vocabulary,
+                                  const Size& size = {-1, -1}, Scalar mean = Scalar(),
+                                  double scale = 1.0, bool swapRB = false, bool crop = false)
```

Review comment:
Where is this file?
**File:** modules/dnn/test/test_model.cpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -110,6 +110,155 @@ class Test_Model : public DNNTestLayer
         model.segment(frame, mask);
         normAssert(mask, exp, "", norm, norm);
     }
+
+    void testTextRecognitionModel(const std::string& weights, const std::string& cfg,
+                                  const std::string& imgPath, const std::string& seq,
+                                  const std::string& decodeType, const std::vector<std::string>& vocabulary,
+                                  const Size& size = {-1, -1}, Scalar mean = Scalar(),
+                                  double scale = 1.0, bool swapRB = false, bool crop = false)
```

Review comment:
Please push the new name. You don't need to wait the merge. See [this step](https://pullrequest.opencv.org/buildbot/builders/precommit_linux64/builds/26892/steps/Merge%20opencv_extra%20with%20test%20branch/logs/stdio) in the build pipeline.
**File:** samples/dnn/scene_text_detection.cpp
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition
**Review Line:** 88

**Code Changes:**
```diff
+        while (std::getline(testList, testImgPath)) {
+            String imgPath = evalDataPath + "/test_images/" + testImgPath;
+            std::cout << "Image Path: " << imgPath << std::endl;
+
+            Mat frame = imread(samples::findFile(imgPath), IMREAD_COLOR);
+            CV_Assert(!frame.empty());
+            Mat src = frame.clone();
+
+            // Inference
+            std::vector<std::vector<Point>> results;
+            detector.detect(frame, results);
```

Review comment:
You could use something like https://github.com/opencv/opencv/blob/73959fed4581556d8e6b770987c819adfacceb87/modules/video/perf/perf_bgfg_mog2.cpp#L30
**File:** samples/dnn/scene_text_detection.cpp
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition
**Review Line:** 88

**Code Changes:**
```diff
+        while (std::getline(testList, testImgPath)) {
+            String imgPath = evalDataPath + "/test_images/" + testImgPath;
+            std::cout << "Image Path: " << imgPath << std::endl;
+
+            Mat frame = imread(samples::findFile(imgPath), IMREAD_COLOR);
+            CV_Assert(!frame.empty());
+            Mat src = frame.clone();
+
+            // Inference
+            std::vector<std::vector<Point>> results;
+            detector.detect(frame, results);
```

Review comment:
Yes check only for test.
**File:** modules/dnn/test/test_model.cpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -110,6 +110,155 @@ class Test_Model : public DNNTestLayer
         model.segment(frame, mask);
         normAssert(mask, exp, "", norm, norm);
     }
+
+    void testTextRecognitionModel(const std::string& weights, const std::string& cfg,
+                                  const std::string& imgPath, const std::string& seq,
+                                  const std::string& decodeType, const std::vector<std::string>& vocabulary,
+                                  const Size& size = {-1, -1}, Scalar mean = Scalar(),
+                                  double scale = 1.0, bool swapRB = false, bool crop = false)
```

Review comment:
> I still get an error in "Linux x64 Debug", but I find that the test_dnn in "Linux x64" passed. I am not sure about the difference between these two tests. Obviously, it is "Debug" mode (with extra checks).
**File:** doc/tutorials/dnn/dnn_text_spotting/dnn_text_spotting.markdown
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -0,0 +1,316 @@
+# High Level API: TextDetectionModel and TextRecognitionModel {#tutorial_dnn_text_spotting}
+
+@prev_tutorial{tutorial_dnn_OCR}
+
+## Introduction
+In this tutorial, we will introduce the APIs for TextRecognitionModel and TextDetectionModel in detail.
+
+---
+#### TextRecognitionModel:
```

Review comment:
Create standalone .cpp file for example code and embed snippets into documentation only. You can adopt sample file below or create new one.
**File:** doc/tutorials/dnn/dnn_text_spotting/dnn_text_spotting.markdown
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -0,0 +1,316 @@
+# High Level API: TextDetectionModel and TextRecognitionModel {#tutorial_dnn_text_spotting}
+
+@prev_tutorial{tutorial_dnn_OCR}
+
+## Introduction
+In this tutorial, we will introduce the APIs for TextRecognitionModel and TextDetectionModel in detail.
+
+---
+#### TextRecognitionModel:
```

Review comment:
> 1 Avoid magic numbers. `IMREAD_COLOR`
**File:** doc/tutorials/dnn/dnn_text_spotting/dnn_text_spotting.markdown
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -0,0 +1,316 @@
+# High Level API: TextDetectionModel and TextRecognitionModel {#tutorial_dnn_text_spotting}
+
+@prev_tutorial{tutorial_dnn_OCR}
+
+## Introduction
+In this tutorial, we will introduce the APIs for TextRecognitionModel and TextDetectionModel in detail.
+
+---
+#### TextRecognitionModel:
```

Review comment:
`127.5, 0, 0, 0` or `127.5, 127.5, 127.5, 127.5` ?
**File:** doc/tutorials/dnn/dnn_text_spotting/dnn_text_spotting.markdown
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -0,0 +1,316 @@
+# High Level API: TextDetectionModel and TextRecognitionModel {#tutorial_dnn_text_spotting}
+
+@prev_tutorial{tutorial_dnn_OCR}
+
+## Introduction
+In this tutorial, we will introduce the APIs for TextRecognitionModel and TextDetectionModel in detail.
+
+---
+#### TextRecognitionModel:
```

Review comment:
External links on images are not allowed. Make image as a part of documentation tree instead (but please avoid adding images with bad license terms)
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -1309,6 +1309,255 @@ CV__DNN_INLINE_NS_BEGIN
                              float confThreshold = 0.5f, float nmsThreshold = 0.0f);
      };
 
+
+/** @brief This class represents high-level API for text recognition networks.
+ *
+ * TextRecognitionModel allows to set params for preprocessing input image.
+ * TextRecognitionModel creates net from file with trained weights and config,
+ * sets preprocessing input, runs forward pass and return recognition result.
```

Review comment:
Exposing of private API is not allowed in OpenCV Public headers. You can use PImpl pattern with static `create()` or static local functions.
**File:** doc/tutorials/dnn/dnn_text_spotting/dnn_text_spotting.markdown
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -0,0 +1,316 @@
+# High Level API: TextDetectionModel and TextRecognitionModel {#tutorial_dnn_text_spotting}
+
+@prev_tutorial{tutorial_dnn_OCR}
+
+## Introduction
+In this tutorial, we will introduce the APIs for TextRecognitionModel and TextDetectionModel in detail.
+
+---
+#### TextRecognitionModel:
```

Review comment:
I am not sure about your confusion here. When I specify the `mean` parameter to `Scalar(127.5)`, all the values of the input image will subtract the mean (127.5) in the normalization step.
**File:** samples/dnn/scene_text_detection.cpp
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -0,0 +1,151 @@
+#include <iostream>
+#include <fstream>
+#include <regex>
+
+#include <opencv2/imgproc.hpp>
+#include <opencv2/highgui.hpp>
+#include <opencv2/dnn/dnn.hpp>
+
+using namespace cv;
```

Review comment:
> 1 Please avoid using of magic numbers. Use `IMREAD_COLOR` instead.
**File:** samples/dnn/scene_text_detection.cpp
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -0,0 +1,151 @@
+#include <iostream>
+#include <fstream>
+#include <regex>
+
+#include <opencv2/imgproc.hpp>
+#include <opencv2/highgui.hpp>
+#include <opencv2/dnn/dnn.hpp>
+
+using namespace cv;
```

Review comment:
Please use `samples::findFile()` for better file searching experience.
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -1309,6 +1309,255 @@ CV__DNN_INLINE_NS_BEGIN
                              float confThreshold = 0.5f, float nmsThreshold = 0.0f);
      };
 
+
+/** @brief This class represents high-level API for text recognition networks.
+ *
+ * TextRecognitionModel allows to set params for preprocessing input image.
+ * TextRecognitionModel creates net from file with trained weights and config,
+ * sets preprocessing input, runs forward pass and return recognition result.
```

Review comment:
Which are possible values?
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -1309,6 +1309,255 @@ CV__DNN_INLINE_NS_BEGIN
                              float confThreshold = 0.5f, float nmsThreshold = 0.0f);
      };
 
+
+/** @brief This class represents high-level API for text recognition networks.
+ *
+ * TextRecognitionModel allows to set params for preprocessing input image.
+ * TextRecognitionModel creates net from file with trained weights and config,
+ * sets preprocessing input, runs forward pass and return recognition result.
```

Review comment:
Why we need to limit this number?
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -1309,6 +1309,255 @@ CV__DNN_INLINE_NS_BEGIN
                              float confThreshold = 0.5f, float nmsThreshold = 0.0f);
      };
 
+
+/** @brief This class represents high-level API for text recognition networks.
+ *
+ * TextRecognitionModel allows to set params for preprocessing input image.
+ * TextRecognitionModel creates net from file with trained weights and config,
+ * sets preprocessing input, runs forward pass and return recognition result.
```

Review comment:
What does unclip ratio?
**File:** modules/dnn/test/test_model.cpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition
**Review Line:** 610

**Code Changes:**
```diff
+    // Detection algorithm parameters
+    float confThresh = 0.5;
+    float nmsThresh = 0.4;
+
+    testTextDetectionModelByEAST(weightPath, "", imgPath, gt, confThresh, nmsThresh, size, mean, scale, swapRB);
+}
+
 INSTANTIATE_TEST_CASE_P(/**/, Test_Model, dnnBackendsAndTargets());
 
 }} // namespace
```

Review comment:
Please test existing EAST model as well. Does it fit current API?
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -1309,6 +1309,255 @@ CV__DNN_INLINE_NS_BEGIN
                              float confThreshold = 0.5f, float nmsThreshold = 0.0f);
      };
 
+
+/** @brief This class represents high-level API for text recognition networks.
+ *
+ * TextRecognitionModel allows to set params for preprocessing input image.
+ * TextRecognitionModel creates net from file with trained weights and config,
+ * sets preprocessing input, runs forward pass and return recognition result.
```

Review comment:
No need to put vocabulary at recognition step. Add a method such `setVocabulary`
**File:** modules/dnn/test/test_model.cpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition
**Review Line:** 610

**Code Changes:**
```diff
+    // Detection algorithm parameters
+    float confThresh = 0.5;
+    float nmsThresh = 0.4;
+
+    testTextDetectionModelByEAST(weightPath, "", imgPath, gt, confThresh, nmsThresh, size, mean, scale, swapRB);
+}
+
 INSTANTIATE_TEST_CASE_P(/**/, Test_Model, dnnBackendsAndTargets());
 
 }} // namespace
```

Review comment:
https://github.com/opencv/opencv/blob/b45273eccb01323f5615b8900fd35407b1148939/modules/dnn/test/test_tf_importer.cpp#L817
**File:** samples/dnn/scene_text_spotting.cpp
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition
**Review Line:** 26

**Code Changes:**
```diff
+        "{ binaryThreshold bt               |0.3| Confidence threshold of the binary map. }"
+        "{ polygonThreshold pt              |0.5| Confidence threshold of polygons. }"
+        "{ maxCandidate max                 |200| Max candidates of polygons. }"
+        "{ unclipRatio ratio                |2.0| unclip ratio. }"
+        "{ vocabularyPath vp                | alphabet_36.txt | Path to benchmarks for evaluation. "
+            "Download links are provided in doc/tutorials/dnn/dnn_text_spotting/dnn_text_spotting.markdown}";
+
+void fourPointsTransform(const Mat& frame, const Point2f vertices[], Mat& result);
+bool sortPts(const Point& p1, const Point& p2);
+
+int main(int argc, char** argv)
```

Review comment:
Is that possible to rewrite https://github.com/opencv/opencv/blob/master/samples/dnn/text_detection.cpp instead? This way we can proof that new API is a good replacement for old approach.
**File:** doc/tutorials/dnn/dnn_text_spotting/dnn_text_spotting.markdown
**Change Type:** added
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -0,0 +1,316 @@
+# High Level API: TextDetectionModel and TextRecognitionModel {#tutorial_dnn_text_spotting}
+
+@prev_tutorial{tutorial_dnn_OCR}
+
+## Introduction
+In this tutorial, we will introduce the APIs for TextRecognitionModel and TextDetectionModel in detail.
+
+---
+#### TextRecognitionModel:
```

Review comment:
`Scalar(127.5)` only initializes the 1st element, so that would be (127.5, 0, 0, 0)
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -1309,6 +1309,255 @@ CV__DNN_INLINE_NS_BEGIN
                              float confThreshold = 0.5f, float nmsThreshold = 0.0f);
      };
 
+
+/** @brief This class represents high-level API for text recognition networks.
+ *
+ * TextRecognitionModel allows to set params for preprocessing input image.
+ * TextRecognitionModel creates net from file with trained weights and config,
+ * sets preprocessing input, runs forward pass and return recognition result.
```

Review comment:
It only supports "CTC-greedy" now, and I will add more decoding methods in the future, such as Beam Searching.
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -1309,6 +1309,255 @@ CV__DNN_INLINE_NS_BEGIN
                              float confThreshold = 0.5f, float nmsThreshold = 0.0f);
      };
 
+
+/** @brief This class represents high-level API for text recognition networks.
+ *
+ * TextRecognitionModel allows to set params for preprocessing input image.
+ * TextRecognitionModel creates net from file with trained weights and config,
+ * sets preprocessing input, runs forward pass and return recognition result.
```

Review comment:
We can get good detection results with these parameters, for more information you can refer to the [paper](https://arxiv.org/abs/1911.08947) and [code](https://github.com/MhLiao/DB).
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -1309,6 +1309,255 @@ CV__DNN_INLINE_NS_BEGIN
                              float confThreshold = 0.5f, float nmsThreshold = 0.0f);
      };
 
+
+/** @brief This class represents high-level API for text recognition networks.
+ *
+ * TextRecognitionModel allows to set params for preprocessing input image.
+ * TextRecognitionModel creates net from file with trained weights and config,
+ * sets preprocessing input, runs forward pass and return recognition result.
```

Review comment:
In some difficult cases, the output map of the network is full of small noise, and `maxCandidates` can avoid wasting inference time.
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #17570: [GSoC] High Level API and Samples for Scene Text Detection and Recognition

**Code Changes:**
```diff
@@ -1309,6 +1309,255 @@ CV__DNN_INLINE_NS_BEGIN
                              float confThreshold = 0.5f, float nmsThreshold = 0.0f);
      };
 
+
+/** @brief This class represents high-level API for text recognition networks.
+ *
+ * TextRecognitionModel allows to set params for preprocessing input image.
+ * TextRecognitionModel creates net from file with trained weights and config,
+ * sets preprocessing input, runs forward pass and return recognition result.
```

Review comment:
This detection method is to detect the kernel of each text instance, so we should "expand" the kernel into the final result by the 'unclipRatio'.