mirror of
https://github.com/opencv/opencv.git
synced 2025-06-24 12:40:58 +08:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
commit
8f4e5c2fb8
@ -1478,7 +1478,7 @@ if(BUILD_opencv_python2)
|
|||||||
status(" Libraries:" HAVE_opencv_python2 THEN "${PYTHON2_LIBRARIES}" ELSE NO)
|
status(" Libraries:" HAVE_opencv_python2 THEN "${PYTHON2_LIBRARIES}" ELSE NO)
|
||||||
endif()
|
endif()
|
||||||
status(" numpy:" PYTHON2_NUMPY_INCLUDE_DIRS THEN "${PYTHON2_NUMPY_INCLUDE_DIRS} (ver ${PYTHON2_NUMPY_VERSION})" ELSE "NO (Python wrappers can not be generated)")
|
status(" numpy:" PYTHON2_NUMPY_INCLUDE_DIRS THEN "${PYTHON2_NUMPY_INCLUDE_DIRS} (ver ${PYTHON2_NUMPY_VERSION})" ELSE "NO (Python wrappers can not be generated)")
|
||||||
status(" packages path:" PYTHON2_EXECUTABLE THEN "${PYTHON2_PACKAGES_PATH}" ELSE "-")
|
status(" install path:" HAVE_opencv_python2 THEN "${__INSTALL_PATH_PYTHON2}" ELSE "-")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(BUILD_opencv_python3)
|
if(BUILD_opencv_python3)
|
||||||
@ -1491,7 +1491,7 @@ if(BUILD_opencv_python3)
|
|||||||
status(" Libraries:" HAVE_opencv_python3 THEN "${PYTHON3_LIBRARIES}" ELSE NO)
|
status(" Libraries:" HAVE_opencv_python3 THEN "${PYTHON3_LIBRARIES}" ELSE NO)
|
||||||
endif()
|
endif()
|
||||||
status(" numpy:" PYTHON3_NUMPY_INCLUDE_DIRS THEN "${PYTHON3_NUMPY_INCLUDE_DIRS} (ver ${PYTHON3_NUMPY_VERSION})" ELSE "NO (Python3 wrappers can not be generated)")
|
status(" numpy:" PYTHON3_NUMPY_INCLUDE_DIRS THEN "${PYTHON3_NUMPY_INCLUDE_DIRS} (ver ${PYTHON3_NUMPY_VERSION})" ELSE "NO (Python3 wrappers can not be generated)")
|
||||||
status(" packages path:" PYTHON3_EXECUTABLE THEN "${PYTHON3_PACKAGES_PATH}" ELSE "-")
|
status(" install path:" HAVE_opencv_python3 THEN "${__INSTALL_PATH_PYTHON3}" ELSE "-")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
status("")
|
status("")
|
||||||
|
@ -910,7 +910,11 @@ macro(_ocv_create_module)
|
|||||||
source_group("Src" FILES "${_VS_VERSION_FILE}")
|
source_group("Src" FILES "${_VS_VERSION_FILE}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(WIN32 AND NOT ("${the_module}" STREQUAL "opencv_core" OR "${the_module}" STREQUAL "opencv_world")
|
if(WIN32 AND NOT (
|
||||||
|
"${the_module}" STREQUAL "opencv_core" OR
|
||||||
|
"${the_module}" STREQUAL "opencv_world" OR
|
||||||
|
"${the_module}" STREQUAL "opencv_cudev"
|
||||||
|
)
|
||||||
AND (BUILD_SHARED_LIBS AND NOT "x${OPENCV_MODULE_TYPE}" STREQUAL "xSTATIC")
|
AND (BUILD_SHARED_LIBS AND NOT "x${OPENCV_MODULE_TYPE}" STREQUAL "xSTATIC")
|
||||||
AND NOT OPENCV_SKIP_DLLMAIN_GENERATION
|
AND NOT OPENCV_SKIP_DLLMAIN_GENERATION
|
||||||
)
|
)
|
||||||
|
457
doc/opencv.bib
457
doc/opencv.bib
File diff suppressed because it is too large
Load Diff
@ -364,7 +364,7 @@ IplImage;
|
|||||||
|
|
||||||
CV_INLINE IplImage cvIplImage()
|
CV_INLINE IplImage cvIplImage()
|
||||||
{
|
{
|
||||||
#if !defined(CV__ENABLE_C_API_CTORS)
|
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
|
||||||
IplImage self = CV_STRUCT_INITIALIZER; self.nSize = sizeof(IplImage); return self;
|
IplImage self = CV_STRUCT_INITIALIZER; self.nSize = sizeof(IplImage); return self;
|
||||||
#else
|
#else
|
||||||
return _IplImage();
|
return _IplImage();
|
||||||
|
@ -2772,6 +2772,7 @@ struct Kernel::Impl
|
|||||||
for( int i = 0; i < MAX_ARRS; i++ )
|
for( int i = 0; i < MAX_ARRS; i++ )
|
||||||
u[i] = 0;
|
u[i] = 0;
|
||||||
haveTempDstUMats = false;
|
haveTempDstUMats = false;
|
||||||
|
haveTempSrcUMats = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanupUMats()
|
void cleanupUMats()
|
||||||
@ -2788,6 +2789,7 @@ struct Kernel::Impl
|
|||||||
}
|
}
|
||||||
nu = 0;
|
nu = 0;
|
||||||
haveTempDstUMats = false;
|
haveTempDstUMats = false;
|
||||||
|
haveTempSrcUMats = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addUMat(const UMat& m, bool dst)
|
void addUMat(const UMat& m, bool dst)
|
||||||
@ -2798,6 +2800,8 @@ struct Kernel::Impl
|
|||||||
nu++;
|
nu++;
|
||||||
if(dst && m.u->tempUMat())
|
if(dst && m.u->tempUMat())
|
||||||
haveTempDstUMats = true;
|
haveTempDstUMats = true;
|
||||||
|
if(m.u->originalUMatData == NULL && m.u->tempUMat())
|
||||||
|
haveTempSrcUMats = true; // UMat is created on RAW memory (without proper lifetime management, even from Mat)
|
||||||
}
|
}
|
||||||
|
|
||||||
void addImage(const Image2D& image)
|
void addImage(const Image2D& image)
|
||||||
@ -2835,6 +2839,7 @@ struct Kernel::Impl
|
|||||||
int nu;
|
int nu;
|
||||||
std::list<Image2D> images;
|
std::list<Image2D> images;
|
||||||
bool haveTempDstUMats;
|
bool haveTempDstUMats;
|
||||||
|
bool haveTempSrcUMats;
|
||||||
};
|
};
|
||||||
|
|
||||||
}} // namespace cv::ocl
|
}} // namespace cv::ocl
|
||||||
@ -3108,6 +3113,8 @@ bool Kernel::Impl::run(int dims, size_t globalsize[], size_t localsize[],
|
|||||||
cl_command_queue qq = getQueue(q);
|
cl_command_queue qq = getQueue(q);
|
||||||
if (haveTempDstUMats)
|
if (haveTempDstUMats)
|
||||||
sync = true;
|
sync = true;
|
||||||
|
if (haveTempSrcUMats)
|
||||||
|
sync = true;
|
||||||
if (timeNS)
|
if (timeNS)
|
||||||
sync = true;
|
sync = true;
|
||||||
cl_event asyncEvent = 0;
|
cl_event asyncEvent = 0;
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#undef min
|
#undef min
|
||||||
#undef max
|
#undef max
|
||||||
#undef abs
|
#undef abs
|
||||||
|
#elif defined(__linux__)
|
||||||
|
#include <dlfcn.h> // requires -ldl
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include <TargetConditionals.h>
|
#include <TargetConditionals.h>
|
||||||
#if TARGET_OS_MAC
|
#if TARGET_OS_MAC
|
||||||
@ -123,27 +125,10 @@ static cv::String getModuleLocation(const void* addr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
std::ifstream fs("/proc/self/maps");
|
Dl_info info;
|
||||||
std::string line;
|
if (0 != dladdr(addr, &info))
|
||||||
while (std::getline(fs, line, '\n'))
|
|
||||||
{
|
{
|
||||||
long long int addr_begin = 0, addr_end = 0;
|
return cv::String(info.dli_fname);
|
||||||
if (2 == sscanf(line.c_str(), "%llx-%llx", &addr_begin, &addr_end))
|
|
||||||
{
|
|
||||||
if ((intptr_t)addr >= (intptr_t)addr_begin && (intptr_t)addr < (intptr_t)addr_end)
|
|
||||||
{
|
|
||||||
size_t pos = line.rfind(" "); // 2 spaces
|
|
||||||
if (pos == cv::String::npos)
|
|
||||||
pos = line.rfind(' '); // 1 spaces
|
|
||||||
else
|
|
||||||
pos++;
|
|
||||||
if (pos == cv::String::npos)
|
|
||||||
{
|
|
||||||
CV_LOG_DEBUG(NULL, "Can't parse module path: '" << line << '\'');
|
|
||||||
}
|
|
||||||
return line.substr(pos + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
# if TARGET_OS_MAC
|
# if TARGET_OS_MAC
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
|
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -178,7 +178,7 @@ cv::String getcwd()
|
|||||||
sz = GetCurrentDirectoryA((DWORD)buf.size(), buf.data());
|
sz = GetCurrentDirectoryA((DWORD)buf.size(), buf.data());
|
||||||
return cv::String(buf.data(), (size_t)sz);
|
return cv::String(buf.data(), (size_t)sz);
|
||||||
#endif
|
#endif
|
||||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
|
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
char* p = ::getcwd(buf.data(), buf.size());
|
char* p = ::getcwd(buf.data(), buf.size());
|
||||||
@ -212,7 +212,7 @@ bool createDirectory(const cv::String& path)
|
|||||||
#else
|
#else
|
||||||
int result = _mkdir(path.c_str());
|
int result = _mkdir(path.c_str());
|
||||||
#endif
|
#endif
|
||||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
|
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__
|
||||||
int result = mkdir(path.c_str(), 0777);
|
int result = mkdir(path.c_str(), 0777);
|
||||||
#else
|
#else
|
||||||
int result = -1;
|
int result = -1;
|
||||||
@ -327,7 +327,7 @@ private:
|
|||||||
Impl& operator=(const Impl&); // disabled
|
Impl& operator=(const Impl&); // disabled
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
|
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__
|
||||||
|
|
||||||
struct FileLock::Impl
|
struct FileLock::Impl
|
||||||
{
|
{
|
||||||
@ -441,7 +441,7 @@ cv::String getCacheDirectory(const char* sub_directory_name, const char* configu
|
|||||||
default_cache_path = "/tmp/";
|
default_cache_path = "/tmp/";
|
||||||
CV_LOG_WARNING(NULL, "Using world accessible cache directory. This may be not secure: " << default_cache_path);
|
CV_LOG_WARNING(NULL, "Using world accessible cache directory. This may be not secure: " << default_cache_path);
|
||||||
}
|
}
|
||||||
#elif defined __linux__ || defined __HAIKU__
|
#elif defined __linux__ || defined __HAIKU__ || defined __FreeBSD__
|
||||||
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||||
if (default_cache_path.empty())
|
if (default_cache_path.empty())
|
||||||
{
|
{
|
||||||
|
@ -752,7 +752,8 @@ struct AbsValFunctor
|
|||||||
|
|
||||||
bool supportBackend(int backendId, int)
|
bool supportBackend(int backendId, int)
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE;
|
return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE ||
|
||||||
|
backendId == DNN_BACKEND_INFERENCE_ENGINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply(const float* srcptr, float* dstptr, int len, size_t planeSize, int cn0, int cn1) const
|
void apply(const float* srcptr, float* dstptr, int len, size_t planeSize, int cn0, int cn1) const
|
||||||
@ -806,8 +807,11 @@ struct AbsValFunctor
|
|||||||
#ifdef HAVE_INF_ENGINE
|
#ifdef HAVE_INF_ENGINE
|
||||||
InferenceEngine::CNNLayerPtr initInfEngine(InferenceEngine::LayerParams& lp)
|
InferenceEngine::CNNLayerPtr initInfEngine(InferenceEngine::LayerParams& lp)
|
||||||
{
|
{
|
||||||
CV_Error(Error::StsNotImplemented, "Abs");
|
lp.type = "ReLU";
|
||||||
return InferenceEngine::CNNLayerPtr();
|
std::shared_ptr<InferenceEngine::ReLULayer> ieLayer(new InferenceEngine::ReLULayer(lp));
|
||||||
|
ieLayer->negative_slope = -1;
|
||||||
|
ieLayer->params["negative_slope"] = "-1.0";
|
||||||
|
return ieLayer;
|
||||||
}
|
}
|
||||||
#endif // HAVE_INF_ENGINE
|
#endif // HAVE_INF_ENGINE
|
||||||
|
|
||||||
@ -900,7 +904,7 @@ struct PowerFunctor
|
|||||||
bool supportBackend(int backendId, int targetId)
|
bool supportBackend(int backendId, int targetId)
|
||||||
{
|
{
|
||||||
if (backendId == DNN_BACKEND_INFERENCE_ENGINE)
|
if (backendId == DNN_BACKEND_INFERENCE_ENGINE)
|
||||||
return (targetId != DNN_TARGET_OPENCL && targetId != DNN_TARGET_OPENCL_FP16) || power == 1.0;
|
return (targetId != DNN_TARGET_OPENCL && targetId != DNN_TARGET_OPENCL_FP16) || power == 1.0 || power == 0.5;
|
||||||
else
|
else
|
||||||
return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE;
|
return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE;
|
||||||
}
|
}
|
||||||
@ -1054,7 +1058,8 @@ struct ChannelsPReLUFunctor
|
|||||||
|
|
||||||
bool supportBackend(int backendId, int)
|
bool supportBackend(int backendId, int)
|
||||||
{
|
{
|
||||||
return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE;
|
return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE ||
|
||||||
|
backendId == DNN_BACKEND_INFERENCE_ENGINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply(const float* srcptr, float* dstptr, int len, size_t planeSize, int cn0, int cn1) const
|
void apply(const float* srcptr, float* dstptr, int len, size_t planeSize, int cn0, int cn1) const
|
||||||
@ -1140,8 +1145,11 @@ struct ChannelsPReLUFunctor
|
|||||||
#ifdef HAVE_INF_ENGINE
|
#ifdef HAVE_INF_ENGINE
|
||||||
InferenceEngine::CNNLayerPtr initInfEngine(InferenceEngine::LayerParams& lp)
|
InferenceEngine::CNNLayerPtr initInfEngine(InferenceEngine::LayerParams& lp)
|
||||||
{
|
{
|
||||||
CV_Error(Error::StsNotImplemented, "PReLU");
|
lp.type = "PReLU";
|
||||||
return InferenceEngine::CNNLayerPtr();
|
std::shared_ptr<InferenceEngine::PReLULayer> ieLayer(new InferenceEngine::PReLULayer(lp));
|
||||||
|
const size_t numChannels = scale.total();
|
||||||
|
ieLayer->_weights = wrapToInfEngineBlob(scale, {numChannels}, InferenceEngine::Layout::C);
|
||||||
|
return ieLayer;
|
||||||
}
|
}
|
||||||
#endif // HAVE_INF_ENGINE
|
#endif // HAVE_INF_ENGINE
|
||||||
|
|
||||||
|
@ -358,7 +358,8 @@ void ONNXImporter::populateNet(Net dstNet)
|
|||||||
layerParams.set("shift", blob.at<float>(0));
|
layerParams.set("shift", blob.at<float>(0));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
layerParams.type = "Shift";
|
layerParams.type = "Scale";
|
||||||
|
layerParams.set("bias_term", true);
|
||||||
layerParams.blobs.push_back(blob);
|
layerParams.blobs.push_back(blob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -375,10 +376,28 @@ void ONNXImporter::populateNet(Net dstNet)
|
|||||||
layerParams.set("shift", blob.at<float>(0));
|
layerParams.set("shift", blob.at<float>(0));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
layerParams.type = "Shift";
|
layerParams.type = "Scale";
|
||||||
|
layerParams.set("has_bias", true);
|
||||||
layerParams.blobs.push_back(blob);
|
layerParams.blobs.push_back(blob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (layer_type == "Div")
|
||||||
|
{
|
||||||
|
Mat blob = getBlob(node_proto, constBlobs, 1);
|
||||||
|
CV_Assert_N(blob.type() == CV_32F, blob.total());
|
||||||
|
divide(1.0, blob, blob);
|
||||||
|
if (blob.total() == 1)
|
||||||
|
{
|
||||||
|
layerParams.set("scale", blob.at<float>(0));
|
||||||
|
layerParams.type = "Power";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layerParams.type = "Scale";
|
||||||
|
layerParams.blobs.push_back(blob);
|
||||||
|
layerParams.set("bias_term", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (layer_type == "Constant")
|
else if (layer_type == "Constant")
|
||||||
{
|
{
|
||||||
CV_Assert(node_proto.input_size() == 0);
|
CV_Assert(node_proto.input_size() == 0);
|
||||||
|
@ -128,10 +128,16 @@ TEST_P(DNNTestNetwork, GoogLeNet)
|
|||||||
|
|
||||||
TEST_P(DNNTestNetwork, Inception_5h)
|
TEST_P(DNNTestNetwork, Inception_5h)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE) throw SkipTestException("");
|
double l1 = default_l1, lInf = default_lInf;
|
||||||
|
if (backend == DNN_BACKEND_INFERENCE_ENGINE && (target == DNN_TARGET_CPU || target == DNN_TARGET_OPENCL))
|
||||||
|
{
|
||||||
|
l1 = 1.72e-5;
|
||||||
|
lInf = 8e-4;
|
||||||
|
}
|
||||||
processNet("dnn/tensorflow_inception_graph.pb", "", Size(224, 224), "softmax2",
|
processNet("dnn/tensorflow_inception_graph.pb", "", Size(224, 224), "softmax2",
|
||||||
target == DNN_TARGET_OPENCL ? "dnn/halide_scheduler_opencl_inception_5h.yml" :
|
target == DNN_TARGET_OPENCL ? "dnn/halide_scheduler_opencl_inception_5h.yml" :
|
||||||
"dnn/halide_scheduler_inception_5h.yml");
|
"dnn/halide_scheduler_inception_5h.yml",
|
||||||
|
l1, lInf);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(DNNTestNetwork, ENet)
|
TEST_P(DNNTestNetwork, ENet)
|
||||||
@ -193,41 +199,42 @@ TEST_P(DNNTestNetwork, SSD_VGG16)
|
|||||||
|
|
||||||
TEST_P(DNNTestNetwork, OpenPose_pose_coco)
|
TEST_P(DNNTestNetwork, OpenPose_pose_coco)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_HALIDE ||
|
if (backend == DNN_BACKEND_HALIDE)
|
||||||
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD))
|
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
processNet("dnn/openpose_pose_coco.caffemodel", "dnn/openpose_pose_coco.prototxt",
|
processNet("dnn/openpose_pose_coco.caffemodel", "dnn/openpose_pose_coco.prototxt",
|
||||||
Size(368, 368));
|
Size(46, 46));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(DNNTestNetwork, OpenPose_pose_mpi)
|
TEST_P(DNNTestNetwork, OpenPose_pose_mpi)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_HALIDE ||
|
if (backend == DNN_BACKEND_HALIDE)
|
||||||
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD))
|
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
processNet("dnn/openpose_pose_mpi.caffemodel", "dnn/openpose_pose_mpi.prototxt",
|
processNet("dnn/openpose_pose_mpi.caffemodel", "dnn/openpose_pose_mpi.prototxt",
|
||||||
Size(368, 368));
|
Size(46, 46));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(DNNTestNetwork, OpenPose_pose_mpi_faster_4_stages)
|
TEST_P(DNNTestNetwork, OpenPose_pose_mpi_faster_4_stages)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_HALIDE ||
|
if (backend == DNN_BACKEND_HALIDE)
|
||||||
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD))
|
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
// The same .caffemodel but modified .prototxt
|
// The same .caffemodel but modified .prototxt
|
||||||
// See https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/src/openpose/pose/poseParameters.cpp
|
// See https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/src/openpose/pose/poseParameters.cpp
|
||||||
processNet("dnn/openpose_pose_mpi.caffemodel", "dnn/openpose_pose_mpi_faster_4_stages.prototxt",
|
processNet("dnn/openpose_pose_mpi.caffemodel", "dnn/openpose_pose_mpi_faster_4_stages.prototxt",
|
||||||
Size(368, 368));
|
Size(46, 46));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(DNNTestNetwork, OpenFace)
|
TEST_P(DNNTestNetwork, OpenFace)
|
||||||
{
|
{
|
||||||
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_RELEASE < 2018030000
|
#if defined(INF_ENGINE_RELEASE)
|
||||||
|
#if INF_ENGINE_RELEASE < 2018030000
|
||||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
||||||
throw SkipTestException("Test is enabled starts from OpenVINO 2018R3");
|
throw SkipTestException("Test is enabled starts from OpenVINO 2018R3");
|
||||||
|
#elif INF_ENGINE_RELEASE < 2018040000
|
||||||
|
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL_FP16)
|
||||||
|
throw SkipTestException("Test is enabled starts from OpenVINO 2018R4");
|
||||||
#endif
|
#endif
|
||||||
if (backend == DNN_BACKEND_HALIDE ||
|
#endif
|
||||||
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL_FP16))
|
if (backend == DNN_BACKEND_HALIDE)
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
processNet("dnn/openface_nn4.small2.v1.t7", "", Size(96, 96), "");
|
processNet("dnn/openface_nn4.small2.v1.t7", "", Size(96, 96), "");
|
||||||
}
|
}
|
||||||
|
@ -347,8 +347,10 @@ INSTANTIATE_TEST_CASE_P(/**/, Test_Darknet_nets, dnnBackendsAndTargets());
|
|||||||
|
|
||||||
TEST_P(Test_Darknet_layers, shortcut)
|
TEST_P(Test_Darknet_layers, shortcut)
|
||||||
{
|
{
|
||||||
|
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_RELEASE < 2018040000
|
||||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_CPU)
|
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_CPU)
|
||||||
throw SkipTestException("");
|
throw SkipTestException("Test is enabled starts from OpenVINO 2018R4");
|
||||||
|
#endif
|
||||||
testDarknetLayer("shortcut");
|
testDarknetLayer("shortcut");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,9 +273,11 @@ TEST_P(AvePooling, Accuracy)
|
|||||||
Size stride = get<3>(GetParam());
|
Size stride = get<3>(GetParam());
|
||||||
Backend backendId = get<0>(get<4>(GetParam()));
|
Backend backendId = get<0>(get<4>(GetParam()));
|
||||||
Target targetId = get<1>(get<4>(GetParam()));
|
Target targetId = get<1>(get<4>(GetParam()));
|
||||||
|
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_RELEASE < 2018040000
|
||||||
if (backendId == DNN_BACKEND_INFERENCE_ENGINE && targetId == DNN_TARGET_MYRIAD &&
|
if (backendId == DNN_BACKEND_INFERENCE_ENGINE && targetId == DNN_TARGET_MYRIAD &&
|
||||||
stride == Size(3, 2) && kernel == Size(3, 3) && outSize != Size(1, 1))
|
stride == Size(3, 2) && kernel == Size(3, 3) && outSize != Size(1, 1))
|
||||||
throw SkipTestException("");
|
throw SkipTestException("Test is enabled starts from OpenVINO 2018R4");
|
||||||
|
#endif
|
||||||
|
|
||||||
const int inWidth = (outSize.width - 1) * stride.width + kernel.width;
|
const int inWidth = (outSize.width - 1) * stride.width + kernel.width;
|
||||||
const int inHeight = (outSize.height - 1) * stride.height + kernel.height;
|
const int inHeight = (outSize.height - 1) * stride.height + kernel.height;
|
||||||
|
@ -243,9 +243,14 @@ TEST_P(Test_Caffe_layers, Concat)
|
|||||||
|
|
||||||
TEST_P(Test_Caffe_layers, Fused_Concat)
|
TEST_P(Test_Caffe_layers, Fused_Concat)
|
||||||
{
|
{
|
||||||
if ((backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_CPU) ||
|
#if defined(INF_ENGINE_RELEASE)
|
||||||
(backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL))
|
if (backend == DNN_BACKEND_INFERENCE_ENGINE)
|
||||||
|
{
|
||||||
|
if (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16 ||
|
||||||
|
(INF_ENGINE_RELEASE < 2018040000 && target == DNN_TARGET_CPU))
|
||||||
throw SkipTestException("");
|
throw SkipTestException("");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
checkBackend();
|
checkBackend();
|
||||||
|
|
||||||
// Test case
|
// Test case
|
||||||
@ -349,12 +354,6 @@ TEST_P(Test_Caffe_layers, Reshape_Split_Slice)
|
|||||||
|
|
||||||
TEST_P(Test_Caffe_layers, Conv_Elu)
|
TEST_P(Test_Caffe_layers, Conv_Elu)
|
||||||
{
|
{
|
||||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
|
|
||||||
{
|
|
||||||
if (!checkIETarget(DNN_TARGET_MYRIAD))
|
|
||||||
throw SkipTestException("Myriad is not available/disabled in OpenCV");
|
|
||||||
}
|
|
||||||
|
|
||||||
Net net = readNetFromTensorflow(_tf("layer_elu_model.pb"));
|
Net net = readNetFromTensorflow(_tf("layer_elu_model.pb"));
|
||||||
ASSERT_FALSE(net.empty());
|
ASSERT_FALSE(net.empty());
|
||||||
|
|
||||||
|
@ -462,10 +462,9 @@ struct Hamming
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else // NO NEON and NOT GNUC
|
#else // NO NEON and NOT GNUC
|
||||||
typedef unsigned long long pop_t;
|
|
||||||
HammingLUT lut;
|
HammingLUT lut;
|
||||||
result = lut(reinterpret_cast<const unsigned char*> (a),
|
result = lut(reinterpret_cast<const unsigned char*> (a),
|
||||||
reinterpret_cast<const unsigned char*> (b), size * sizeof(pop_t));
|
reinterpret_cast<const unsigned char*> (b), size);
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,8 @@ double cvGetRatioWindow_GTK(const char* name);
|
|||||||
double cvGetOpenGlProp_W32(const char* name);
|
double cvGetOpenGlProp_W32(const char* name);
|
||||||
double cvGetOpenGlProp_GTK(const char* name);
|
double cvGetOpenGlProp_GTK(const char* name);
|
||||||
|
|
||||||
|
double cvGetPropVisible_W32(const char* name);
|
||||||
|
|
||||||
//for QT
|
//for QT
|
||||||
#if defined (HAVE_QT)
|
#if defined (HAVE_QT)
|
||||||
CvRect cvGetWindowRect_QT(const char* name);
|
CvRect cvGetWindowRect_QT(const char* name);
|
||||||
|
@ -152,6 +152,8 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
|
|||||||
case CV_WND_PROP_VISIBLE:
|
case CV_WND_PROP_VISIBLE:
|
||||||
#if defined (HAVE_QT)
|
#if defined (HAVE_QT)
|
||||||
return cvGetPropVisible_QT(name);
|
return cvGetPropVisible_QT(name);
|
||||||
|
#elif defined(HAVE_WIN32UI)
|
||||||
|
return cvGetPropVisible_W32(name);
|
||||||
#else
|
#else
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
|
@ -642,6 +642,24 @@ double cvGetOpenGlProp_W32(const char* name)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double cvGetPropVisible_W32(const char* name)
|
||||||
|
{
|
||||||
|
double result = -1;
|
||||||
|
|
||||||
|
CV_FUNCNAME( "cvGetPropVisible_W32" );
|
||||||
|
|
||||||
|
__BEGIN__;
|
||||||
|
|
||||||
|
if (!name)
|
||||||
|
CV_ERROR( CV_StsNullPtr, "NULL name string" );
|
||||||
|
|
||||||
|
result = (icvFindWindowByName( name ) != NULL);
|
||||||
|
|
||||||
|
__END__;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// OpenGL support
|
// OpenGL support
|
||||||
|
|
||||||
|
87
modules/imgproc/perf/perf_contours.cpp
Normal file
87
modules/imgproc/perf/perf_contours.cpp
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
// This file is part of OpenCV project.
|
||||||
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||||
|
// of this distribution and at http://opencv.org/license.html.
|
||||||
|
#include "perf_precomp.hpp"
|
||||||
|
|
||||||
|
namespace opencv_test {
|
||||||
|
|
||||||
|
CV_ENUM(RetrMode, RETR_EXTERNAL, RETR_LIST, RETR_CCOMP, RETR_TREE)
|
||||||
|
CV_ENUM(ApproxMode, CHAIN_APPROX_NONE, CHAIN_APPROX_SIMPLE, CHAIN_APPROX_TC89_L1, CHAIN_APPROX_TC89_KCOS)
|
||||||
|
|
||||||
|
typedef TestBaseWithParam< tuple<Size, RetrMode, ApproxMode, int> > TestFindContours;
|
||||||
|
|
||||||
|
PERF_TEST_P(TestFindContours, findContours,
|
||||||
|
Combine(
|
||||||
|
Values( szVGA, sz1080p ), // image size
|
||||||
|
RetrMode::all(), // retrieval mode
|
||||||
|
ApproxMode::all(), // approximation method
|
||||||
|
Values( 32, 128 ) // blob count
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Size img_size = get<0>(GetParam());
|
||||||
|
int retr_mode = get<1>(GetParam());
|
||||||
|
int approx_method = get<2>(GetParam());
|
||||||
|
int blob_count = get<3>(GetParam());
|
||||||
|
|
||||||
|
RNG rng;
|
||||||
|
Mat img = Mat::zeros(img_size, CV_8UC1);
|
||||||
|
for(int i = 0; i < blob_count; i++ )
|
||||||
|
{
|
||||||
|
Point center;
|
||||||
|
center.x = (unsigned)rng % (img.cols-2);
|
||||||
|
center.y = (unsigned)rng % (img.rows-2);
|
||||||
|
Size axes;
|
||||||
|
axes.width = ((unsigned)rng % 49 + 2)/2;
|
||||||
|
axes.height = ((unsigned)rng % 49 + 2)/2;
|
||||||
|
double angle = (unsigned)rng % 180;
|
||||||
|
int brightness = (unsigned)rng % 2;
|
||||||
|
|
||||||
|
// keep the border clear
|
||||||
|
ellipse( img(Rect(1,1,img.cols-2,img.rows-2)), Point(center), Size(axes), angle, 0., 360., Scalar(brightness), -1);
|
||||||
|
}
|
||||||
|
vector< vector<Point> > contours;
|
||||||
|
|
||||||
|
TEST_CYCLE() findContours( img, contours, retr_mode, approx_method );
|
||||||
|
|
||||||
|
SANITY_CHECK_NOTHING();
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef TestBaseWithParam< tuple<Size, ApproxMode, int> > TestFindContoursFF;
|
||||||
|
|
||||||
|
PERF_TEST_P(TestFindContoursFF, findContours,
|
||||||
|
Combine(
|
||||||
|
Values(szVGA, sz1080p), // image size
|
||||||
|
ApproxMode::all(), // approximation method
|
||||||
|
Values(32, 128) // blob count
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Size img_size = get<0>(GetParam());
|
||||||
|
int approx_method = get<1>(GetParam());
|
||||||
|
int blob_count = get<2>(GetParam());
|
||||||
|
|
||||||
|
RNG rng;
|
||||||
|
Mat img = Mat::zeros(img_size, CV_32SC1);
|
||||||
|
for (int i = 0; i < blob_count; i++)
|
||||||
|
{
|
||||||
|
Point center;
|
||||||
|
center.x = (unsigned)rng % (img.cols - 2);
|
||||||
|
center.y = (unsigned)rng % (img.rows - 2);
|
||||||
|
Size axes;
|
||||||
|
axes.width = ((unsigned)rng % 49 + 2) / 2;
|
||||||
|
axes.height = ((unsigned)rng % 49 + 2) / 2;
|
||||||
|
double angle = (unsigned)rng % 180;
|
||||||
|
int brightness = (unsigned)rng % 2;
|
||||||
|
|
||||||
|
// keep the border clear
|
||||||
|
ellipse(img(Rect(1, 1, img.cols - 2, img.rows - 2)), Point(center), Size(axes), angle, 0., 360., Scalar(brightness), -1);
|
||||||
|
}
|
||||||
|
vector< vector<Point> > contours;
|
||||||
|
|
||||||
|
TEST_CYCLE() findContours(img, contours, RETR_FLOODFILL, approx_method);
|
||||||
|
|
||||||
|
SANITY_CHECK_NOTHING();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
@ -41,6 +41,8 @@
|
|||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include "opencv2/core/hal/intrin.hpp"
|
#include "opencv2/core/hal/intrin.hpp"
|
||||||
|
|
||||||
|
using namespace cv;
|
||||||
|
|
||||||
/* initializes 8-element array for fast access to 3x3 neighborhood of a pixel */
|
/* initializes 8-element array for fast access to 3x3 neighborhood of a pixel */
|
||||||
#define CV_INIT_3X3_DELTAS( deltas, step, nch ) \
|
#define CV_INIT_3X3_DELTAS( deltas, step, nch ) \
|
||||||
((deltas)[0] = (nch), (deltas)[1] = -(step) + (nch), \
|
((deltas)[0] = (nch), (deltas)[1] = -(step) + (nch), \
|
||||||
@ -1006,10 +1008,6 @@ cvFindNextContour( CvContourScanner scanner )
|
|||||||
if( !scanner )
|
if( !scanner )
|
||||||
CV_Error( CV_StsNullPtr, "" );
|
CV_Error( CV_StsNullPtr, "" );
|
||||||
|
|
||||||
#if CV_SSE2
|
|
||||||
bool haveSIMD = cv::checkHardwareSupport(CPU_SSE2);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CV_Assert(scanner->img_step >= 0);
|
CV_Assert(scanner->img_step >= 0);
|
||||||
|
|
||||||
icvEndProcessContour( scanner );
|
icvEndProcessContour( scanner );
|
||||||
@ -1056,48 +1054,22 @@ cvFindNextContour( CvContourScanner scanner )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if CV_SSE2
|
#if CV_SIMD
|
||||||
if ((p = img[x]) != prev) {
|
if ((p = img[x]) != prev)
|
||||||
goto _next_contour;
|
{
|
||||||
} else if (haveSIMD) {
|
|
||||||
|
|
||||||
__m128i v_prev = _mm_set1_epi8((char)prev);
|
|
||||||
int v_size = width - 32;
|
|
||||||
|
|
||||||
for (; x <= v_size; x += 32) {
|
|
||||||
__m128i v_p1 = _mm_loadu_si128((const __m128i*)(img + x));
|
|
||||||
__m128i v_p2 = _mm_loadu_si128((const __m128i*)(img + x + 16));
|
|
||||||
|
|
||||||
__m128i v_cmp1 = _mm_cmpeq_epi8(v_p1, v_prev);
|
|
||||||
__m128i v_cmp2 = _mm_cmpeq_epi8(v_p2, v_prev);
|
|
||||||
|
|
||||||
unsigned int mask1 = _mm_movemask_epi8(v_cmp1);
|
|
||||||
unsigned int mask2 = _mm_movemask_epi8(v_cmp2);
|
|
||||||
|
|
||||||
mask1 ^= 0x0000ffff;
|
|
||||||
mask2 ^= 0x0000ffff;
|
|
||||||
|
|
||||||
if (mask1) {
|
|
||||||
p = img[(x += cv::trailingZeros32(mask1))];
|
|
||||||
goto _next_contour;
|
goto _next_contour;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (mask2) {
|
{
|
||||||
p = img[(x += cv::trailingZeros32(mask2 << 16))];
|
v_uint8 v_prev = vx_setall_u8((uchar)prev);
|
||||||
goto _next_contour;
|
for (; x <= width - v_uint8::nlanes; x += v_uint8::nlanes)
|
||||||
}
|
{
|
||||||
}
|
unsigned int mask = (unsigned int)v_signmask(vx_load((uchar*)(img + x)) != v_prev);
|
||||||
|
if (mask)
|
||||||
if(x <= width - 16) {
|
{
|
||||||
__m128i v_p = _mm_loadu_si128((__m128i*)(img + x));
|
|
||||||
|
|
||||||
unsigned int mask = _mm_movemask_epi8(_mm_cmpeq_epi8(v_p, v_prev)) ^ 0x0000ffff;
|
|
||||||
|
|
||||||
if (mask) {
|
|
||||||
p = img[(x += cv::trailingZeros32(mask))];
|
p = img[(x += cv::trailingZeros32(mask))];
|
||||||
goto _next_contour;
|
goto _next_contour;
|
||||||
}
|
}
|
||||||
x += 16;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1107,7 +1079,7 @@ cvFindNextContour( CvContourScanner scanner )
|
|||||||
|
|
||||||
if( x >= width )
|
if( x >= width )
|
||||||
break;
|
break;
|
||||||
#if CV_SSE2
|
#if CV_SIMD
|
||||||
_next_contour:
|
_next_contour:
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -1353,99 +1325,45 @@ typedef struct CvLinkedRunPoint
|
|||||||
}
|
}
|
||||||
CvLinkedRunPoint;
|
CvLinkedRunPoint;
|
||||||
|
|
||||||
inline int findStartContourPoint(uchar *src_data, CvSize img_size, int j, bool haveSIMD) {
|
inline int findStartContourPoint(uchar *src_data, CvSize img_size, int j)
|
||||||
#if CV_SSE2
|
{
|
||||||
if (haveSIMD) {
|
#if CV_SIMD
|
||||||
__m128i v_zero = _mm_setzero_si128();
|
v_uint8 v_zero = vx_setzero_u8();
|
||||||
int v_size = img_size.width - 32;
|
for (; j <= img_size.width - v_uint8::nlanes; j += v_uint8::nlanes)
|
||||||
|
{
|
||||||
for (; j <= v_size; j += 32) {
|
unsigned int mask = (unsigned int)v_signmask(vx_load((uchar*)(src_data + j)) != v_zero);
|
||||||
__m128i v_p1 = _mm_loadu_si128((const __m128i*)(src_data + j));
|
if (mask)
|
||||||
__m128i v_p2 = _mm_loadu_si128((const __m128i*)(src_data + j + 16));
|
{
|
||||||
|
|
||||||
__m128i v_cmp1 = _mm_cmpeq_epi8(v_p1, v_zero);
|
|
||||||
__m128i v_cmp2 = _mm_cmpeq_epi8(v_p2, v_zero);
|
|
||||||
|
|
||||||
unsigned int mask1 = _mm_movemask_epi8(v_cmp1);
|
|
||||||
unsigned int mask2 = _mm_movemask_epi8(v_cmp2);
|
|
||||||
|
|
||||||
mask1 ^= 0x0000ffff;
|
|
||||||
mask2 ^= 0x0000ffff;
|
|
||||||
|
|
||||||
if (mask1) {
|
|
||||||
j += cv::trailingZeros32(mask1);
|
|
||||||
return j;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mask2) {
|
|
||||||
j += cv::trailingZeros32(mask2 << 16);
|
|
||||||
return j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (j <= img_size.width - 16) {
|
|
||||||
__m128i v_p = _mm_loadu_si128((const __m128i*)(src_data + j));
|
|
||||||
|
|
||||||
unsigned int mask = _mm_movemask_epi8(_mm_cmpeq_epi8(v_p, v_zero)) ^ 0x0000ffff;
|
|
||||||
|
|
||||||
if (mask) {
|
|
||||||
j += cv::trailingZeros32(mask);
|
j += cv::trailingZeros32(mask);
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
j += 16;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#else
|
|
||||||
CV_UNUSED(haveSIMD);
|
|
||||||
#endif
|
#endif
|
||||||
for (; j < img_size.width && !src_data[j]; ++j)
|
for (; j < img_size.width && !src_data[j]; ++j)
|
||||||
;
|
;
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int findEndContourPoint(uchar *src_data, CvSize img_size, int j, bool haveSIMD) {
|
inline int findEndContourPoint(uchar *src_data, CvSize img_size, int j)
|
||||||
#if CV_SSE2
|
{
|
||||||
if (j < img_size.width && !src_data[j]) {
|
#if CV_SIMD
|
||||||
return j;
|
if (j < img_size.width && !src_data[j])
|
||||||
} else if (haveSIMD) {
|
{
|
||||||
__m128i v_zero = _mm_setzero_si128();
|
|
||||||
int v_size = img_size.width - 32;
|
|
||||||
|
|
||||||
for (; j <= v_size; j += 32) {
|
|
||||||
__m128i v_p1 = _mm_loadu_si128((const __m128i*)(src_data + j));
|
|
||||||
__m128i v_p2 = _mm_loadu_si128((const __m128i*)(src_data + j + 16));
|
|
||||||
|
|
||||||
__m128i v_cmp1 = _mm_cmpeq_epi8(v_p1, v_zero);
|
|
||||||
__m128i v_cmp2 = _mm_cmpeq_epi8(v_p2, v_zero);
|
|
||||||
|
|
||||||
unsigned int mask1 = _mm_movemask_epi8(v_cmp1);
|
|
||||||
unsigned int mask2 = _mm_movemask_epi8(v_cmp2);
|
|
||||||
|
|
||||||
if (mask1) {
|
|
||||||
j += cv::trailingZeros32(mask1);
|
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (mask2) {
|
{
|
||||||
j += cv::trailingZeros32(mask2 << 16);
|
v_uint8 v_zero = vx_setzero_u8();
|
||||||
return j;
|
for (; j <= img_size.width - v_uint8::nlanes; j += v_uint8::nlanes)
|
||||||
}
|
{
|
||||||
}
|
unsigned int mask = (unsigned int)v_signmask(vx_load((uchar*)(src_data + j)) == v_zero);
|
||||||
|
if (mask)
|
||||||
if (j <= img_size.width - 16) {
|
{
|
||||||
__m128i v_p = _mm_loadu_si128((const __m128i*)(src_data + j));
|
|
||||||
|
|
||||||
unsigned int mask = _mm_movemask_epi8(_mm_cmpeq_epi8(v_p, v_zero));
|
|
||||||
|
|
||||||
if (mask) {
|
|
||||||
j += cv::trailingZeros32(mask);
|
j += cv::trailingZeros32(mask);
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
j += 16;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
CV_UNUSED(haveSIMD);
|
|
||||||
#endif
|
#endif
|
||||||
for (; j < img_size.width && src_data[j]; ++j)
|
for (; j < img_size.width && src_data[j]; ++j)
|
||||||
;
|
;
|
||||||
@ -1475,7 +1393,6 @@ icvFindContoursInInterval( const CvArr* src,
|
|||||||
int lower_total;
|
int lower_total;
|
||||||
int upper_total;
|
int upper_total;
|
||||||
int all_total;
|
int all_total;
|
||||||
bool haveSIMD = false;
|
|
||||||
|
|
||||||
CvSeq* runs;
|
CvSeq* runs;
|
||||||
CvLinkedRunPoint tmp;
|
CvLinkedRunPoint tmp;
|
||||||
@ -1505,9 +1422,7 @@ icvFindContoursInInterval( const CvArr* src,
|
|||||||
|
|
||||||
if( contourHeaderSize < (int)sizeof(CvContour))
|
if( contourHeaderSize < (int)sizeof(CvContour))
|
||||||
CV_Error( CV_StsBadSize, "Contour header size must be >= sizeof(CvContour)" );
|
CV_Error( CV_StsBadSize, "Contour header size must be >= sizeof(CvContour)" );
|
||||||
#if CV_SSE2
|
|
||||||
haveSIMD = cv::checkHardwareSupport(CPU_SSE2);
|
|
||||||
#endif
|
|
||||||
storage00.reset(cvCreateChildMemStorage(storage));
|
storage00.reset(cvCreateChildMemStorage(storage));
|
||||||
storage01.reset(cvCreateChildMemStorage(storage));
|
storage01.reset(cvCreateChildMemStorage(storage));
|
||||||
|
|
||||||
@ -1540,7 +1455,7 @@ icvFindContoursInInterval( const CvArr* src,
|
|||||||
tmp_prev = upper_line;
|
tmp_prev = upper_line;
|
||||||
for( j = 0; j < img_size.width; )
|
for( j = 0; j < img_size.width; )
|
||||||
{
|
{
|
||||||
j = findStartContourPoint(src_data, cvSize(img_size), j, haveSIMD);
|
j = findStartContourPoint(src_data, cvSize(img_size), j);
|
||||||
|
|
||||||
if( j == img_size.width )
|
if( j == img_size.width )
|
||||||
break;
|
break;
|
||||||
@ -1550,7 +1465,7 @@ icvFindContoursInInterval( const CvArr* src,
|
|||||||
tmp_prev->next = (CvLinkedRunPoint*)CV_GET_WRITTEN_ELEM( writer );
|
tmp_prev->next = (CvLinkedRunPoint*)CV_GET_WRITTEN_ELEM( writer );
|
||||||
tmp_prev = tmp_prev->next;
|
tmp_prev = tmp_prev->next;
|
||||||
|
|
||||||
j = findEndContourPoint(src_data, cvSize(img_size), j + 1, haveSIMD);
|
j = findEndContourPoint(src_data, cvSize(img_size), j + 1);
|
||||||
|
|
||||||
tmp.pt.x = j - 1;
|
tmp.pt.x = j - 1;
|
||||||
CV_WRITE_SEQ_ELEM( tmp, writer );
|
CV_WRITE_SEQ_ELEM( tmp, writer );
|
||||||
@ -1574,7 +1489,7 @@ icvFindContoursInInterval( const CvArr* src,
|
|||||||
all_total = runs->total;
|
all_total = runs->total;
|
||||||
for( j = 0; j < img_size.width; )
|
for( j = 0; j < img_size.width; )
|
||||||
{
|
{
|
||||||
j = findStartContourPoint(src_data, cvSize(img_size), j, haveSIMD);
|
j = findStartContourPoint(src_data, cvSize(img_size), j);
|
||||||
|
|
||||||
if( j == img_size.width ) break;
|
if( j == img_size.width ) break;
|
||||||
|
|
||||||
@ -1583,7 +1498,7 @@ icvFindContoursInInterval( const CvArr* src,
|
|||||||
tmp_prev->next = (CvLinkedRunPoint*)CV_GET_WRITTEN_ELEM( writer );
|
tmp_prev->next = (CvLinkedRunPoint*)CV_GET_WRITTEN_ELEM( writer );
|
||||||
tmp_prev = tmp_prev->next;
|
tmp_prev = tmp_prev->next;
|
||||||
|
|
||||||
j = findEndContourPoint(src_data, cvSize(img_size), j + 1, haveSIMD);
|
j = findEndContourPoint(src_data, cvSize(img_size), j + 1);
|
||||||
|
|
||||||
tmp.pt.x = j - 1;
|
tmp.pt.x = j - 1;
|
||||||
CV_WRITE_SEQ_ELEM( tmp, writer );
|
CV_WRITE_SEQ_ELEM( tmp, writer );
|
||||||
|
@ -122,6 +122,8 @@ endif()
|
|||||||
|
|
||||||
if(NOT " ${PYTHON}" STREQUAL " PYTHON" AND DEFINED OPENCV_${PYTHON}_INSTALL_PATH)
|
if(NOT " ${PYTHON}" STREQUAL " PYTHON" AND DEFINED OPENCV_${PYTHON}_INSTALL_PATH)
|
||||||
set(__python_binary_install_path "${OPENCV_${PYTHON}_INSTALL_PATH}")
|
set(__python_binary_install_path "${OPENCV_${PYTHON}_INSTALL_PATH}")
|
||||||
|
elseif(OPENCV_SKIP_PYTHON_LOADER AND DEFINED ${PYTHON}_PACKAGES_PATH)
|
||||||
|
set(__python_binary_install_path "${${PYTHON}_PACKAGES_PATH}")
|
||||||
else()
|
else()
|
||||||
ocv_assert(DEFINED OPENCV_PYTHON_INSTALL_PATH)
|
ocv_assert(DEFINED OPENCV_PYTHON_INSTALL_PATH)
|
||||||
set(__python_binary_install_path "${OPENCV_PYTHON_INSTALL_PATH}/${__python_loader_subdir}python-${${PYTHON}_VERSION_MAJOR}.${${PYTHON}_VERSION_MINOR}")
|
set(__python_binary_install_path "${OPENCV_PYTHON_INSTALL_PATH}/${__python_loader_subdir}python-${${PYTHON}_VERSION_MAJOR}.${${PYTHON}_VERSION_MINOR}")
|
||||||
@ -134,6 +136,8 @@ install(TARGETS ${the_module}
|
|||||||
${PYTHON_INSTALL_ARCHIVE}
|
${PYTHON_INSTALL_ARCHIVE}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(__INSTALL_PATH_${PYTHON} "${__python_binary_install_path}" CACHE INTERNAL "") # CMake status
|
||||||
|
|
||||||
if(NOT OPENCV_SKIP_PYTHON_LOADER)
|
if(NOT OPENCV_SKIP_PYTHON_LOADER)
|
||||||
ocv_assert(DEFINED OPENCV_PYTHON_INSTALL_PATH)
|
ocv_assert(DEFINED OPENCV_PYTHON_INSTALL_PATH)
|
||||||
if(OpenCV_FOUND)
|
if(OpenCV_FOUND)
|
||||||
@ -143,12 +147,11 @@ if(NOT OPENCV_SKIP_PYTHON_LOADER)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(__python_loader_install_tmp_path "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/install/python_loader/")
|
set(__python_loader_install_tmp_path "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/install/python_loader/")
|
||||||
|
set(OpenCV_PYTHON_LOADER_FULL_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_PYTHON_INSTALL_PATH}/cv2")
|
||||||
if(IS_ABSOLUTE "${OPENCV_PYTHON_INSTALL_PATH}")
|
if(IS_ABSOLUTE "${OPENCV_PYTHON_INSTALL_PATH}")
|
||||||
set(OpenCV_PYTHON_INSTALL_PATH_RELATIVE_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/")
|
set(CMAKE_PYTHON_EXTENSION_INSTALL_PATH_BASE "'${OPENCV_PYTHON_INSTALL_PATH}/cv2'")
|
||||||
set(CMAKE_PYTHON_EXTENSION_INSTALL_PATH_BASE "'${CMAKE_INSTALL_PREFIX}'")
|
|
||||||
else()
|
else()
|
||||||
file(RELATIVE_PATH OpenCV_PYTHON_INSTALL_PATH_RELATIVE_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/${OPENCV_PYTHON_INSTALL_PATH}/cv2" ${CMAKE_INSTALL_PREFIX})
|
set(CMAKE_PYTHON_EXTENSION_INSTALL_PATH_BASE "LOADER_DIR")
|
||||||
set(CMAKE_PYTHON_EXTENSION_INSTALL_PATH_BASE "os.path.join(LOADER_DIR, '${OpenCV_PYTHON_INSTALL_PATH_RELATIVE_CONFIGCMAKE}')")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(DEFINED ${PYTHON}_VERSION_MINOR)
|
if(DEFINED ${PYTHON}_VERSION_MINOR)
|
||||||
@ -167,7 +170,8 @@ if(NOT OPENCV_SKIP_PYTHON_LOADER)
|
|||||||
if(IS_ABSOLUTE __python_binary_install_path)
|
if(IS_ABSOLUTE __python_binary_install_path)
|
||||||
set(CMAKE_PYTHON_EXTENSION_PATH "'${__python_binary_install_path}'")
|
set(CMAKE_PYTHON_EXTENSION_PATH "'${__python_binary_install_path}'")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_PYTHON_EXTENSION_PATH "os.path.join(${CMAKE_PYTHON_EXTENSION_INSTALL_PATH_BASE}, '${__python_binary_install_path}')")
|
file(RELATIVE_PATH OpenCV_PYTHON_BINARY_RELATIVE_INSTALL_PATH "${OpenCV_PYTHON_LOADER_FULL_INSTALL_PATH}" "${CMAKE_INSTALL_PREFIX}/${__python_binary_install_path}")
|
||||||
|
set(CMAKE_PYTHON_EXTENSION_PATH "os.path.join(${CMAKE_PYTHON_EXTENSION_INSTALL_PATH_BASE}, '${OpenCV_PYTHON_BINARY_RELATIVE_INSTALL_PATH}')")
|
||||||
endif()
|
endif()
|
||||||
configure_file("${PYTHON_SOURCE_DIR}/package/template/config-x.y.py.in" "${__python_loader_install_tmp_path}/cv2/${__target_config}" @ONLY)
|
configure_file("${PYTHON_SOURCE_DIR}/package/template/config-x.y.py.in" "${__python_loader_install_tmp_path}/cv2/${__target_config}" @ONLY)
|
||||||
install(FILES "${__python_loader_install_tmp_path}/cv2/${__target_config}" DESTINATION "${OPENCV_PYTHON_INSTALL_PATH}/cv2/" COMPONENT python)
|
install(FILES "${__python_loader_install_tmp_path}/cv2/${__target_config}" DESTINATION "${OPENCV_PYTHON_INSTALL_PATH}/cv2/" COMPONENT python)
|
||||||
|
Loading…
Reference in New Issue
Block a user