nareshmlx/opencv-pr huggingface dataset:
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
I propose to split the structure on two: - TrackerConfig. Place fields like `exemplarSize`, `instanceSize`, etc. They control the tracker behavior, but do not change during the tracker lifetime. It should be public to give opportunity for customization. - TrackerState. `tracking_score`, `targetPos`. It's internal tracker state and should stay private.
**File:** modules/video/include/opencv2/video/tracking.hpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module
**Review Line:** 867

**Code Changes:**
```diff
+protected:
+    TrackerNano();  // use ::create()
+public:
+    virtual ~TrackerNano() CV_OVERRIDE;
+
+    struct CV_EXPORTS_W_SIMPLE Params
+    {
+        CV_WRAP Params();
+        CV_PROP_RW std::string backbone;
+        CV_PROP_RW std::string neckhead;
+        CV_PROP_RW int backend;
```

Review comment:
I propose to name it `DnnParams`. There are other tracker options besides DNN part.
**File:** modules/video/include/opencv2/video/tracking.hpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module
**Review Line:** 867

**Code Changes:**
```diff
+protected:
+    TrackerNano();  // use ::create()
+public:
+    virtual ~TrackerNano() CV_OVERRIDE;
+
+    struct CV_EXPORTS_W_SIMPLE Params
+    {
+        CV_WRAP Params();
+        CV_PROP_RW std::string backbone;
+        CV_PROP_RW std::string neckhead;
+        CV_PROP_RW int backend;
```

Review comment:
I think the `Params` is enough since the `Parmas` is belong to the `TrackerNano` class. And user can only create `Params` with the following code: C++: ``` cv::TrackerNano::Params params; ``` Python: ``` nanoTrackParam = cv2.TrackerNano_Params() ```
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
Maybe the function name is confusing. The original python code is following: ```.py r = np.maximum(r, 1. / r) # r is matrix ``` It is in-place and elementwise maximum for each element and 1/(element value).
**File:** modules/video/include/opencv2/video/tracking.hpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module
**Review Line:** 867

**Code Changes:**
```diff
+protected:
+    TrackerNano();  // use ::create()
+public:
+    virtual ~TrackerNano() CV_OVERRIDE;
+
+    struct CV_EXPORTS_W_SIMPLE Params
+    {
+        CV_WRAP Params();
+        CV_PROP_RW std::string backbone;
+        CV_PROP_RW std::string neckhead;
+        CV_PROP_RW int backend;
```

Review comment:
"Dnn" suffix is needed, if other tracker parameters are exposed as discussed above.
**File:** modules/video/include/opencv2/video/tracking.hpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module
**Review Line:** 867

**Code Changes:**
```diff
+protected:
+    TrackerNano();  // use ::create()
+public:
+    virtual ~TrackerNano() CV_OVERRIDE;
+
+    struct CV_EXPORTS_W_SIMPLE Params
+    {
+        CV_WRAP Params();
+        CV_PROP_RW std::string backbone;
+        CV_PROP_RW std::string neckhead;
+        CV_PROP_RW int backend;
```

Review comment:
Ok, should I change the `DasiamRPN` and other dnn based trackers from `Params` to `DnnParams`?
**File:** modules/video/include/opencv2/video/tracking.hpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module
**Review Line:** 867

**Code Changes:**
```diff
+protected:
+    TrackerNano();  // use ::create()
+public:
+    virtual ~TrackerNano() CV_OVERRIDE;
+
+    struct CV_EXPORTS_W_SIMPLE Params
+    {
+        CV_WRAP Params();
+        CV_PROP_RW std::string backbone;
+        CV_PROP_RW std::string neckhead;
+        CV_PROP_RW int backend;
```

