nareshmlx/opencv-pr huggingface dataset:
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
vector<Point2f> perspective_points = {};
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
they should be private or protected.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers
**Review Line:** 2657

**Code Changes:**
```diff
+                perspective_points.push_back({test_perspective_size, test_perspective_size});
+            }
+            Mat H = findHomography(object_points, perspective_points, RANSAC, ransacReprojThreshold);
+            if (H.empty())
+                return;
+            updatePerspective(H);
+            vector<Point2f> newCorner2 = {{test_perspective_size, test_perspective_size}};
+            perspectiveTransform(newCorner2, newCorner2, H.inv());
+            original_points[2] = newCorner2.front();
+        }
+    }
```

Review comment:
`findHomography` returns empty matrix if homography cannot be estimated. `updatePerspective` result is not checked and we stay with initial estimation. I propose to add it to comments.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers
**Review Line:** 2659

**Code Changes:**
```diff
+            Mat H = findHomography(object_points, perspective_points, RANSAC, ransacReprojThreshold);
+            if (H.empty())
+                return;
+            updatePerspective(H);
+            vector<Point2f> newCorner2 = {{test_perspective_size, test_perspective_size}};
+            perspectiveTransform(newCorner2, newCorner2, H.inv());
+            original_points[2] = newCorner2.front();
+        }
+    }
+}
+
```

Review comment:
`H` may be empty as I mentioned before.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
Looks like the check is redundant. In case if the points have wrong topology, the next findHomography returns empty matrix as expected.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
Are you sure that you need to break internal state if `qrdec[i]`? Is it used in the next steps? Most probably, you just need to scale the result in the next `if` block?
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
`src_points.size()` is known. It makes sense to use resize()
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
`qrCorners`, `alignmentMarkers` are not public API `getter` will be unnecessary in my opinion In public API `qrCorners` return from `QRCodeDetector` by `getQRCorners()`
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
``` static uint8_t alignmentMarker[25] = { 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 255, 0, 255, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0 }; Mat resizedAlignmentMarker(5, 5, CV_8UC1, alignmentMarker); const float module_size = test_perspective_size / version_size; resize(resizedAlignmentMarker, resizedAlignmentMarker, Size(cvRound(module_size * 5.f), cvRound(module_size * 5.f)), 0, 0, INTER_AREA); ``` `static uint8_t alignmentMarker[25]` cannot be corrupted during resize. New memory will be allocated for the `resizedAlignmentMarker`.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
in-place `resize` doesn't make sense (as it is not a in-place operation) and should not be used in this way due to its inefficiency (`src` is usually cloned before processing).
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -760,6 +760,12 @@ class CV_EXPORTS_W QRCodeDetector
      */
     CV_WRAP void setEpsY(double epsY);
 
+    /** @brief use markers to improve the position of the corners of the QR code
+     *
+     * alignmentMarkers using by default
+     */
+    CV_WRAP void setUseAlignmentMarkers(bool useAlignmentMarkers);
+
```

Review comment:
It's ugly solution. Let's return refined corners with `detectAndDecode` and `detectAndDecodeMulti` as optional output.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
> lround not used in OpenCV.
**File:** modules/objdetect/test/test_qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -32,6 +32,7 @@ std::string qrcode_images_multiple[] = {
   "2_qrcodes.png", "3_close_qrcodes.png", "3_qrcodes.png", "4_qrcodes.png",
   "5_qrcodes.png", "6_qrcodes.png", "7_qrcodes.png", "8_close_qrcodes.png"
 };
+
 //#define UPDATE_QRCODE_TEST_DATA
 #ifdef  UPDATE_QRCODE_TEST_DATA
 
@@ -501,7 +502,7 @@ TEST_P(Objdetect_QRCode_Multi, regression)
 {
```

Review comment:
Some test cases are disabled (so it is formally a regression).
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
> `#include <iostream>` Should not be used in opencv modules. Use logger instead.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
In "for" loops it should be DEBUG. Other cases are likely DEBUG too.
**File:** modules/objdetect/test/test_qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -32,6 +32,7 @@ std::string qrcode_images_multiple[] = {
   "2_qrcodes.png", "3_close_qrcodes.png", "3_qrcodes.png", "4_qrcodes.png",
   "5_qrcodes.png", "6_qrcodes.png", "7_qrcodes.png", "8_close_qrcodes.png"
 };
+
 //#define UPDATE_QRCODE_TEST_DATA
 #ifdef  UPDATE_QRCODE_TEST_DATA
 
@@ -501,7 +502,7 @@ TEST_P(Objdetect_QRCode_Multi, regression)
 {
```

Review comment:
Again, wrong order.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
change `lround` to `cvRound`
**File:** modules/objdetect/test/test_qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -32,6 +32,7 @@ std::string qrcode_images_multiple[] = {
   "2_qrcodes.png", "3_close_qrcodes.png", "3_qrcodes.png", "4_qrcodes.png",
   "5_qrcodes.png", "6_qrcodes.png", "7_qrcodes.png", "8_close_qrcodes.png"
 };
+
 //#define UPDATE_QRCODE_TEST_DATA
 #ifdef  UPDATE_QRCODE_TEST_DATA
 
@@ -501,7 +502,7 @@ TEST_P(Objdetect_QRCode_Multi, regression)
 {
```

Review comment:
fixing regression
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
removed `<iostream>`
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
change `CV_LOG_INFO` to `CV_LOG_DEBUG`
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers

**Code Changes:**
```diff
@@ -23,6 +23,7 @@
 namespace cv
 {
 using std::vector;
+using std::pair;
 
 static bool checkQRInputImage(InputArray img, Mat& gray)
 {
@@ -948,16 +949,21 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
     return result_angle_list;
```

Review comment:
`intervals` is well known. It makes sense to define it as `vector<int> coordinates(intervals);` and do not use `push_back`
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers
**Review Line:** 2606

**Code Changes:**
```diff
     return true;
 }
 
+void QRDecode::detectAlignment() {
+    vector<pair<int, int>> alignmentPositions = getAlignmentCoordinates(version);
+    if (alignmentPositions.size() > 0) {
+        vector<Point2f> perspective_points = {{0.f, 0.f}, {test_perspective_size, 0.f}, {0.f, test_perspective_size}};
+        vector<Point2f> object_points = {original_points[0], original_points[1], original_points[3]};
+
+        // create alignment image
+        static uint8_t alignmentMarker[25] = {
```

Review comment:
`getAlignmentCoordinates()` always returns non-empty vector. At least ` {std::make_pair(coordinates.back(), coordinates.back())};` Right?
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers
**Review Line:** 2606

**Code Changes:**
```diff
     return true;
 }
 
+void QRDecode::detectAlignment() {
+    vector<pair<int, int>> alignmentPositions = getAlignmentCoordinates(version);
+    if (alignmentPositions.size() > 0) {
+        vector<Point2f> perspective_points = {{0.f, 0.f}, {test_perspective_size, 0.f}, {0.f, test_perspective_size}};
+        vector<Point2f> object_points = {original_points[0], original_points[1], original_points[3]};
+
+        // create alignment image
+        static uint8_t alignmentMarker[25] = {
```

Review comment:
Non-empty vector only for versions 2+ ``` static inline vector<pair<int, int>> getAlignmentCoordinates(int version) { if (version <= 1) return {}; ```
**File:** modules/objdetect/perf/perf_qrcode_pipeline.cpp
**Change Type:** modified
**Context:** PR #22891: Use QR code alignment markers
**Review Line:** 117

**Code Changes:**
```diff
@@ -114,7 +114,6 @@ PERF_TEST_P_(Perf_Objdetect_QRCode_Multi, decodeMulti)
         straight_barcode_sort.push_back(result[i].second);
     }
     SANITY_CHECK(decoded_info_sort);
-    SANITY_CHECK(straight_barcode_sort);
 }
 #endif
 
```

Review comment:
Some problem in `4_qrcodes.png`, `8_close_qrcodes.png` This QRs correctly decoded, but there is no bitwise equality in straight_barcode and golds. I think this is an optional check. A successful decode should mean that the test has passed.
**File:** cmake/OpenCVCompilerOptimizations.cmake
**Change Type:** modified
**Context:** PR #22928: cmake: fix RISC-V toolchains - - RVV options are moved to configuration scripts instead of toolchains ``` cmake ... -DCPU_BASELINE=RVV ``` ...

**Code Changes:**
```diff
@@ -20,6 +20,9 @@
 # VSX  (always available on Power8)
 # VSX3 (always available on Power9)
 
+# RISC-V arch:
+# RVV
+
 # CPU_{opt}_SUPPORTED=ON/OFF - compiler support (possibly with additional flag)
 # CPU_{opt}_IMPLIES=<list>
 # CPU_{opt}_FORCE=<list> - subset of "implies" list
```

Review comment:
```suggestion ocv_update(CPU_RVV_FLAGS_ON "-march=rv64gcv") if(RISCV_RVV_SCALABLE) set(CPU_RVV_FLAGS_ON "${CPU_RVV_FLAGS_ON} -DCV_RVV_SCALABLE" CACHE INTERNAL "") endif() ``` This way user won't forget to add `CV_RVV_SCALABLE` definition if they set custom `CPU_RVV_FLAGS_ON` line.
**File:** cmake/OpenCVCompilerOptimizations.cmake
**Change Type:** modified
**Context:** PR #22928: cmake: fix RISC-V toolchains - - RVV options are moved to configuration scripts instead of toolchains ``` cmake ... -DCPU_BASELINE=RVV ``` ...

**Code Changes:**
```diff
@@ -20,6 +20,9 @@
 # VSX  (always available on Power8)
 # VSX3 (always available on Power9)
 
+# RISC-V arch:
+# RVV
+
 # CPU_{opt}_SUPPORTED=ON/OFF - compiler support (possibly with additional flag)
 # CPU_{opt}_IMPLIES=<list>
 # CPU_{opt}_FORCE=<list> - subset of "implies" list
```

Review comment:
Got it. I will check if we really need `CACHE INTERNAL` here tomorrow.
**File:** modules/videoio/src/cap_ffmpeg_legacy_api.hpp
**Change Type:** modified
**Context:** PR #22894: videoio/FFmpeg: added CV_16UC1 read/write support - Partially resolves #10623 Replaces #12284 and #12290 * _VideoCapture_: we can now disab...

**Code Changes:**
```diff
@@ -31,6 +31,8 @@ OPENCV_FFMPEG_API double cvGetCaptureProperty_FFMPEG(struct CvCapture_FFMPEG* ca
 OPENCV_FFMPEG_API int cvGrabFrame_FFMPEG(struct CvCapture_FFMPEG* cap);
 OPENCV_FFMPEG_API int cvRetrieveFrame_FFMPEG(struct CvCapture_FFMPEG* capture, unsigned char** data,
                                              int* step, int* width, int* height, int* cn);
+OPENCV_FFMPEG_API int cvRetrieveFrame2_FFMPEG(struct CvCapture_FFMPEG* capture, unsigned char** data,
+                                              int* step, int* width, int* height, int* cn, int* depth);
 OPENCV_FFMPEG_API void cvReleaseCapture_FFMPEG(struct CvCapture_FFMPEG** cap);
 
 OPENCV_FFMPEG_API struct CvVideoWriter_FFMPEG* cvCreateVideoWriter_FFMPEG(const char* filename,
```

Review comment:
AFAIK, it is a public API. We should not modify existed functions.
**File:** modules/videoio/src/cap_ffmpeg_impl.hpp
**Change Type:** modified
**Context:** PR #22894: videoio/FFmpeg: added CV_16UC1 read/write support - Partially resolves #10623 Replaces #12284 and #12290 * _VideoCapture_: we can now disab...

**Code Changes:**
```diff
@@ -414,7 +414,6 @@ struct Image_FFMPEG
     int step;
     int width;
     int height;
-    int cn;
 };
 
 
@@ -556,7 +555,7 @@ struct CvCapture_FFMPEG
     double getProperty(int) const;
```

Review comment:
> deptth typo
**File:** modules/videoio/src/cap_ffmpeg_legacy_api.hpp
**Change Type:** modified
**Context:** PR #22894: videoio/FFmpeg: added CV_16UC1 read/write support - Partially resolves #10623 Replaces #12284 and #12290 * _VideoCapture_: we can now disab...

**Code Changes:**
```diff
@@ -31,6 +31,8 @@ OPENCV_FFMPEG_API double cvGetCaptureProperty_FFMPEG(struct CvCapture_FFMPEG* ca
 OPENCV_FFMPEG_API int cvGrabFrame_FFMPEG(struct CvCapture_FFMPEG* cap);
 OPENCV_FFMPEG_API int cvRetrieveFrame_FFMPEG(struct CvCapture_FFMPEG* capture, unsigned char** data,
                                              int* step, int* width, int* height, int* cn);
+OPENCV_FFMPEG_API int cvRetrieveFrame2_FFMPEG(struct CvCapture_FFMPEG* capture, unsigned char** data,
+                                              int* step, int* width, int* height, int* cn, int* depth);
 OPENCV_FFMPEG_API void cvReleaseCapture_FFMPEG(struct CvCapture_FFMPEG** cap);
 
 OPENCV_FFMPEG_API struct CvVideoWriter_FFMPEG* cvCreateVideoWriter_FFMPEG(const char* filename,
```

Review comment:
I thought we've switched to the new plugin API in the FFmpeg plugin? Is it possible, what do you think?
**File:** modules/videoio/src/cap_ffmpeg_legacy_api.hpp
**Change Type:** modified
**Context:** PR #22894: videoio/FFmpeg: added CV_16UC1 read/write support - Partially resolves #10623 Replaces #12284 and #12290 * _VideoCapture_: we can now disab...

**Code Changes:**
```diff
@@ -31,6 +31,8 @@ OPENCV_FFMPEG_API double cvGetCaptureProperty_FFMPEG(struct CvCapture_FFMPEG* ca
 OPENCV_FFMPEG_API int cvGrabFrame_FFMPEG(struct CvCapture_FFMPEG* cap);
 OPENCV_FFMPEG_API int cvRetrieveFrame_FFMPEG(struct CvCapture_FFMPEG* capture, unsigned char** data,
                                              int* step, int* width, int* height, int* cn);
+OPENCV_FFMPEG_API int cvRetrieveFrame2_FFMPEG(struct CvCapture_FFMPEG* capture, unsigned char** data,
+                                              int* step, int* width, int* height, int* cn, int* depth);
 OPENCV_FFMPEG_API void cvReleaseCapture_FFMPEG(struct CvCapture_FFMPEG** cap);
 
 OPENCV_FFMPEG_API struct CvVideoWriter_FFMPEG* cvCreateVideoWriter_FFMPEG(const char* filename,
```

Review comment:
These functions are still exported. These functions are deprecated and they will to be removed in 5.x. So no need trying to modify it.
**File:** modules/videoio/src/cap_ffmpeg_legacy_api.hpp
**Change Type:** modified
**Context:** PR #22894: videoio/FFmpeg: added CV_16UC1 read/write support - Partially resolves #10623 Replaces #12284 and #12290 * _VideoCapture_: we can now disab...

**Code Changes:**
```diff
@@ -31,6 +31,8 @@ OPENCV_FFMPEG_API double cvGetCaptureProperty_FFMPEG(struct CvCapture_FFMPEG* ca
 OPENCV_FFMPEG_API int cvGrabFrame_FFMPEG(struct CvCapture_FFMPEG* cap);
 OPENCV_FFMPEG_API int cvRetrieveFrame_FFMPEG(struct CvCapture_FFMPEG* capture, unsigned char** data,
                                              int* step, int* width, int* height, int* cn);
+OPENCV_FFMPEG_API int cvRetrieveFrame2_FFMPEG(struct CvCapture_FFMPEG* capture, unsigned char** data,
+                                              int* step, int* width, int* height, int* cn, int* depth);
 OPENCV_FFMPEG_API void cvReleaseCapture_FFMPEG(struct CvCapture_FFMPEG** cap);
 
 OPENCV_FFMPEG_API struct CvVideoWriter_FFMPEG* cvCreateVideoWriter_FFMPEG(const char* filename,
```

Review comment:
I've added a new function.
**File:** modules/core/src/logger.cpp
**Change Type:** modified
**Context:** PR #22924: core(logger): strip opencv's modules base path - - Strip path from logger, keep file name only. - Reverted `CV_Error()` changes.

**Code Changes:**
```diff
@@ -233,24 +233,42 @@ void writeLogMessage(LogLevel logLevel, const char* message)
         (*out) << std::flush;
 }
 
+static const char* stripSourceFilePathPrefix(const char* file)
+{
+    CV_Assert(file);
+    const char* pos = file;
+    const char* strip_pos = NULL;
+    char ch = 0;
```

Review comment:
What if we use C for this function? Something like: const char * pos = std::max(strrchr(file, '/'), strrchr(file, '\\')); if (!pos) return file; return pos + 1; It will be inlined and evaluated at compile time unlike C++ (https://godbolt.org/z/8dxj8j46x).
**File:** modules/core/src/logger.cpp
**Change Type:** modified
**Context:** PR #22924: core(logger): strip opencv's modules base path - - Strip path from logger, keep file name only. - Reverted `CV_Error()` changes.

**Code Changes:**
```diff
@@ -233,24 +233,42 @@ void writeLogMessage(LogLevel logLevel, const char* message)
         (*out) << std::flush;
 }
 
+static const char* stripSourceFilePathPrefix(const char* file)
+{
+    CV_Assert(file);
+    const char* pos = file;
+    const char* strip_pos = NULL;
+    char ch = 0;
```

Review comment:
Replaced C++ verbose code.
**File:** modules/core/src/logger.cpp
**Change Type:** modified
**Context:** PR #22924: core(logger): strip opencv's modules base path - - Strip path from logger, keep file name only. - Reverted `CV_Error()` changes.

**Code Changes:**
```diff
@@ -233,24 +233,42 @@ void writeLogMessage(LogLevel logLevel, const char* message)
         (*out) << std::flush;
 }
 
+static const char* stripSourceFilePathPrefix(const char* file)
+{
+    CV_Assert(file);
+    const char* pos = file;
+    const char* strip_pos = NULL;
+    char ch = 0;
```

Review comment:
Interesting, for some reason only clang (5+) is able to evaluate this function at compile time, even the latest GCC adds an inlined function call: https://godbolt.org/z/v8PE7K85h While the variant with `strrchr` is consistently replaced with a precomputed pointer by older compilers such as GCC 4.6.4 and clang 3.6. Also I just thought that in order to enable compile time evaluation we need to directly wrap `__FILE__` macro here: https://github.com/opencv/opencv/blob/ab912329b67d3a142a1b399b4bc9fa9b68cd8df6/modules/core/include/opencv2/core/utils/logger.hpp#L122 On the other hand if we do so then in builds without optimization (`-O0`) each log message will add this function call. Perhaps I'm digging too deep here and the simple readable code is fine in the end.
**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:
minMaxLoc can be used instead.