Merge pull request #19668 from asmorkalov:as/filesystem_py

* Add Python Bindings for getCacheDirectory function

* Added getCacheDirectory interop test with image codecs.

Co-authored-by: Sergey Slashchinin <sergei.slashchinin@xperience.ai>
This commit is contained in:
Alexander Smorkalov
2021-03-04 19:17:57 +03:00
committed by GitHub
parent e2ca50f1cb
commit 2e429268ff
3 changed files with 58 additions and 1 deletions
+13
View File
@@ -5,6 +5,8 @@
#include "precomp.hpp"
#include "opencv2/core/bindings_utils.hpp"
#include <sstream>
#include <opencv2/core/utils/filesystem.hpp>
#include <opencv2/core/utils/filesystem.private.hpp>
namespace cv { namespace utils {
@@ -208,4 +210,15 @@ CV_EXPORTS_W String dumpInputOutputArrayOfArrays(InputOutputArrayOfArrays argume
return ss.str();
}
namespace fs {
cv::String getCacheDirectoryForDownloads()
{
#if OPENCV_HAVE_FILESYSTEM_SUPPORT
return cv::utils::fs::getCacheDirectory("downloads", "OPENCV_DOWNLOADS_CACHE_DIR");
#else
CV_Error(Error::StsNotImplemented, "File system support is disabled in this OpenCV build!");
#endif
}
} // namespace fs
}} // namespace