You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenCV Python version: 4.9.0.80
OS / Platform: MacOS on Apple Silicon (M2 Max)
Python version: 3.11.6
I have seen the same behaviour in C++ going from 4.5.5 to 4.9.0.
Detailed description
Charuco board detection in 4.9.0 and 4.8.0 is running 10-20 times slower versus 4.5.5 and 4.6.0. The big change here is that it moved out of opencv_contrib and into the main opencv repository, which included a slight change to the API.
My app was in C++ and I initially figured it was an issue with my compilation of OpenCV - but I was able to reproduce the problem in Python using OpenCV versions from PyPI.
I dived into the code and aside from a few structural changes in the migration from contrib, the code doing the bulk of the work is almost identical. In the newer version there is the addition of the checkBoard() function here but I patched opencv 4.9.0 to remove it and it did not have a major affect on performance. As far as I can tell, all of the parameter default values remain the same (e.g. subpixel window size).
I also did some benchmarking of individual functions - for example the filterCornersWithoutMinMarkers() function is the last thing run and discards markers that don't meet the minMarkers parameter threshold. In 4.9.0 that was running 2-3 times slower than the entire charuco detection function in 4.5.5 - yet the code between the two versions is almost identical:
Running tests on 4.5.5
Testing old api
Number of Aruco markers detected: 204
Number of Charuco corners detected: 368
Time to detect markers: 0.065684925
Time to detect charuco: 0.0057080125
Running tests on 4.6.0
Testing old api
Number of Aruco markers detected: 204
Number of Charuco corners detected: 368
Time to detect markers: 0.05975144583333334
Time to detect charuco: 0.0058611083333333334
Running tests on 4.8.1
Testing new api
Number of Aruco markers detected: 204
Number of Charuco corners detected: 368
Time to detect markers: 0.05999894569999999
Time to detect charuco: 0.1107731625
Running tests on 4.9.0
Testing new api
Number of Aruco markers detected: 204
Number of Charuco corners detected: 368
Time to detect markers: 0.061556029199999994
Time to detect charuco: 0.1175777584
I was unable to test 4.7.0 because it fails an assertion (which might be a bug).
Issue submission checklist
I report the issue, it's not a question
I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
I updated to the latest OpenCV version and the issue is still there
There is reproducer code and related data files (videos, images, onnx, etc)
The text was updated successfully, but these errors were encountered:
System Information
OpenCV Python version: 4.9.0.80
OS / Platform: MacOS on Apple Silicon (M2 Max)
Python version: 3.11.6
I have seen the same behaviour in C++ going from 4.5.5 to 4.9.0.
Detailed description
Charuco board detection in 4.9.0 and 4.8.0 is running 10-20 times slower versus 4.5.5 and 4.6.0. The big change here is that it moved out of opencv_contrib and into the main opencv repository, which included a slight change to the API.
My app was in C++ and I initially figured it was an issue with my compilation of OpenCV - but I was able to reproduce the problem in Python using OpenCV versions from PyPI.
I dived into the code and aside from a few structural changes in the migration from contrib, the code doing the bulk of the work is almost identical. In the newer version there is the addition of the
checkBoard()
function here but I patched opencv 4.9.0 to remove it and it did not have a major affect on performance. As far as I can tell, all of the parameter default values remain the same (e.g. subpixel window size).I also did some benchmarking of individual functions - for example the
filterCornersWithoutMinMarkers()
function is the last thing run and discards markers that don't meet theminMarkers
parameter threshold. In 4.9.0 that was running 2-3 times slower than the entire charuco detection function in 4.5.5 - yet the code between the two versions is almost identical:4.9.0:
opencv/modules/objdetect/src/aruco/charuco_detector.cpp
Line 272 in dad8af6
4.5.5: https://github.com/opencv/opencv_contrib/blob/49e8f123ca08e76891856a1ecce491b62d08ba20/modules/aruco/src/charuco.cpp#L233
Steps to reproduce
I have created a public repo that has Python code to benchmark charuco detection across multiple versions: https://github.com/jan-jachnik-oxa/opencv_charuco_version_benchmark
The output on my M2 Max Macbook:
I was unable to test 4.7.0 because it fails an assertion (which might be a bug).
Issue submission checklist
The text was updated successfully, but these errors were encountered: