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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thank you for your work, but I tested and found that the speed of this function in version 4.11 is slower than in version 4.7.
Here are the test images and test results.
#include<opencv2/opencv.hpp>usingnamespacestd;usingnamespacecv;intmain()
{
Mat img = imread("111.bmp", cv::IMREAD_GRAYSCALE);
cv::Mat mask;
inRange(img, 110, 120, mask);
std::vector<std::vector<cv::Point>> v_cont;
for (int i = 0; i < 10; i++)
{
v_cont.clear();
auto start = chrono::system_clock::now();
cv::findContours(mask, v_cont, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE);
auto end = chrono::system_clock::now();
auto duration = chrono::duration_cast<chrono::microseconds>(end - start) / 1000.;
cout << "4.11 findContours cost" << double(duration.count()) << "ms" << endl;
}
}
the speed of this function in version 4.11 is slower than in version 4.7
This is because this function has been rewritten from C to C++ between these releases, it needs additional refactoring of internal structures in order to return to previous speed.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Readiness Checklist
Related to #26683
I ran reproducer from issue with one iteration.
Before
After
Speedup more than
2
times and memory consumption reduction more than10
timesSee details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.