instruction
stringclasses
9 values
input
stringlengths
279
5.47k
output
stringlengths
6
9.58k
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/src/window_framebuffer.cpp **Change Type:** added **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -0,0 +1,798 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// ...
replaced with the following code if (currentImg.empty()) { CV_LOG_WARNING(NULL, "UI: image is empty"); return; } CV_CheckEQ(currentImg.dims, 2, "UI: dims != 2"); Additionally fixed comparison in methods resize and move (lines 285, 299) if (!currentImg.empty()) { imshow(currentImg); }
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/src/window_framebuffer.cpp **Change Type:** added **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -0,0 +1,798 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// ...
After the "inplace transformations" fix, clone is not needed
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/src/window_framebuffer.hpp **Change Type:** added **Context:** PR #25661: Highgui backend on top of Framebuffer **Review Line:** 5 **Code Changes:** ```diff @@ -0,0 +1,135 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-l...
license added (the problem with the URL remains)
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/src/window_framebuffer.cpp **Change Type:** added **Context:** PR #25661: Highgui backend on top of Framebuffer **Review Line:** 7 **Code Changes:** ```diff +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://openc...
Please use the one with wrong URL for consistency. I hope we can fix the website to make redirect to https version later.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/src/window_framebuffer.cpp **Change Type:** added **Context:** PR #25661: Highgui backend on top of Framebuffer **Review Line:** 7 **Code Changes:** ```diff +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://openc...
license added
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** CMakeLists.txt **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -304,6 +304,10 @@ OCV_OPTION(WITH_GTK "Include GTK support" ON OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID VERIFY HAVE_G...
1. > HAVE_FRAMEBUFFER > HAVE_FRAMEBUFFER_XVFB Both are not set in CMake stripts. 2. > "YES" `HAVE_*` check should be used instead, see other cases. 3. Need to add report about XVFB option status.
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/CMakeLists.txt **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -49,6 +49,16 @@ list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${n set(OPENCV_HIGHGUI_BUILTIN_BACKEND "") +if(WITH_FRAMEBUFFER...
> FATAL_ERROR It is better to use `STATUS` message and emit the list of required pre-installed -dev packages.
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/CMakeLists.txt **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -49,6 +49,16 @@ list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${n set(OPENCV_HIGHGUI_BUILTIN_BACKEND "") +if(WITH_FRAMEBUFFER...
We prefer to minimize details in the module's CMake. Move this code to `cmake/detect_framebuffer.cmake` and use `add_backend`. `check_cxx_source_compiles` is not used in OpenCV code base. We prefer to use `try_compile()` instead.
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/CMakeLists.txt **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -49,6 +49,16 @@ list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${n set(OPENCV_HIGHGUI_BUILTIN_BACKEND "") +if(WITH_FRAMEBUFFER...
In which directory can I put the source code for try_compile() OpenCV/cmake/checks ?
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** CMakeLists.txt **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -304,6 +304,10 @@ OCV_OPTION(WITH_GTK "Include GTK support" ON OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID VERIFY HAVE_G...
1. The variables HAVE_FRAMEBUFFER and HAVE_FRAMEBUFFER_XVFB are set in modules/highgui/cmake/detect_framebuffer.cmake 2. 3. Added status explanation CMakeLists.txt (lines 1456-1470)
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/CMakeLists.txt **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -49,6 +49,16 @@ list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${n set(OPENCV_HIGHGUI_BUILTIN_BACKEND "") +if(WITH_FRAMEBUFFER...
Moved to modules/highgui/cmake/detect_framebuffer.cmake Replaced by STATUS
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/CMakeLists.txt **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -49,6 +49,16 @@ list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${n set(OPENCV_HIGHGUI_BUILTIN_BACKEND "") +if(WITH_FRAMEBUFFER...
Added check cmake/checks/framebuffer.cpp And try_compile() at modules/highgui/cmake/detect_framebuffer.cmake
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/cmake/init.cmake **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -39,6 +39,8 @@ endmacro() add_backend("gtk" WITH_GTK) add_backend("win32ui" WITH_WIN32UI) add_backend("wayland" WITH_WAYLAND) +add_backend("framebuffer" WIT...
Only one line is expected here.
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/cmake/detect_framebuffer.cmake **Change Type:** added **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -0,0 +1,14 @@ +# --- FB --- +set(HAVE_FRAMEBUFFER ON) +if(WITH_FRAMEBUFFER_XVFB) + try_compile(HAVE_FRAMEBUFFER_XVFB + "${CMAKE_CURRENT_BINARY_D...
Don't clear these vars.
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/cmake/detect_framebuffer.cmake **Change Type:** added **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -0,0 +1,14 @@ +# --- FB --- +set(HAVE_FRAMEBUFFER ON) +if(WITH_FRAMEBUFFER_XVFB) + try_compile(HAVE_FRAMEBUFFER_XVFB + "${CMAKE_CURRENT_BINARY_D...
WITH_FRAMEBUFFER is already checked in `add_backend()` macro.
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** CMakeLists.txt **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -304,6 +304,10 @@ OCV_OPTION(WITH_GTK "Include GTK support" ON OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID VERIFY HAVE_G...
No need to extra `if` blocks. Just take a look on the lines below this inserted code.
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/cmake/detect_framebuffer.cmake **Change Type:** added **Context:** PR #25661: Highgui backend on top of Framebuffer **Review Line:** 6 **Code Changes:** ```diff +# --- FB --- +set(HAVE_FRAMEBUFFER ON) +if(WITH_FRAMEBUFFER_XVFB) + try_compile(HAVE_FRAMEBUFFER_XVFB + "${CMAKE_CURRENT_BINARY...
add 4 spaces indentation for shifted parameters to keep code readable,
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** CMakeLists.txt **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -304,6 +304,10 @@ OCV_OPTION(WITH_GTK "Include GTK support" ON OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID VERIFY HAVE_G...
FRAMEBUFFER_XVFB is not a dedicated feature - it is a build variant of `FRAMEBUFFER`.
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/cmake/init.cmake **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -39,6 +39,8 @@ endmacro() add_backend("gtk" WITH_GTK) add_backend("win32ui" WITH_WIN32UI) add_backend("wayland" WITH_WAYLAND) +add_backend("framebuffer" WIT...
In our case, the user can have the value of two options WITH_FRAMEBUFFER AND WITH_FRAMEBUFFER_XVFB. By the condition below I am trying to avoid re-include: if(WITH_FRAMEBUFFER AND WITH_FRAMEBUFFER_XVFB) add_backend("framebuffer" WITH_FRAMEBUFFER) else() add_backend("framebuffer" WITH_FRAMEBUFFER) add_backend("framebuff...
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/cmake/detect_framebuffer.cmake **Change Type:** added **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -0,0 +1,14 @@ +# --- FB --- +set(HAVE_FRAMEBUFFER ON) +if(WITH_FRAMEBUFFER_XVFB) + try_compile(HAVE_FRAMEBUFFER_XVFB + "${CMAKE_CURRENT_BINARY_D...
As an example I looked at detect_win32ui.cmake detect_wayland.cmake detect_gtk.cmake All have a structure ocv_clear_vars(HAVE_WAYLAND_CLIENT HAVE_WAYLAND_CURSOR HAVE_XKBCOMMON HAVE_WAYLAND_PROTOCOLS HAVE_WAYLAND_EGL) if(WITH_WAYLAND) Do I need to change my file as per the comment?
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** CMakeLists.txt **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -304,6 +304,10 @@ OCV_OPTION(WITH_GTK "Include GTK support" ON OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID VERIFY HAVE_G...
WITH_FRAMEBUFFER_XVFB part of WITH_FRAMEBUFFER Each of the options can be specified separately. Do I need to change WITH_FRAMEBUFFER to ON if WITH_FRAMEBUFFER_XVFB=ON? How to do this correctly? For example, I can check and replace in modules/highgui/cmake/init.cmake
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/test/test_gui.cpp **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -148,7 +148,8 @@ static void Foo(int, void* counter) && !defined HAVE_WIN32UI \ && !defined HAVE_WAYLAND \ ) \ - || defined(__APPLE_...
`HAVE_FRAMEBUFFER_XVFB` is left here and on line 195.
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/CMakeLists.txt **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -49,6 +49,16 @@ list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${n set(OPENCV_HIGHGUI_BUILTIN_BACKEND "") +if(WITH_FRAMEBUFFER...
I think we can simplify this block: ```.cmake if(WITH_FRAMEBUFFER AND HAVE_FRAMEBUFFER) set(OPENCV_HIGHGUI_BUILTIN_BACKEND "FB") add_definitions(-DHAVE_FRAMEBUFFER) list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_framebuffer.cpp) list(APPEND highgui_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/window_framebuffer.hp...
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/cmake/detect_framebuffer.cmake **Change Type:** added **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -0,0 +1,14 @@ +# --- FB --- +set(HAVE_FRAMEBUFFER ON) +if(WITH_FRAMEBUFFER_XVFB) + try_compile(HAVE_FRAMEBUFFER_XVFB + "${CMAKE_CURRENT_BINARY_D...
```suggestion "Check virtual framebuffer - failed\n" ```
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/src/window_framebuffer.cpp **Change Type:** added **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -0,0 +1,798 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// ...
Perhaps these asserts are ambiguous, we already know that image has wrong number of channels, they can be replaced with a single `CV_Error`: ```suggestion CV_Error(cv::Error::StsBadArg, "Bad image: wrong number of channels"); ```
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/highgui/CMakeLists.txt **Change Type:** modified **Context:** PR #25661: Highgui backend on top of Framebuffer **Code Changes:** ```diff @@ -49,6 +49,16 @@ list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${n set(OPENCV_HIGHGUI_BUILTIN_BACKEND "") +if(WITH_FRAMEBUFFER...
code replaced
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** platforms/android/build_sdk.py **Change Type:** modified **Context:** PR #25746: Android SDK build script: HWAsan flags added for release mode **Code Changes:** ```diff @@ -267,10 +267,14 @@ def build_library(self, abi, do_install, no_media_ndk): cmake_vars['WITH_ANDROID_MEDIANDK'] = "OFF" ...
We should not touch generic CMake flags. Use `OPENCV_EXTRA_` flags instead: https://github.com/opencv/opencv/blob/4.10.0/cmake/OpenCVCompilerOptions.cmake#L402-L418 Also append them instead of override if they already exist (e.g. defined by config file).
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** platforms/android/build_sdk.py **Change Type:** modified **Context:** PR #25746: Android SDK build script: HWAsan flags added for release mode **Code Changes:** ```diff @@ -267,10 +267,14 @@ def build_library(self, abi, do_install, no_media_ndk): cmake_vars['WITH_ANDROID_MEDIANDK'] = "OFF" ...
> Also append them instead of override if they already exist (e.g. defined by config file).
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/dnn/test/test_int8_layers.cpp **Change Type:** modified **Context:** PR #25779: dnn: add DepthToSpace and SpaceToDepth **Code Changes:** ```diff @@ -509,6 +509,61 @@ TEST_P(Test_Int8_layers, Eltwise) testLayer("split_max", "ONNX", 0.004, 0.012); } +TEST_P(Test_Int8_layers, DepthSpaceOps) { + ...
Does difference look very huge? If I'm not mistaken, there is no calculations inside the operation, only transposition.
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/dnn/test/test_int8_layers.cpp **Change Type:** modified **Context:** PR #25779: dnn: add DepthToSpace and SpaceToDepth **Code Changes:** ```diff @@ -509,6 +509,61 @@ TEST_P(Test_Int8_layers, Eltwise) testLayer("split_max", "ONNX", 0.004, 0.012); } +TEST_P(Test_Int8_layers, DepthSpaceOps) { + ...
Yes, I know. Other test cases seem to be good though. Maybe skip it for TIM-VX backend until the current integrated version is updated and re-test.
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/dnn/test/test_int8_layers.cpp **Change Type:** modified **Context:** PR #25779: dnn: add DepthToSpace and SpaceToDepth **Code Changes:** ```diff @@ -509,6 +509,61 @@ TEST_P(Test_Int8_layers, Eltwise) testLayer("split_max", "ONNX", 0.004, 0.012); } +TEST_P(Test_Int8_layers, DepthSpaceOps) { + ...
Skip this test for now.
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/dnn/src/cuda4dnn/primitives/depth_space_ops.hpp **Change Type:** added **Context:** PR #25779: dnn: add DepthToSpace and SpaceToDepth **Review Line:** 60 **Code Changes:** ```diff + // Call reshape on input so that it has the correct shape for permutation + input.reshape(interna...
Could we get rid of `memcpy` here?
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/dnn/src/cuda4dnn/primitives/depth_space_ops.hpp **Change Type:** added **Context:** PR #25779: dnn: add DepthToSpace and SpaceToDepth **Review Line:** 60 **Code Changes:** ```diff + // Call reshape on input so that it has the correct shape for permutation + input.reshape(interna...
Technically we can, but we will have to make a custom copy of `kernels::permute` because it does not work with tensors of different ranks. https://github.com/opencv/opencv/blob/acd16e384fe6253fb082afe33539ede6506a98e1/modules/dnn/src/cuda/permute.cu#L136-L144
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/video/src/tracking/tracker_vit.cpp **Change Type:** modified **Context:** PR #25771: video: fix vittrack in the case where crop size grows until out-of-memory when the input is black **Code Changes:** ```diff @@ -24,15 +24,16 @@ TrackerVit::~TrackerVit() TrackerVit::Params::Params() { net = "v...
why not just `blobFromImageWithParams`?
You are an expert OpenCV code reviewer specializing in API design and compatibility. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/video/src/tracking/tracker_vit.cpp **Change Type:** modified **Context:** PR #25771: video: fix vittrack in the case where crop size grows until out-of-memory when the input is black **Code Changes:** ```diff @@ -24,15 +24,16 @@ TrackerVit::~TrackerVit() TrackerVit::Params::Params() { net = "v...
Good catch! I was not familiar with this API. Let me have a try with this.
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** platforms/android/build_sdk.py **Change Type:** modified **Context:** PR #25718: Android SDK build script: HWAsan support added **Review Line:** 273 **Code Changes:** ```diff + if self.hwasan and "arm64" in abi.name: + hwasan_flags = "-fno-omit-frame-pointer -fsanitize=hwaddress" + ...
Why "debug" only?
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
**File:** platforms/android/build_sdk.py **Change Type:** modified **Context:** PR #25718: Android SDK build script: HWAsan support added **Review Line:** 273 **Code Changes:** ```diff + if self.hwasan and "arm64" in abi.name: + hwasan_flags = "-fno-omit-frame-pointer -fsanitize=hwaddress" + ...
Added release mode flags in #25746 I think the only sense of HWASan in Release mode is to die instead of doing some insecure memory operation like buffer overflow. I don' see a lot of sense in HWASan reports in Release mode since there's no symbols and no proper stack trace is produced. For example, here's the log for ...
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/test/test_intersectconvexconvex.cpp **Change Type:** modified **Context:** PR #25725: Fixed result buffer overflow in intersectConvexConvex_ for non-convex input **Review Line:** 291 **Code Changes:** ```diff + { 83.80044f , 124.20074f }, {122.125854f , 25.182402f }, { 39.08164f , ...
What if `intersection` was non-empty before function call, will it be empty afterwards? Maybe we could check it here too.
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/test/test_intersectconvexconvex.cpp **Change Type:** modified **Context:** PR #25725: Fixed result buffer overflow in intersectConvexConvex_ for non-convex input **Review Line:** 291 **Code Changes:** ```diff + { 83.80044f , 124.20074f }, {122.125854f , 25.182402f }, { 39.08164f , ...
The function calls `cv::OutputArray::release()` for the "error" case, so it's always empty after the test call.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/calib3d/src/calibinit.cpp **Change Type:** modified **Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors **Code Changes:** ```diff @@ -221,6 +221,26 @@ class ChessBoardDetector int all_quads_count; + struct NeighborsFinder { + co...
The condition should be moved outside the function. `i` is not used inside the function.
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/calib3d/src/calibinit.cpp **Change Type:** modified **Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors **Code Changes:** ```diff @@ -221,6 +221,26 @@ class ChessBoardDetector int all_quads_count; + struct NeighborsFinder { + co...
I suppose it should be just `ChessBoardQuad* all_quads`. `AutoBuffer` details are not needed in the function.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/calib3d/src/calibinit.cpp **Change Type:** modified **Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors **Code Changes:** ```diff @@ -221,6 +221,26 @@ class ChessBoardDetector int all_quads_count; + struct NeighborsFinder { + co...
`cur_quad` is `all_quads[idx]`, I do not think that it's needed in the function parameters.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/calib3d/src/calibinit.cpp **Change Type:** modified **Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors **Code Changes:** ```diff @@ -221,6 +221,26 @@ class ChessBoardDetector int all_quads_count; + struct NeighborsFinder { + co...
I propose to set default value for `thresh_scale` or even make it local constant. It's constant equal to 1.0 on caller side.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/calib3d/src/calibinit.cpp **Change Type:** modified **Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors **Code Changes:** ```diff @@ -221,6 +221,26 @@ class ChessBoardDetector int all_quads_count; + struct NeighborsFinder { + co...
`closest_quad= all_quads[closest_quad_idx]`. No need to pass it with parameters.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/calib3d/src/calibinit.cpp **Change Type:** modified **Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors **Code Changes:** ```diff @@ -221,6 +221,26 @@ class ChessBoardDetector int all_quads_count; + struct NeighborsFinder { + co...
The values are not used outside the function. I propose to make it local.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/calib3d/src/calibinit.cpp **Change Type:** modified **Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors **Code Changes:** ```diff @@ -221,6 +221,26 @@ class ChessBoardDetector int all_quads_count; + struct NeighborsFinder { + co...
It is also used outside function ``` float radius = cur_quad.edge_len * thresh_scale + 1; ``` So, do you propose to set it twice with same value?
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/calib3d/src/calibinit.cpp **Change Type:** modified **Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors **Code Changes:** ```diff @@ -221,6 +221,26 @@ class ChessBoardDetector int all_quads_count; + struct NeighborsFinder { + co...
Their lengths are equal to `all_corners_count` which can be quite large. So, it's better to avoid such frequent allocations on every function call
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/calib3d/src/calibinit.cpp **Change Type:** modified **Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors **Code Changes:** ```diff @@ -221,6 +221,26 @@ class ChessBoardDetector int all_quads_count; + struct NeighborsFinder { + co...
You can get rid of smart pointer, convert `p_all_quads_pts_index` to regular field and use initializer list for it.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/calib3d/src/calibinit.cpp **Change Type:** modified **Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors **Code Changes:** ```diff @@ -221,6 +221,26 @@ class ChessBoardDetector int all_quads_count; + struct NeighborsFinder { + co...
`const std::vector<float> query ={ pt.x, pt.y };`
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgcodecs/src/loadsave.cpp **Change Type:** modified **Context:** PR #25703: imgproc: fixed imread with output image argument - Resolves #25694 Replaces #25695 * Moved `OutputArray` down the call stack * Allow output... **Review Line:** 460 **Code Changes:** ```diff +imread_( const String& filename, ...
this change seems wrong to me. we should keep ``` if (mat.empty()) { mat.create( size.height, size.width, type ); } else { CV_CheckEQ(size, mat.size(), ""); CV_CheckTypeEQ(type, mat.type(), ""); CV_Assert(mat.isContinuous()); } ```
You are an expert OpenCV code reviewer specializing in performance optimization. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgcodecs/src/loadsave.cpp **Change Type:** modified **Context:** PR #25703: imgproc: fixed imread with output image argument - Resolves #25694 Replaces #25695 * Moved `OutputArray` down the call stack * Allow output... **Review Line:** 460 **Code Changes:** ```diff +imread_( const String& filename, ...
`create` should not reallocate data if requested image size fits into existing Mat. ```.cpp Mat img(1000, 1000, CV_8UC3); imread(f, img); // should not reallocate data if image size is less than (1000, 1000) ``` Without this change it will not be possible to read multiple images of different sizes efficiently, because ...
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgcodecs/src/loadsave.cpp **Change Type:** modified **Context:** PR #25703: imgproc: fixed imread with output image argument - Resolves #25694 Replaces #25695 * Moved `OutputArray` down the call stack * Allow output... **Review Line:** 460 **Code Changes:** ```diff +imread_( const String& filename, ...
sorry you are right. `mat.create( size.height, size.width, type );` does the job.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgcodecs/src/loadsave.cpp **Change Type:** modified **Context:** PR #25703: imgproc: fixed imread with output image argument - Resolves #25694 Replaces #25695 * Moved `OutputArray` down the call stack * Allow output... **Review Line:** 460 **Code Changes:** ```diff +imread_( const String& filename, ...
``` TickMeter tm; Mat im; for (int i = 0; i < 5; i++) { tm.reset(); tm.start(); imread("read.png", im); tm.stop(); printf("read time %f\n", tm.getTimeSec()); } imshow("read.png", im); waitKey(); ``` ``` read time 0.692092 read time 0.615938 read time 0.615163 read time 0.615883 read time 0.617650 ``` good job!
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgcodecs/src/loadsave.cpp **Change Type:** modified **Context:** PR #25703: imgproc: fixed imread with output image argument - Resolves #25694 Replaces #25695 * Moved `OutputArray` down the call stack * Allow output... **Review Line:** 331 **Code Changes:** ```diff @@ -81,6 +81,22 @@ static Size val...
`InputOutputArray` is better. I know, that they are synonyms, but it's simpler for reader.
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgcodecs/src/loadsave.cpp **Change Type:** modified **Context:** PR #25703: imgproc: fixed imread with output image argument - Resolves #25694 Replaces #25695 * Moved `OutputArray` down the call stack * Allow output... **Review Line:** 331 **Code Changes:** ```diff @@ -81,6 +81,22 @@ static Size val...
It seems that it won't work without changing public `imread` to accept `InputOutputArray` (https://docs.opencv.org/4.x/d0/d46/classcv_1_1__InputOutputArray.html). There is no obvious way to construct `InputOutputArray` from `OutputArray` (https://docs.opencv.org/4.x/d2/d9e/classcv_1_1__OutputArray.html).
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/core/misc/python/package/mat_wrapper/__init__.py **Change Type:** modified **Context:** PR #25406: feat: use numeric dtype for MatLike instead of generic **Review Line:** 9 **Code Changes:** ```diff -# Same as cv2.typing.NumPyArrayGeneric, but avoids circular dependencies +# Same as cv2.typing.NumP...
Should this also include `np.unsignedinteger[Any]` ?
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/core/misc/python/package/mat_wrapper/__init__.py **Change Type:** modified **Context:** PR #25406: feat: use numeric dtype for MatLike instead of generic **Review Line:** 9 **Code Changes:** ```diff -# Same as cv2.typing.NumPyArrayGeneric, but avoids circular dependencies +# Same as cv2.typing.NumP...
NumPy integer is a base class for all integer types. In my understanding for both signed and unsigned ones. Documentation: https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.integer
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/include/opencv2/imgproc.hpp **Change Type:** modified **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -4040,6 +4040,19 @@ A program using pyramid...
Why not CV_EXPORTS_W? What about documentation and reference to paper?
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_common.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Review Line:** 1 **Code Changes:** ```diff @@ -0,0 +1,75 @@ +// This file is ...
The file is empty. Do we need it?
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_common.hpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,219 @@ +// This file is part of OpenCV pro...
Please remove unused methods.
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/include/opencv2/imgproc.hpp **Change Type:** modified **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -4040,6 +4040,19 @@ A program using pyramid...
I propose to move it to `opencv2/imgproc/imgproc_c.h` or some `details` header. In case, if we need to presume the implementation, it's less painful for 4.x->5.x merges. What about `findContoursLegacy` ?
You are an expert OpenCV code reviewer specializing in API design and compatibility. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/include/opencv2/imgproc.hpp **Change Type:** modified **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -4040,6 +4040,19 @@ A program using pyramid...
Could you add documentation for the functions? Do we really need it in public API?
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/include/opencv2/imgproc.hpp **Change Type:** modified **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -4040,6 +4040,19 @@ A program using pyramid...
I exported this function to be able to test it (though I haven't make such tests yet), I'm not sure whether is it useful. It transforms chain code to vector of points using one of methods, but there are no other interfaces with chain codes. New findContours can return chain code, but without origin point it is not very...
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_common.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Review Line:** 1 **Code Changes:** ```diff @@ -0,0 +1,75 @@ +// This file is ...
Yes, I've moved `contourTreeToResults` function there (it was original intention).
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/include/opencv2/imgproc.hpp **Change Type:** modified **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -4040,6 +4040,19 @@ A program using pyramid...
Moved to `imgproc/detail/legacy.hpp`, renamed to `findContours_legacy`.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_approx.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,354 @@ +// This file is part of OpenCV pro...
What if add the check to for loop?
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_approx.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,354 @@ +// This file is part of OpenCV pro...
looks like if you replace indexes from int to `size_t` then all casts to int can be dropped. It's related to `pass_cleanup`, `clear_until`, `calc_dominance`, etc.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_link.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Review Line:** 304 **Code Changes:** ```diff + if (j == sz.width) + ...
Looks like rns has predictable size. It makes sense to use reserve and emplace_back.
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_approx.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,354 @@ +// This file is part of OpenCV pro...
This was in the original code and, since this function isn't covered by tests, I tried to preserve this original behavior. As I understand, `k` should't exceed `len` (even `len/2` maybe) and if this happens then it means that input array was not valid, so exception might be more appropriate than continuing.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_common.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,75 @@ +// This file is part of OpenCV proj...
Can I use this style (https://github.com/opencv/opencv/wiki/.clang_format) for formatting for all new files?
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_link.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Review Line:** 304 **Code Changes:** ```diff + if (j == sz.width) + ...
`rns` size is not predictable, it depends on number of contours on image and their shape. We can reserve some amount assuming there are at least some contours though.
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_approx.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,354 @@ +// This file is part of OpenCV pro...
Originally I tried to use `size_t`, but in some places arithmetics requires switching to signed type or comparing with signed values and VS doesn't like it. Also, perhaps 32-bit might be slightly faster or consume less memory? I've added debug assertion to check that main array size is less than max int for safety.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_approx.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,354 @@ +// This file is part of OpenCV pro...
Made these changes too.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_approx.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,354 @@ +// This file is part of OpenCV pro...
Use `Cv32suf`
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_approx.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,354 @@ +// This file is part of OpenCV pro...
Previous operands alignment is more readable,
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,697 @@ +// This file is part of OpenCV projec...
Is there clang-format option 'do not touch'?
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,697 @@ +// This file is part of OpenCV projec...
`do not touch` is preferable here too. 2 or more spaces before comment should help with reading code.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,697 @@ +// This file is part of OpenCV projec...
previous variable is more readable.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,697 @@ +// This file is part of OpenCV projec...
`_contours.kind()` should be aligned to have readable code.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/test/test_contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Review Line:** 105 **Code Changes:** ```diff + rectangle(img32s, r,...
Previous variant is better.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/test/test_contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,606 @@ +// This file is part of OpenCV ...
the same, align `.at()` calls one per line
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/test/test_contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,606 @@ +// This file is part of OpenCV ...
`#if 0` is preferable
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/test/test_contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,606 @@ +// This file is part of OpenCV ...
`cvtest::debugLevel >= 10` - 1 print/write result data/images - 10 show windows
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,697 @@ +// This file is part of OpenCV projec...
We can enclosure a block of code between `// clang-format on` - `// clang-format off` comments to ignore it. But I believe in general it is better to avoid alignment of values or comments in such blocks to simplify future merges. Thus I chose to disable these rules: `AlignConsecutiveAssignments: None` and other `AlignC...
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,697 @@ +// This file is part of OpenCV projec...
This would require setting option `SpacesBeforeTrailingComments: 2` **and** changing comments to `//`- I'll apply these changes.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,697 @@ +// This file is part of OpenCV projec...
Slightly improved by `BreakBeforeBinaryOperators: None`
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,697 @@ +// This file is part of OpenCV projec...
Also fixed by `BreakBeforeBinaryOperators: None`
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,697 @@ +// This file is part of OpenCV projec...
Fixed by `BreakBeforeBinaryOperators: None`
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/test/test_contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Review Line:** 105 **Code Changes:** ```diff + rectangle(img32s, r,...
Seems to be improved by setting `PenaltyIndentedWhitespace: 1`
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/test/test_contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,606 @@ +// This file is part of OpenCV ...
Will remove this code
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/test/test_contours_new.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,606 @@ +// This file is part of OpenCV ...
Can not make clang-format to align continuations properly when breaks are before binary operators, perhaps it is some sort of a bug. So I decided to switch to `BreakBeforeBinaryOperators: None` in the end :slightly_frowning_face: This code will be: ```.cpp if (img.at<uchar>(y, x) != 0 && ((img.at<uchar>(y - 1, x) == 0)...
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_approx.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Code Changes:** ```diff @@ -0,0 +1,354 @@ +// This file is part of OpenCV pro...
This is fixed by setting `BreakBeforeBinaryOperators: None`
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/imgproc/src/contours_link.cpp **Change Type:** added **Context:** PR #25146: Reworked findContours to reduce C-API usage - What is done: * rewritten `findContours` and `icvApproximateChainTC89` using C++ data structu... **Review Line:** 255 **Code Changes:** ```diff + rns[prev_point].link ...
Yes, this is a problem, but not serious - there should be no operation, like in the original code: https://github.com/opencv/opencv/blob/f4ebf7c0a6b2ee845a395ae3dac59927eb862894/modules/imgproc/src/contours.cpp#L1636-L1664 I'll fix it soon.
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** 3rdparty/libpng/CMakeLists.txt **Change Type:** modified **Context:** PR #25580: 3rdparty: update libpng 1.6.43 **Code Changes:** ```diff @@ -9,63 +9,207 @@ else() project(${PNG_LIBRARY} C) endif() -if(NOT WIN32) - find_library(M_LIBRARY - NAMES m - PATHS /usr/lib /usr/local/lib - ) - if(NOT M...
Duplicate. There is another instance above.
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** 3rdparty/libpng/CMakeLists.txt **Change Type:** modified **Context:** PR #25580: 3rdparty: update libpng 1.6.43 **Code Changes:** ```diff @@ -9,63 +9,207 @@ else() project(${PNG_LIBRARY} C) endif() -if(NOT WIN32) - find_library(M_LIBRARY - NAMES m - PATHS /usr/lib /usr/local/lib - ) - if(NOT M...
no space after `if` in CMake scripts.
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback.
**File:** 3rdparty/libpng/CMakeLists.txt **Change Type:** modified **Context:** PR #25580: 3rdparty: update libpng 1.6.43 **Code Changes:** ```diff @@ -9,63 +9,207 @@ else() project(${PNG_LIBRARY} C) endif() -if(NOT WIN32) - find_library(M_LIBRARY - NAMES m - PATHS /usr/lib /usr/local/lib - ) - if(NOT M...
> `VISIBLE_IF BUILD_PNG` Not needed.
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/objdetect/test/test_charucodetection.cpp **Change Type:** modified **Context:** PR #25673: fixed marker generation in charuco board **Code Changes:** ```diff @@ -81,6 +81,18 @@ static Mat projectCharucoBoard(aruco::CharucoBoard& board, Mat cameraMatrix, dou return img; } +static bool borderPi...
I propose to extract checks as a local function or two to make the logic obvious. It's very hard to understand the code without attached image. The attached image is not visible, if you just read code in git or try to fix some bug.
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/objdetect/test/test_charucodetection.cpp **Change Type:** modified **Context:** PR #25673: fixed marker generation in charuco board **Code Changes:** ```diff @@ -81,6 +81,18 @@ static Mat projectCharucoBoard(aruco::CharucoBoard& board, Mat cameraMatrix, dou return img; } +static bool borderPi...
I made the test simple: ``` //The test checks the inner and outer borders of the Aruco markers. //In the inner border of Aruco marker, all pixels should be black. //In the outer border of Aruco marker, all pixels should be white. Mat markerImg = arucoZone(borderRect); bool markerBorderIsBlack = borderPixelsHaveSameColo...
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/objdetect/test/test_charucodetection.cpp **Change Type:** modified **Context:** PR #25673: fixed marker generation in charuco board **Code Changes:** ```diff @@ -81,6 +81,18 @@ static Mat projectCharucoBoard(aruco::CharucoBoard& board, Mat cameraMatrix, dou return img; } +static bool borderPi...
borderPixelsHaveSameColor: ``` static bool borderPixelsHaveSameColor(const Mat& image, uint8_t color) { for (int j = 0; j < image.cols; j++) { if (image.at<uint8_t>(0, j) != color || image.at<uint8_t>(image.rows-1, j) != color) return false; } for (int i = 0; i < image.rows; i++) { if (image.at<uint8_t>(i, 0) != color ...
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
**File:** modules/core/src/minmax.cpp **Change Type:** modified **Context:** PR #25563: Transform offset to indeces for MatND in minMaxIdx HAL **Code Changes:** ```diff @@ -1510,18 +1510,29 @@ void cv::minMaxIdx(InputArray _src, double* minVal, Mat src = _src.getMat(), mask = _mask.getMat(); - int _minIdx,...
```suggestion int res = cv_hal_minMaxIdx(src.data, 0, (int)src.total()*cn, 1, src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data); if (res == CV_HAL_ERROR_OK) { if (minIdx) ofs2idx(src, minIdx[0], minIdx); if (maxIdx) ofs2idx(src, maxIdx[0], maxIdx); return; } else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED) { CV_Erro...