Review comment:
Lets keep `Params` here (similar to other classes with nested parameters structure)
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
to use GOTURN -> to use Nano tracker the tracking module -> the video module
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
`CV_UNUSED(parameters);`
**File:** samples/python/tracker.py
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -9,6 +9,9 @@
     network:     https://www.dropbox.com/s/rr1lk9355vzolqv/dasiamrpn_model.onnx?dl=0
     kernel_r1:   https://www.dropbox.com/s/999cqx5zrfi7w4p/dasiamrpn_kernel_r1.onnx?dl=0
     kernel_cls1: https://www.dropbox.com/s/qvmtszx5h339a0w/dasiamrpn_kernel_cls1.onnx?dl=0
+For NanoTrack:
+    nanotrack_backbone: https://github.com/HonglinChu/SiamTrackers/blob/master/NanoTrack/models/onnx/nanotrack_backbone_sim.onnx
+    nanotrack_headneck: https://github.com/HonglinChu/SiamTrackers/blob/master/NanoTrack/models/onnx/nanotrack_head_sim.onnx
 
 USAGE:
     tracker.py [-h] [--input INPUT] [--tracker_algo TRACKER_ALGO]
```

Review comment:
> /Users/zihao/work/job_py/nanotrack Local absolute paths are not allowed. They are useless on other machines. Use just `nanotrack_backbone_sim.onnx` with details from the file header.
**File:** modules/video/test/test_trackers.cpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -64,40 +64,67 @@ TEST_P(DistanceAndOverlap, GOTURN)
 
 INSTANTIATE_TEST_CASE_P(Tracking, DistanceAndOverlap, TESTSET_NAMES);
 
-TEST(GOTURN, memory_usage)
+static bool checkIOU(const Rect& r0, const Rect& r1, double threshold)
 {
-    cv::Rect roi(145, 70, 85, 85);
+    int interArea = (r0 & r1).area();
+    double iouVal = (interArea * 1.0 )/ (r0.area() + r1.area() - interArea);;
```

Review comment:
the test check nothing actually, because `update()` always return true in current implementation. It makes sense to record bboxes for first 15 frames and check the result against them as regression test.
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
`./` are redundant and may be confusing on Windows.
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
Also please add Python test to ensure that the default constructor is properly invoked.
**File:** samples/dnn/nanotrack_tracker.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module
**Review Line:** 28

**Code Changes:**
```diff
+        "{ backend     | 0 | Choose one of computation backends: "
+                            "0: automatically (by default), "
+                            "1: Halide language (http://halide-lang.org/), "
+                            "2: Intel's Deep Learning Inference Engine (https://software.intel.com/openvino-toolkit), "
+                            "3: OpenCV implementation, "
+                            "4: VKCOM, "
+                            "5: CUDA },"
+        "{ target      | 0 | Choose one of target computation devices: "
+                            "0: CPU target (by default), "
+                            "1: OpenCL, "
+                            "2: OpenCL fp16 (half-float precision), "
```

Review comment:
It's better to name it Vulkan.
**File:** modules/video/test/test_trackers.cpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -64,40 +64,67 @@ TEST_P(DistanceAndOverlap, GOTURN)
 
 INSTANTIATE_TEST_CASE_P(Tracking, DistanceAndOverlap, TESTSET_NAMES);
 
