1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2024-11-13 09:02:39 +03:00
51 changed files with 861 additions and 303 deletions
+80 -26
View File
@@ -611,6 +611,10 @@ static bool ocl_arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
#endif
typedef int (*ScalarFunc)(const uchar* src, size_t step_src,
uchar* dst, size_t step_dst, int width, int height,
void* scalar, bool scalarIsFirst);
typedef int (*ExtendedTypeFunc)(const uchar* src1, size_t step1,
const uchar* src2, size_t step2,
uchar* dst, size_t step, int width, int height,
@@ -618,7 +622,8 @@ typedef int (*ExtendedTypeFunc)(const uchar* src1, size_t step1,
static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
InputArray _mask, int dtype, BinaryFuncC* tab, bool muldiv=false,
void* usrdata=0, int oclop=-1, ExtendedTypeFunc extendedFunc = nullptr )
void* usrdata=0, int oclop=-1, ExtendedTypeFunc extendedFunc = nullptr,
ScalarFunc scalarFunc = nullptr)
{
const _InputArray *psrc1 = &_src1, *psrc2 = &_src2;
_InputArray::KindFlag kind1 = psrc1->kind(), kind2 = psrc2->kind();
@@ -664,8 +669,7 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
(kind1 == _InputArray::MATX && (sz1 == Size(1,4) || sz1 == Size(1,1))) ||
(kind2 == _InputArray::MATX && (sz2 == Size(1,4) || sz2 == Size(1,1))) )
{
if ((type1 == CV_64F && (sz1.height == 1 || sz1.height == 4)) &&
checkScalar(*psrc1, type2, kind1, kind2))
if ((type1 == CV_64F && (sz1.height == 1 || sz1.height == 4)) && src1Scalar)
{
// src1 is a scalar; swap it with src2
swap(psrc1, psrc2);
@@ -680,7 +684,7 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
if ( oclop == OCL_OP_DIV_SCALE )
oclop = OCL_OP_RDIV_SCALE;
}
else if( !checkScalar(*psrc2, type1, kind2, kind1) )
else if( !src2Scalar )
CV_Error( cv::Error::StsUnmatchedSizes,
"The operation is neither 'array op array' "
"(where arrays have the same size and the same number of channels), "
@@ -891,32 +895,38 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
const uchar* extSptr1 = sptr1;
const uchar* extSptr2 = sptr2;
if( swapped12 )
std::swap(extSptr1, extSptr1);
std::swap(extSptr1, extSptr2);
// try to perform operation with conversion in one call
// if fail, use converter functions
// try to perform operation in 1 call, fallback to classic way if fail
uchar* opconverted = haveMask ? maskbuf : dptr;
if (!extendedFunc || extendedFunc(extSptr1, 1, extSptr2, 1, opconverted, 1,
bszn.width, bszn.height, usrdata) != 0)
if (!scalarFunc || src2.total() != 1 ||
scalarFunc(extSptr1, 1, opconverted, 1, bszn.width, bszn.height, (void*)extSptr2, swapped12) != 0)
{
if( cvtsrc1 )
// try to perform operation with conversion in one call
// if fail, use converter functions
if (!extendedFunc || extendedFunc(extSptr1, 1, extSptr2, 1, opconverted, 1,
bszn.width, bszn.height, usrdata) != 0)
{
cvtsrc1( sptr1, 1, 0, 1, buf1, 1, bszn, 0 );
sptr1 = buf1;
if( cvtsrc1 )
{
cvtsrc1( sptr1, 1, 0, 1, buf1, 1, bszn, 0 );
sptr1 = buf1;
}
if( swapped12 )
std::swap(sptr1, sptr2);
uchar* fdst = ( haveMask || cvtdst ) ? wbuf : dptr;
func( sptr1, 1, sptr2, 1, fdst, 1, bszn.width, bszn.height, usrdata );
if (cvtdst)
{
uchar* cdst = haveMask ? maskbuf : dptr;
cvtdst(wbuf, 1, 0, 1, cdst, 1, bszn, 0);
}
opconverted = cvtdst ? maskbuf : wbuf;
}
if( swapped12 )
std::swap(sptr1, sptr2);
uchar* fdst = ( haveMask || cvtdst ) ? wbuf : dptr;
func( sptr1, 1, sptr2, 1, fdst, 1, bszn.width, bszn.height, usrdata );
if (cvtdst)
{
uchar* cdst = haveMask ? maskbuf : dptr;
cvtdst(wbuf, 1, 0, 1, cdst, 1, bszn, 0);
}
opconverted = cvtdst ? maskbuf : wbuf;
}
if (haveMask)
@@ -954,6 +964,48 @@ static BinaryFuncC* getAddTab()
return addTab;
}
static int addScalar32f32fWrapper(const uchar* src, size_t step_src, uchar* dst, size_t step_dst, int width, int height,
void* scalar, bool /*scalarIsFirst*/)
{
int res = cv_hal_addScalar32f32f((const float*)src, step_src, (float *)dst, step_dst, width, height, (const float*)scalar);
if (res == CV_HAL_ERROR_OK || res == CV_HAL_ERROR_NOT_IMPLEMENTED)
return res;
else
{
CV_Error_(cv::Error::StsInternal, ("HAL implementation addScalar32f32f ==> " CVAUX_STR(cv_hal_addScalar32f32f)
" returned %d (0x%08x)", res, res));
}
}
static int addScalar16s16sWrapper(const uchar* src, size_t step_src, uchar* dst, size_t step_dst, int width, int height,
void* scalar, bool /*scalarIsFirst*/)
{
int res = cv_hal_addScalar16s16s((const int16_t*)src, step_src, (int16_t *)dst, step_dst, width, height, (const int16_t*)scalar);
if (res == CV_HAL_ERROR_OK || res == CV_HAL_ERROR_NOT_IMPLEMENTED)
return res;
else
{
CV_Error_(cv::Error::StsInternal, ("HAL implementation addScalar16s16s ==> " CVAUX_STR(cv_hal_addScalar16s16s)
" returned %d (0x%08x)", res, res));
}
}
static ScalarFunc getAddScalarFunc(int srcType, int dstType)
{
if (srcType == CV_32F && dstType == CV_32F)
{
return addScalar32f32fWrapper;
}
else if (srcType == CV_16S && dstType == CV_16S)
{
return addScalar16s16sWrapper;
}
else
{
return nullptr;
}
}
static int sub8u32fWrapper(const uchar* src1, size_t step1, const uchar* src2, size_t step2,
uchar* dst, size_t step, int width, int height, void* )
{
@@ -1056,7 +1108,9 @@ void cv::add( InputArray src1, InputArray src2, OutputArray dst,
return;
}
arithm_op(src1, src2, dst, mask, dtype, getAddTab(), false, 0, OCL_OP_ADD );
ScalarFunc scalarFunc = getAddScalarFunc(src1.depth(), dtype < 0 ? dst.depth() : dtype);
arithm_op(src1, src2, dst, mask, dtype, getAddTab(), false, 0, OCL_OP_ADD, nullptr,
/* scalarFunc */ scalarFunc );
}
void cv::subtract( InputArray _src1, InputArray _src2, OutputArray _dst,
+14
View File
@@ -109,7 +109,19 @@ inline int hal_ni_sub16bf(const cv_hal_bf16 *src1_data, size_t src1_step, const
inline int hal_ni_sub8u32f(const uchar *src1_data, size_t src1_step, const uchar *src2_data, size_t src2_step, float *dst_data, size_t dst_step, int width, int height) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
inline int hal_ni_sub8s32f(const schar *src1_data, size_t src1_step, const schar *src2_data, size_t src2_step, float *dst_data, size_t dst_step, int width, int height) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
/**
Add scalar: _dst[i] = src[i] + scalar
@param src_data source image data
@param src_step source image step
@param dst_data destination image data
@param dst_step destination image step
@param width width of the images
@param height height of the images
@param scalar_data pointer to scalar value
*/
inline int hal_ni_addScalar32f32f(const float *src_data, size_t src_step, float *dst_data, size_t dst_step, int width, int height, const float* scalar_data) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
inline int hal_ni_addScalar16s16s(const int16_t *src_data, size_t src_step, int16_t *dst_data, size_t dst_step, int width, int height, const int16_t* scalar_data) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
//! @}
/**
@@ -229,6 +241,8 @@ inline int hal_ni_not8u(const uchar *src_data, size_t src_step, uchar *dst_data,
#define cv_hal_sub8s32f hal_ni_sub8s32f
#define cv_hal_sub16f hal_ni_sub16f
#define cv_hal_sub16bf hal_ni_sub16bf
#define cv_hal_addScalar32f32f hal_ni_addScalar32f32f
#define cv_hal_addScalar16s16s hal_ni_addScalar16s16s
#define cv_hal_max8u hal_ni_max8u
#define cv_hal_max8s hal_ni_max8s
#define cv_hal_max16u hal_ni_max16u
+18 -25
View File
@@ -1170,10 +1170,10 @@ bool haveOpenCL()
if (!g_isOpenCLInitialized)
{
CV_TRACE_REGION("Init_OpenCL_Runtime");
const char* envPath = getenv("OPENCV_OPENCL_RUNTIME");
if (envPath)
std::string envPath = utils::getConfigurationParameterString("OPENCV_OPENCL_RUNTIME");
if (!envPath.empty())
{
if (cv::String(envPath) == "disabled")
if (envPath == "disabled")
{
g_isOpenCLAvailable = false;
g_isOpenCLInitialized = true;
@@ -2119,24 +2119,18 @@ static bool parseOpenCLDeviceConfiguration(const std::string& configurationStr,
return true;
}
#if defined WINRT || defined _WIN32_WCE
static cl_device_id selectOpenCLDevice(const char* configuration = NULL)
{
CV_UNUSED(configuration)
return NULL;
}
#else
static cl_device_id selectOpenCLDevice(const char* configuration = NULL)
static cl_device_id selectOpenCLDevice(const std::string & configuration_ = std::string())
{
std::string platform, deviceName;
std::vector<std::string> deviceTypes;
if (!configuration)
configuration = getenv("OPENCV_OPENCL_DEVICE");
std::string configuration(configuration_);
if (configuration.empty())
configuration = utils::getConfigurationParameterString("OPENCV_OPENCL_DEVICE");
if (configuration &&
(strcmp(configuration, "disabled") == 0 ||
!parseOpenCLDeviceConfiguration(std::string(configuration), platform, deviceTypes, deviceName)
if (!configuration.empty() &&
(configuration == "disabled" ||
!parseOpenCLDeviceConfiguration(configuration, platform, deviceTypes, deviceName)
))
return NULL;
@@ -2204,7 +2198,7 @@ static cl_device_id selectOpenCLDevice(const char* configuration = NULL)
if (!isID)
{
deviceTypes.push_back("GPU");
if (configuration)
if (!configuration.empty())
deviceTypes.push_back("CPU");
}
else
@@ -2272,7 +2266,7 @@ static cl_device_id selectOpenCLDevice(const char* configuration = NULL)
}
not_found:
if (!configuration)
if (configuration.empty())
return NULL; // suppress messages on stderr
std::ostringstream msg;
@@ -2287,7 +2281,6 @@ not_found:
CV_LOG_ERROR(NULL, msg.str());
return NULL;
}
#endif
#ifdef HAVE_OPENCL_SVM
namespace svm {
@@ -2340,12 +2333,12 @@ static unsigned int getSVMCapabilitiesMask()
static unsigned int mask = 0;
if (!initialized)
{
const char* envValue = getenv("OPENCV_OPENCL_SVM_CAPABILITIES_MASK");
if (envValue == NULL)
const std::string envValue = utils::getConfigurationParameterString("OPENCV_OPENCL_SVM_CAPABILITIES_MASK");
if (envValue.empty())
{
return ~0U; // all bits 1
}
mask = atoi(envValue);
mask = atoi(envValue.c_str());
initialized = true;
}
return mask;
@@ -2482,8 +2475,8 @@ public:
std::string configuration = configuration_;
if (configuration_.empty())
{
const char* c = getenv("OPENCV_OPENCL_DEVICE");
if (c)
const std::string c = utils::getConfigurationParameterString("OPENCV_OPENCL_DEVICE");
if (!c.empty())
configuration = c;
}
Impl* impl = findContext(configuration);
@@ -2494,7 +2487,7 @@ public:
return impl;
}
cl_device_id d = selectOpenCLDevice(configuration.empty() ? NULL : configuration.c_str());
cl_device_id d = selectOpenCLDevice(configuration);
if (d == NULL)
return NULL;
+22 -25
View File
@@ -44,6 +44,7 @@
#if defined(HAVE_OPENCL)
#include "opencv2/core.hpp" // CV_Error
#include "opencv2/core/utils/configuration.private.hpp"
#if defined(HAVE_OPENCL_STATIC)
#if defined __APPLE__
@@ -64,18 +65,14 @@ CV_SUPPRESS_DEPRECATED_END
#define ERROR_MSG_CANT_LOAD "Failed to load OpenCL runtime\n"
#define ERROR_MSG_INVALID_VERSION "Failed to load OpenCL runtime (expected version 1.1+)\n"
static const char* getRuntimePath(const char* defaultPath)
static std::string getRuntimePath(const std::string & defaultPath)
{
const char* envPath = getenv("OPENCV_OPENCL_RUNTIME");
if (envPath)
{
static const char disabled_str[] = "disabled";
if ((strlen(envPath) == sizeof(disabled_str) - 1) &&
(memcmp(envPath, disabled_str, sizeof(disabled_str) - 1) == 0))
return NULL;
return envPath;
}
return defaultPath;
const std::string res = cv::utils::getConfigurationParameterString(
"OPENCV_OPENCL_RUNTIME", defaultPath);
if (res == "disabled")
return std::string();
else
return res;
}
#if defined(__APPLE__)
@@ -91,9 +88,9 @@ static void* AppleCLGetProcAddress(const char* name)
if (!initialized)
{
const char* defaultPath = "/System/Library/Frameworks/OpenCL.framework/Versions/Current/OpenCL";
const char* path = getRuntimePath(defaultPath);
if (path)
handle = dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
std::string path = getRuntimePath(defaultPath);
if (!path.empty())
handle = dlopen(path.c_str(), RTLD_LAZY | RTLD_GLOBAL);
if (handle == NULL)
{
if (path != NULL && path != defaultPath)
@@ -129,13 +126,13 @@ static void* WinGetProcAddress(const char* name)
handle = GetModuleHandleA("OpenCL.dll");
if (!handle)
{
const char* defaultPath = "OpenCL.dll";
const char* path = getRuntimePath(defaultPath);
if (path)
handle = LoadLibraryA(path);
const std::string defaultPath = "OpenCL.dll";
const std::string path = getRuntimePath(defaultPath);
if (!path.empty())
handle = LoadLibraryA(path.c_str());
if (!handle)
{
if (path != NULL && path != defaultPath)
if (!path.empty() && path != defaultPath)
fprintf(stderr, ERROR_MSG_CANT_LOAD);
}
else if (GetProcAddress(handle, OPENCL_FUNC_TO_CHECK_1_1) == NULL)
@@ -205,9 +202,9 @@ static void* GetProcAddress(const char* name)
bool foundOpenCL = false;
for (unsigned int i = 0; i < (sizeof(defaultAndroidPaths)/sizeof(char*)); i++)
{
const char* path = (i==0) ? getRuntimePath(defaultAndroidPaths[i]) : defaultAndroidPaths[i];
if (path) {
handle = GetHandle(path);
const std::string path = (i==0) ? getRuntimePath(defaultAndroidPaths[i]) : defaultAndroidPaths[i];
if (!path.empty()) {
handle = GetHandle(path.c_str());
if (handle) {
foundOpenCL = true;
break;
@@ -236,10 +233,10 @@ static void* GetProcAddress(const char* name)
if (!initialized)
{
const char* defaultPath = "libOpenCL.so";
const char* path = getRuntimePath(defaultPath);
if (path)
const std::string path = getRuntimePath(defaultPath);
if (!path.empty())
{
handle = GetHandle(path);
handle = GetHandle(path.c_str());
if (!handle)
{
if (path == defaultPath)
@@ -111,7 +111,7 @@ protected:
bool readPrioritySettings()
{
bool hasChanges = false;
cv::String prioritized_backends = utils::getConfigurationParameterString("OPENCV_PARALLEL_PRIORITY_LIST", NULL);
cv::String prioritized_backends = utils::getConfigurationParameterString("OPENCV_PARALLEL_PRIORITY_LIST");
if (prioritized_backends.empty())
return hasChanges;
CV_LOG_INFO(NULL, "core(parallel): Configured priority list (OPENCV_PARALLEL_PRIORITY_LIST): " << prioritized_backends);
+20 -33
View File
@@ -501,13 +501,11 @@ struct HWFeatures
void initialize(void)
{
#ifndef NO_GETENV
if (getenv("OPENCV_DUMP_CONFIG"))
if (utils::getConfigurationParameterBool("OPENCV_DUMP_CONFIG"))
{
fprintf(stderr, "\nOpenCV build configuration is:\n%s\n",
cv::getBuildInformation().c_str());
}
#endif
initializeNames();
@@ -788,12 +786,10 @@ struct HWFeatures
#endif
bool skip_baseline_check = false;
#ifndef NO_GETENV
if (getenv("OPENCV_SKIP_CPU_BASELINE_CHECK"))
if (utils::getConfigurationParameterBool("OPENCV_SKIP_CPU_BASELINE_CHECK"))
{
skip_baseline_check = true;
}
#endif
int baseline_features[] = { CV_CPU_BASELINE_FEATURES };
if (!checkFeatures(baseline_features, sizeof(baseline_features) / sizeof(baseline_features[0]))
&& !skip_baseline_check)
@@ -843,15 +839,10 @@ struct HWFeatures
void readSettings(const int* baseline_features, int baseline_count)
{
bool dump = true;
const char* disabled_features =
#ifdef NO_GETENV
NULL;
#else
getenv("OPENCV_CPU_DISABLE");
#endif
if (disabled_features && disabled_features[0] != 0)
std::string disabled_features = utils::getConfigurationParameterString("OPENCV_CPU_DISABLE");
if (!disabled_features.empty())
{
const char* start = disabled_features;
const char* start = disabled_features.c_str();
for (;;)
{
while (start[0] != 0 && isSymbolSeparator(start[0]))
@@ -1137,20 +1128,19 @@ String tempfile( const char* suffix )
{
#if OPENCV_HAVE_FILESYSTEM_SUPPORT
String fname;
#ifndef NO_GETENV
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
#endif
std::string temp_dir = utils::getConfigurationParameterString("OPENCV_TEMP_PATH");
#if defined _WIN32
#ifdef WINRT
RoInitialize(RO_INIT_MULTITHREADED);
std::wstring temp_dir = GetTempPathWinRT();
std::wstring temp_dir_rt = GetTempPathWinRT();
std::wstring temp_file = GetTempFileNameWinRT(L"ocv");
if (temp_file.empty())
return String();
temp_file = temp_dir.append(std::wstring(L"\\")).append(temp_file);
temp_file = temp_dir_rt.append(std::wstring(L"\\")).append(temp_file);
DeleteFileW(temp_file.c_str());
char aname[MAX_PATH];
@@ -1160,12 +1150,12 @@ String tempfile( const char* suffix )
RoUninitialize();
#elif defined(_WIN32_WCE)
const auto kMaxPathSize = MAX_PATH+1;
wchar_t temp_dir[kMaxPathSize] = {0};
wchar_t temp_dir_ce[kMaxPathSize] = {0};
wchar_t temp_file[kMaxPathSize] = {0};
::GetTempPathW(kMaxPathSize, temp_dir);
::GetTempPathW(kMaxPathSize, temp_dir_ce);
if(0 != ::GetTempFileNameW(temp_dir, L"ocv", 0, temp_file)) {
if(0 != ::GetTempFileNameW(temp_dir_ce, L"ocv", 0, temp_file)) {
DeleteFileW(temp_file);
char aname[MAX_PATH];
size_t copied = wcstombs(aname, temp_file, MAX_PATH);
@@ -1176,12 +1166,12 @@ String tempfile( const char* suffix )
char temp_dir2[MAX_PATH] = { 0 };
char temp_file[MAX_PATH] = { 0 };
if (temp_dir == 0 || temp_dir[0] == 0)
if (temp_dir.empty())
{
::GetTempPathA(sizeof(temp_dir2), temp_dir2);
temp_dir = temp_dir2;
temp_dir = std::string(temp_dir2);
}
if(0 == ::GetTempFileNameA(temp_dir, "ocv", 0, temp_file))
if(0 == ::GetTempFileNameA(temp_dir.c_str(), "ocv", 0, temp_file))
return String();
DeleteFileA(temp_file);
@@ -1196,7 +1186,7 @@ String tempfile( const char* suffix )
char defaultTemplate[] = "/tmp/__opencv_temp.XXXXXX";
# endif
if (temp_dir == 0 || temp_dir[0] == 0)
if (temp_dir.empty())
fname = defaultTemplate;
else
{
@@ -2241,9 +2231,9 @@ size_t utils::getConfigurationParameterSizeT(const char* name, size_t defaultVal
return read<size_t>(name, defaultValue);
}
cv::String utils::getConfigurationParameterString(const char* name, const char* defaultValue)
std::string utils::getConfigurationParameterString(const char* name, const std::string & defaultValue)
{
return read<cv::String>(name, defaultValue ? cv::String(defaultValue) : cv::String());
return read<cv::String>(name, defaultValue);
}
utils::Paths utils::getConfigurationParameterPaths(const char* name, const utils::Paths &defaultValue)
@@ -2540,11 +2530,8 @@ public:
}
ippFeatures = cpuFeatures;
const char* pIppEnv = getenv("OPENCV_IPP");
cv::String env;
if(pIppEnv != NULL)
env = pIppEnv;
if(env.size())
std::string env = utils::getConfigurationParameterString("OPENCV_IPP");
if(!env.empty())
{
#if IPP_VERSION_X100 >= 201900
const Ipp64u minorFeatures = ippCPUID_MOVBE|ippCPUID_AES|ippCPUID_CLMUL|ippCPUID_ABR|ippCPUID_RDRAND|ippCPUID_F16C|
+1 -1
View File
@@ -60,7 +60,7 @@ static std::vector<cv::String>& _getDataSearchSubDirectory()
CV_EXPORTS void addDataSearchPath(const cv::String& path)
{
if (utils::fs::isDirectory(path))
if (!path.empty() && utils::fs::isDirectory(path))
_getDataSearchPath().push_back(path);
}
CV_EXPORTS void addDataSearchSubDirectory(const cv::String& subdir)
+6 -6
View File
@@ -447,8 +447,8 @@ cv::String getCacheDirectory(const char* sub_directory_name, const char* configu
#elif defined __ANDROID__
// no defaults
#elif defined __APPLE__
const char* tmpdir_env = getenv("TMPDIR");
if (tmpdir_env && utils::fs::isDirectory(tmpdir_env))
const std::string tmpdir_env = utils::getConfigurationParameterString("TMPDIR");
if (!tmpdir_env.empty() && utils::fs::isDirectory(tmpdir_env))
{
default_cache_path = tmpdir_env;
}
@@ -461,16 +461,16 @@ cv::String getCacheDirectory(const char* sub_directory_name, const char* configu
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
if (default_cache_path.empty())
{
const char* xdg_cache_env = getenv("XDG_CACHE_HOME");
if (xdg_cache_env && xdg_cache_env[0] && utils::fs::isDirectory(xdg_cache_env))
const std::string xdg_cache_env = utils::getConfigurationParameterString("XDG_CACHE_HOME");
if (!xdg_cache_env.empty() && utils::fs::isDirectory(xdg_cache_env))
{
default_cache_path = xdg_cache_env;
}
}
if (default_cache_path.empty())
{
const char* home_env = getenv("HOME");
if (home_env && home_env[0] && utils::fs::isDirectory(home_env))
const std::string home_env = utils::getConfigurationParameterString("HOME");
if (!home_env.empty() && utils::fs::isDirectory(home_env))
{
cv::String home_path = home_env;
cv::String home_cache_path = utils::fs::join(home_path, ".cache/");
+3 -2
View File
@@ -7,6 +7,7 @@
//
#include "opencv2/core/utils/plugin_loader.private.hpp" // DynamicLib
#include "opencv2/core/utils/configuration.private.hpp"
namespace cv { namespace detail {
@@ -47,8 +48,8 @@ static FN_vaGetImage fn_vaGetImage = NULL;
static std::shared_ptr<cv::plugin::impl::DynamicLib> loadLibVA()
{
std::shared_ptr<cv::plugin::impl::DynamicLib> lib;
const char* envPath = getenv("OPENCV_LIBVA_RUNTIME");
if (envPath)
const std::string envPath = utils::getConfigurationParameterString("OPENCV_LIBVA_RUNTIME");
if (!envPath.empty())
{
lib = std::make_shared<cv::plugin::impl::DynamicLib>(envPath);
return lib;