Files
opencv-MIRROR/modules/imgproc/src
Pierre Chatelier d83df66ff0 Merge pull request #26834 from chacha21:findContours_speedup
Find contours speedup #26834

It is an attempt, as suggested by #26775, to restore lost speed when migrating `findContours()` implementation from C to C++

The patch adds an "Arena" (a pool) of pre-allocated memory so that contours points (and TreeNodes) can be picked from the Arena.
The code of `findContours()` is mostly unchanged, the arena usage being implicit through a utility class Arena::Item that provides C++ overloaded operators and construct/destruct logic.

As mentioned in #26775, the contour points are allocated and released in order, and can be represented by ranges of indices in their arena. No range subset will be released and drill a hole, that's why the internal representation as a range of indices makes sense.

The TreeNodes use another Arena class that does not comply to that range logic.

Currently, there is a significant improvement of the run-time on the test mentioned in #26775, but it is still far from the `findContours_legacy()` performance.


- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [X] The PR is proposed to the proper branch
- [X] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2025-03-12 18:00:01 +03:00
..
2024-03-05 12:15:39 +03:00
2024-12-26 12:15:46 +00:00
2024-03-05 12:15:39 +03:00
2025-03-11 11:17:20 +03:00
2025-01-27 11:55:10 +01:00
…
2024-03-05 12:15:39 +03:00
2024-12-26 12:15:46 +00:00
2024-03-05 12:15:39 +03:00
2024-04-30 18:07:21 +08:00
2025-01-31 21:12:36 +05:30
2020-04-13 04:29:55 +00:00
2024-03-05 12:15:39 +03:00