-TEST(GOTURN, memory_usage)
+static bool checkIOU(const Rect& r0, const Rect& r1, double threshold)
 {
-    cv::Rect roi(145, 70, 85, 85);
+    int interArea = (r0 & r1).area();
+    double iouVal = (interArea * 1.0 )/ (r0.area() + r1.area() - interArea);;
```

Review comment:
This part code is copied from the previous test case. Not sure if we should change this and the previous case. https://github.com/opencv/opencv/blob/4.x/modules/video/test/test_trackers.cpp#L97-L127
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
What if make it public?
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
Agree. In most of the cases, users should not edit this part. But sometime, users may need to adjust the model parameters within a certain range.
**File:** samples/dnn/nanotrack_tracker.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module
**Review Line:** 28

**Code Changes:**
```diff
+        "{ backend     | 0 | Choose one of computation backends: "
+                            "0: automatically (by default), "
+                            "1: Halide language (http://halide-lang.org/), "
+                            "2: Intel's Deep Learning Inference Engine (https://software.intel.com/openvino-toolkit), "
+                            "3: OpenCV implementation, "
+                            "4: VKCOM, "
+                            "5: CUDA },"
+        "{ target      | 0 | Choose one of target computation devices: "
+                            "0: CPU target (by default), "
+                            "1: OpenCL, "
+                            "2: OpenCL fp16 (half-float precision), "
```

Review comment:
I propose to keep `vkcom`, since OpenCV use the `vkcom` for backend and `vulkan` for target.
**File:** modules/video/test/test_trackers.cpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -64,40 +64,67 @@ TEST_P(DistanceAndOverlap, GOTURN)
 
 INSTANTIATE_TEST_CASE_P(Tracking, DistanceAndOverlap, TESTSET_NAMES);
 
-TEST(GOTURN, memory_usage)
+static bool checkIOU(const Rect& r0, const Rect& r1, double threshold)
 {
-    cv::Rect roi(145, 70, 85, 85);
+    int interArea = (r0 & r1).area();
+    double iouVal = (interArea * 1.0 )/ (r0.area() + r1.area() - interArea);;
```

Review comment:
Please add bbox check or some other evidence that tracker does what expected. Current test just check if it does not crash, bot nothing for results.
**File:** modules/video/test/test_trackers.cpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -64,40 +64,67 @@ TEST_P(DistanceAndOverlap, GOTURN)
 
 INSTANTIATE_TEST_CASE_P(Tracking, DistanceAndOverlap, TESTSET_NAMES);
 
-TEST(GOTURN, memory_usage)
+static bool checkIOU(const Rect& r0, const Rect& r1, double threshold)
 {
-    cv::Rect roi(145, 70, 85, 85);
+    int interArea = (r0 & r1).area();
+    double iouVal = (interArea * 1.0 )/ (r0.area() + r1.area() - interArea);;
```

Review comment:
I got your point. How about adding two or three images test cases, the first one for the template and other images for object searching?
**File:** modules/video/test/test_trackers.cpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -64,40 +64,67 @@ TEST_P(DistanceAndOverlap, GOTURN)
 
 INSTANTIATE_TEST_CASE_P(Tracking, DistanceAndOverlap, TESTSET_NAMES);
 
-TEST(GOTURN, memory_usage)
+static bool checkIOU(const Rect& r0, const Rect& r1, double threshold)
 {
-    cv::Rect roi(145, 70, 85, 85);
+    int interArea = (r0 & r1).area();
+    double iouVal = (interArea * 1.0 )/ (r0.area() + r1.area() - interArea);;
```

Review comment:
Sounds good to me, if the algorithm does not use Kaman filter or other geometrical assumptions.
**File:** modules/video/include/opencv2/video/tracking.hpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module
**Review Line:** 867

**Code Changes:**
```diff
+protected:
+    TrackerNano();  // use ::create()
+public:
+    virtual ~TrackerNano() CV_OVERRIDE;
+
+    struct CV_EXPORTS_W_SIMPLE Params
+    {
+        CV_WRAP Params();
+        CV_PROP_RW std::string backbone;
+        CV_PROP_RW std::string neckhead;
+        CV_PROP_RW int backend;
```

Review comment:
Some parameters are not allowed to be changed in `TrackingParams `, like `exemplarSize`, `instanceSize`, etc., otherwise, the model will collapse. I think the `Params` is enough.
**File:** modules/video/test/test_trackers.cpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -64,40 +64,67 @@ TEST_P(DistanceAndOverlap, GOTURN)
 
 INSTANTIATE_TEST_CASE_P(Tracking, DistanceAndOverlap, TESTSET_NAMES);
 
-TEST(GOTURN, memory_usage)
+static bool checkIOU(const Rect& r0, const Rect& r1, double threshold)
 {
-    cv::Rect roi(145, 70, 85, 85);
+    int interArea = (r0 & r1).area();
+    double iouVal = (interArea * 1.0 )/ (r0.area() + r1.area() - interArea);;
```

Review comment:
I propose to use array and simple loop instead of copy-paste.
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
cv::Mat::zeros() is redundant. `cv::copyMakeBorder` Fills the same area with new values.
**File:** modules/video/test/test_trackers.cpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -64,40 +64,67 @@ TEST_P(DistanceAndOverlap, GOTURN)
 
 INSTANTIATE_TEST_CASE_P(Tracking, DistanceAndOverlap, TESTSET_NAMES);
 
-TEST(GOTURN, memory_usage)
+static bool checkIOU(const Rect& r0, const Rect& r1, double threshold)
 {
-    cv::Rect roi(145, 70, 85, 85);
+    int interArea = (r0 & r1).area();
+    double iouVal = (interArea * 1.0 )/ (r0.area() + r1.area() - interArea);;
```

Review comment:
Looks like the test bellow is enough and `memory_usage` may be safely removed. It does not add value.
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
It looks like all fields besides `lr` are constants and are not modified in the code. It makes sense to make them `const` and add comments on the values source.
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
`lr` may be changed by user. Instead, the `exemplarSize ` and `instanceSize ` should be `const`.
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
I have removed the potential `const` value out from the `trackerConfig`.
**File:** samples/python/tracker.py
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -9,6 +9,9 @@
     network:     https://www.dropbox.com/s/rr1lk9355vzolqv/dasiamrpn_model.onnx?dl=0
     kernel_r1:   https://www.dropbox.com/s/999cqx5zrfi7w4p/dasiamrpn_kernel_r1.onnx?dl=0
     kernel_cls1: https://www.dropbox.com/s/qvmtszx5h339a0w/dasiamrpn_kernel_cls1.onnx?dl=0
+For NanoTrack:
+    nanotrack_backbone: https://github.com/HonglinChu/SiamTrackers/blob/master/NanoTrack/models/onnx/nanotrack_backbone_sim.onnx
+    nanotrack_headneck: https://github.com/HonglinChu/SiamTrackers/blob/master/NanoTrack/models/onnx/nanotrack_head_sim.onnx
 
 USAGE:
     tracker.py [-h] [--input INPUT] [--tracker_algo TRACKER_ALGO]
```

Review comment:
> backBone > headNeck Prefer all lowercase letters in parameters (like .cpp does)
**File:** modules/video/test/test_trackers.cpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -64,40 +64,67 @@ TEST_P(DistanceAndOverlap, GOTURN)
 
 INSTANTIATE_TEST_CASE_P(Tracking, DistanceAndOverlap, TESTSET_NAMES);
 
-TEST(GOTURN, memory_usage)
+static bool checkIOU(const Rect& r0, const Rect& r1, double threshold)
 {
-    cv::Rect roi(145, 70, 85, 85);
+    int interArea = (r0 & r1).area();
+    double iouVal = (interArea * 1.0 )/ (r0.area() + r1.area() - interArea);;
```

Review comment:
> `static void` Unnecessary double space
**File:** modules/video/test/test_trackers.cpp
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -64,40 +64,67 @@ TEST_P(DistanceAndOverlap, GOTURN)
 
 INSTANTIATE_TEST_CASE_P(Tracking, DistanceAndOverlap, TESTSET_NAMES);
 
-TEST(GOTURN, memory_usage)
+static bool checkIOU(const Rect& r0, const Rect& r1, double threshold)
 {
-    cv::Rect roi(145, 70, 85, 85);
+    int interArea = (r0 & r1).area();
+    double iouVal = (interArea * 1.0 )/ (r0.area() + r1.area() - interArea);;
```

Review comment:
It makes sense to avoid mess of C-style format strings and std::cout C++ approach.
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
> `left_pad ==0` coding style