fix: traincascade, use C++ persistence API #23594
This pull allows to compile traincascade application with OpenCV 4.6. Changes uses new persistence C++ API in place of legacy one.
Replaced sprintf with safer snprintf
* Straightforward replacement of sprintf with safer snprintf
* Trickier replacement of sprintf with safer snprintf
Some functions were changed to take another parameter: the size of the buffer, so that they can pass that size on to snprintf.
* Add flushing to printing number of processed positive/negative samples so that user is informed of updates quickly.
* use flush C api instead of C++ api
All of these: (performance) Prefer prefix ++/-- operators for non-primitive types.
[modules/calib3d/src/fundam.cpp:1049] -> [modules/calib3d/src/fundam.cpp:1049]: (style) Same expression on both sides of '&&'.
In case fillPassedSamples find zero passed negatives and leafFA is achieved, function updateTrainingSet will return false and print misleading information, this PR fix the case.
Made all STL usages explicit to be able automatically find all usages of
particular class or function.
(cherry picked from commit 2a6fb2867e)
(only cherry picked "apps/trancascade")
[~] Automatically tracked dependencies between modules
[+] Support for optional module dependencies
[+] Options to choose modules to build
[~] Removed hardcoded modules lists from OpenCVConfig.cmake, opencv.pc and OpenCV.mk
[+] Added COMPONENTS support for FIND_PACKAGE(OpenCV)
[~] haartraining and traincascade are moved outside of modules folder since they aren't the modules