mirror of
https://github.com/opencv/opencv.git
synced 2026-07-25 21:33:04 +04:00
Compare commits
38 Commits
4.5.3-openvino
...
3.4.15
| Author | SHA1 | Date | |
|---|---|---|---|
| 591708903b | |||
| f9d62fba7a | |||
| 9d039c206b | |||
| 4c3f9b2ef4 | |||
| 0e523618a1 | |||
| 3b26105f68 | |||
| 0f2f966a91 | |||
| d7d491d445 | |||
| 9b0d6862c4 | |||
| 890fcdf842 | |||
| 18dbac203f | |||
| 8d1f254dcc | |||
| 90df3af6cf | |||
| b699fe7a9d | |||
| b2ed5c3070 | |||
| 5b8c10f2f8 | |||
| 24983f62e2 | |||
| f2057ce1ab | |||
| 6797fd65a5 | |||
| 947e06a860 | |||
| 04d5ba266f | |||
| 90be83ae99 | |||
| 5e80bd3cc9 | |||
| db4b1e613c | |||
| 7d842f5bcf | |||
| 828304d587 | |||
| 9d584475f6 | |||
| bb60cb0bf9 | |||
| 55e1dfb778 | |||
| c2263db7bc | |||
| 7bbbda71df | |||
| 8e0baf257c | |||
| c8268e65fd | |||
| 3cf4375387 | |||
| c1adbe3189 | |||
| 7ee1816612 | |||
| 8f4f834ce6 | |||
| 411fd2b761 |
@@ -177,7 +177,13 @@ if(CV_GCC OR CV_CLANG)
|
||||
endif()
|
||||
|
||||
# We need pthread's
|
||||
if(UNIX AND NOT ANDROID AND NOT (APPLE AND CV_CLANG)) # TODO
|
||||
if((UNIX
|
||||
AND NOT ANDROID
|
||||
AND NOT (APPLE AND CV_CLANG)
|
||||
AND NOT EMSCRIPTEN
|
||||
)
|
||||
OR (EMSCRIPTEN AND WITH_PTHREADS_PF) # https://github.com/opencv/opencv/issues/20285
|
||||
)
|
||||
add_extra_compiler_option(-pthread)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -9,9 +9,14 @@ set(HALIDE_ROOT_DIR "${HALIDE_ROOT_DIR}" CACHE PATH "Halide root directory")
|
||||
if(NOT HAVE_HALIDE)
|
||||
find_package(Halide QUIET) # Try CMake-based config files
|
||||
if(Halide_FOUND)
|
||||
set(HALIDE_INCLUDE_DIRS "${Halide_INCLUDE_DIRS}" CACHE PATH "Halide include directories" FORCE)
|
||||
set(HALIDE_LIBRARIES "${Halide_LIBRARIES}" CACHE PATH "Halide libraries" FORCE)
|
||||
set(HAVE_HALIDE TRUE)
|
||||
if(TARGET Halide::Halide) # modern Halide scripts defines imported target
|
||||
set(HALIDE_INCLUDE_DIRS "")
|
||||
set(HALIDE_LIBRARIES "Halide::Halide")
|
||||
set(HAVE_HALIDE TRUE)
|
||||
else()
|
||||
# using HALIDE_INCLUDE_DIRS / Halide_LIBRARIES
|
||||
set(HAVE_HALIDE TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -28,18 +33,15 @@ if(NOT HAVE_HALIDE AND HALIDE_ROOT_DIR)
|
||||
)
|
||||
if(HALIDE_LIBRARY AND HALIDE_INCLUDE_DIR)
|
||||
# TODO try_compile
|
||||
set(HALIDE_INCLUDE_DIRS "${HALIDE_INCLUDE_DIR}" CACHE PATH "Halide include directories" FORCE)
|
||||
set(HALIDE_LIBRARIES "${HALIDE_LIBRARY}" CACHE PATH "Halide libraries" FORCE)
|
||||
set(HALIDE_INCLUDE_DIRS "${HALIDE_INCLUDE_DIR}")
|
||||
set(HALIDE_LIBRARIES "${HALIDE_LIBRARY}")
|
||||
set(HAVE_HALIDE TRUE)
|
||||
endif()
|
||||
if(NOT HAVE_HALIDE)
|
||||
ocv_clear_vars(HALIDE_LIBRARIES HALIDE_INCLUDE_DIRS CACHE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(HAVE_HALIDE)
|
||||
include_directories(${HALIDE_INCLUDE_DIRS})
|
||||
if(HALIDE_INCLUDE_DIRS)
|
||||
include_directories(${HALIDE_INCLUDE_DIRS})
|
||||
endif()
|
||||
list(APPEND OPENCV_LINKER_LIBS ${HALIDE_LIBRARIES})
|
||||
else()
|
||||
ocv_clear_vars(HALIDE_INCLUDE_DIRS HALIDE_LIBRARIES)
|
||||
endif()
|
||||
|
||||
@@ -140,12 +140,21 @@ endif()
|
||||
# Add more features to the target
|
||||
|
||||
if(INF_ENGINE_TARGET)
|
||||
if(NOT INF_ENGINE_RELEASE)
|
||||
message(WARNING "InferenceEngine version has not been set, 2021.3 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
|
||||
if(DEFINED InferenceEngine_VERSION)
|
||||
message(STATUS "InferenceEngine: ${InferenceEngine_VERSION}")
|
||||
if(NOT INF_ENGINE_RELEASE AND NOT (InferenceEngine_VERSION VERSION_LESS "2021.4"))
|
||||
math(EXPR INF_ENGINE_RELEASE_INIT "${InferenceEngine_VERSION_MAJOR} * 1000000 + ${InferenceEngine_VERSION_MINOR} * 10000 + ${InferenceEngine_VERSION_PATCH} * 100")
|
||||
endif()
|
||||
endif()
|
||||
set(INF_ENGINE_RELEASE "2021030000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2020.1.0.2 -> 2020010002)")
|
||||
if(NOT INF_ENGINE_RELEASE AND NOT INF_ENGINE_RELEASE_INIT)
|
||||
message(WARNING "InferenceEngine version has not been set, 2021.4 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
|
||||
set(INF_ENGINE_RELEASE_INIT "2021040000")
|
||||
elseif(DEFINED INF_ENGINE_RELEASE)
|
||||
set(INF_ENGINE_RELEASE_INIT "${INF_ENGINE_RELEASE}")
|
||||
endif()
|
||||
set(INF_ENGINE_RELEASE "${INF_ENGINE_RELEASE_INIT}" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2020.1.0.2 -> 2020010002)")
|
||||
set_target_properties(${INF_ENGINE_TARGET} PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}"
|
||||
INTERFACE_COMPILE_DEFINITIONS "HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
# define OPENCV_HAVE_FILESYSTEM_SUPPORT 1
|
||||
# elif defined(__APPLE__)
|
||||
# include <TargetConditionals.h>
|
||||
# if (defined(TARGET_OS_OSX) && TARGET_OS_OSX) || (!defined(TARGET_OS_OSX) && !TARGET_OS_IPHONE)
|
||||
# define OPENCV_HAVE_FILESYSTEM_SUPPORT 1 // OSX only
|
||||
# if (defined(TARGET_OS_OSX) && TARGET_OS_OSX) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
|
||||
# define OPENCV_HAVE_FILESYSTEM_SUPPORT 1 // OSX, iOS only
|
||||
# endif
|
||||
# else
|
||||
/* unknown */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define CV_VERSION_MAJOR 3
|
||||
#define CV_VERSION_MINOR 4
|
||||
#define CV_VERSION_REVISION 15
|
||||
#define CV_VERSION_STATUS "-pre"
|
||||
#define CV_VERSION_STATUS ""
|
||||
|
||||
#define CVAUX_STR_EXP(__A) #__A
|
||||
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
|
||||
|
||||
@@ -1171,7 +1171,7 @@ double norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask
|
||||
// special case to handle "integer" overflow in accumulator
|
||||
const size_t esz = src1.elemSize();
|
||||
const int total = (int)it.size;
|
||||
const int intSumBlockSize = normType == NORM_L1 && depth <= CV_8S ? (1 << 23) : (1 << 15);
|
||||
const int intSumBlockSize = (normType == NORM_L1 && depth <= CV_8S ? (1 << 23) : (1 << 15))/cn;
|
||||
const int blockSize = std::min(total, intSumBlockSize);
|
||||
int isum = 0;
|
||||
int count = 0;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "precomp.hpp"
|
||||
#include "persistence.hpp"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
char* icv_itoa( int _val, char* buffer, int /*radix*/ )
|
||||
{
|
||||
const int radix = 10;
|
||||
@@ -519,12 +521,16 @@ static const char symbols[9] = "ucwsifdr";
|
||||
|
||||
char icvTypeSymbol(int depth)
|
||||
{
|
||||
CV_Assert(depth >=0 && depth < 9);
|
||||
CV_StaticAssert(CV_64F == 6, "");
|
||||
CV_Assert(depth >=0 && depth <= CV_64F);
|
||||
CV_CheckDepth(depth, depth >=0 && depth <= CV_64F, "");
|
||||
return symbols[depth];
|
||||
}
|
||||
|
||||
static int icvSymbolToType(char c)
|
||||
{
|
||||
if (c == 'r')
|
||||
return CV_SEQ_ELTYPE_PTR;
|
||||
const char* pos = strchr( symbols, c );
|
||||
if( !pos )
|
||||
CV_Error( CV_StsBadArg, "Invalid data type specification" );
|
||||
@@ -618,8 +624,12 @@ int icvCalcStructSize( const char* dt, int initial_size )
|
||||
{
|
||||
int size = icvCalcElemSize( dt, initial_size );
|
||||
size_t elem_max_size = 0;
|
||||
for ( const char * type = dt; *type != '\0'; type++ ) {
|
||||
switch ( *type )
|
||||
for ( const char * type = dt; *type != '\0'; type++ )
|
||||
{
|
||||
char v = *type;
|
||||
if (v >= '0' && v <= '9')
|
||||
continue; // skip vector size
|
||||
switch (v)
|
||||
{
|
||||
case 'u': { elem_max_size = std::max( elem_max_size, sizeof(uchar ) ); break; }
|
||||
case 'c': { elem_max_size = std::max( elem_max_size, sizeof(schar ) ); break; }
|
||||
@@ -628,7 +638,8 @@ int icvCalcStructSize( const char* dt, int initial_size )
|
||||
case 'i': { elem_max_size = std::max( elem_max_size, sizeof(int ) ); break; }
|
||||
case 'f': { elem_max_size = std::max( elem_max_size, sizeof(float ) ); break; }
|
||||
case 'd': { elem_max_size = std::max( elem_max_size, sizeof(double) ); break; }
|
||||
default: break;
|
||||
default:
|
||||
CV_Error_(Error::StsNotImplemented, ("Unknown type identifier: '%c' in '%s'", (char)(*type), dt));
|
||||
}
|
||||
}
|
||||
size = cvAlign( size, static_cast<int>(elem_max_size) );
|
||||
|
||||
@@ -2117,6 +2117,15 @@ TEST(Core_Norm, IPP_regression_NORM_L1_16UC3_small)
|
||||
EXPECT_EQ((double)20*cn, cv::norm(a, b, NORM_L1, mask));
|
||||
}
|
||||
|
||||
TEST(Core_Norm, NORM_L2_8UC4)
|
||||
{
|
||||
// Tests there is no integer overflow in norm computation for multiple channels.
|
||||
const int kSide = 100;
|
||||
cv::Mat4b a(kSide, kSide, cv::Scalar(255, 255, 255, 255));
|
||||
cv::Mat4b b = cv::Mat4b::zeros(kSide, kSide);
|
||||
const double kNorm = 2.*kSide*255.;
|
||||
EXPECT_EQ(kNorm, cv::norm(a, b, NORM_L2));
|
||||
}
|
||||
|
||||
TEST(Core_ConvertTo, regression_12121)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
]
|
||||
|
||||
],
|
||||
"jni_name": "(*(cv::dnn::DictValue*)%(n)s_nativeObj)",
|
||||
"jni_name": "(*(*(Ptr<cv::dnn::DictValue>*)%(n)s_nativeObj))",
|
||||
"jni_type": "jlong",
|
||||
"suffix": "J",
|
||||
"j_import": "org.opencv.dnn.DictValue"
|
||||
|
||||
@@ -654,7 +654,11 @@ void InfEngineNgraphNet::initPlugin(InferenceEngine::CNNNetwork& net)
|
||||
try
|
||||
{
|
||||
InferenceEngine::IExtensionPtr extension =
|
||||
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2021_4)
|
||||
std::make_shared<InferenceEngine::Extension>(libName);
|
||||
#else
|
||||
InferenceEngine::make_so_pointer<InferenceEngine::IExtension>(libName);
|
||||
#endif
|
||||
|
||||
ie.AddExtension(extension, "CPU");
|
||||
CV_LOG_INFO(NULL, "DNN-IE: Loaded extension plugin: " << libName);
|
||||
@@ -1002,35 +1006,54 @@ void InfEngineNgraphNet::forward(const std::vector<Ptr<BackendWrapper> >& outBlo
|
||||
reqWrapper->req.SetInput(inpBlobs);
|
||||
reqWrapper->req.SetOutput(outBlobs);
|
||||
|
||||
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2021_4)
|
||||
InferenceEngine::InferRequest infRequest = reqWrapper->req;
|
||||
NgraphReqWrapper* wrapperPtr = reqWrapper.get();
|
||||
CV_Assert(wrapperPtr && "Internal error");
|
||||
#else
|
||||
InferenceEngine::IInferRequest::Ptr infRequestPtr = reqWrapper->req;
|
||||
infRequestPtr->SetUserData(reqWrapper.get(), 0);
|
||||
CV_Assert(infRequestPtr);
|
||||
InferenceEngine::IInferRequest& infRequest = *infRequestPtr.get();
|
||||
infRequest.SetUserData(reqWrapper.get(), 0);
|
||||
#endif
|
||||
|
||||
infRequestPtr->SetCompletionCallback(
|
||||
[](InferenceEngine::IInferRequest::Ptr request, InferenceEngine::StatusCode status)
|
||||
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2021_4)
|
||||
// do NOT capture 'reqWrapper' (smart ptr) in the lambda callback
|
||||
infRequest.SetCompletionCallback<std::function<void(InferenceEngine::InferRequest, InferenceEngine::StatusCode)>>(
|
||||
[wrapperPtr](InferenceEngine::InferRequest /*request*/, InferenceEngine::StatusCode status)
|
||||
#else
|
||||
infRequest.SetCompletionCallback(
|
||||
[](InferenceEngine::IInferRequest::Ptr requestPtr, InferenceEngine::StatusCode status)
|
||||
#endif
|
||||
{
|
||||
CV_LOG_DEBUG(NULL, "DNN(nGraph): completionCallback(" << (int)status << ")");
|
||||
#if !INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2021_4)
|
||||
CV_Assert(requestPtr);
|
||||
InferenceEngine::IInferRequest& request = *requestPtr.get();
|
||||
|
||||
NgraphReqWrapper* wrapper;
|
||||
request->GetUserData((void**)&wrapper, 0);
|
||||
CV_Assert(wrapper && "Internal error");
|
||||
NgraphReqWrapper* wrapperPtr;
|
||||
request.GetUserData((void**)&wrapperPtr, 0);
|
||||
CV_Assert(wrapperPtr && "Internal error");
|
||||
#endif
|
||||
NgraphReqWrapper& wrapper = *wrapperPtr;
|
||||
|
||||
size_t processedOutputs = 0;
|
||||
try
|
||||
{
|
||||
for (; processedOutputs < wrapper->outProms.size(); ++processedOutputs)
|
||||
for (; processedOutputs < wrapper.outProms.size(); ++processedOutputs)
|
||||
{
|
||||
const std::string& name = wrapper->outsNames[processedOutputs];
|
||||
Mat m = ngraphBlobToMat(wrapper->req.GetBlob(name));
|
||||
const std::string& name = wrapper.outsNames[processedOutputs];
|
||||
Mat m = ngraphBlobToMat(wrapper.req.GetBlob(name));
|
||||
|
||||
try
|
||||
{
|
||||
CV_Assert(status == InferenceEngine::StatusCode::OK);
|
||||
wrapper->outProms[processedOutputs].setValue(m.clone());
|
||||
wrapper.outProms[processedOutputs].setValue(m.clone());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
try {
|
||||
wrapper->outProms[processedOutputs].setException(std::current_exception());
|
||||
wrapper.outProms[processedOutputs].setException(std::current_exception());
|
||||
} catch(...) {
|
||||
CV_LOG_ERROR(NULL, "DNN: Exception occurred during async inference exception propagation");
|
||||
}
|
||||
@@ -1040,16 +1063,16 @@ void InfEngineNgraphNet::forward(const std::vector<Ptr<BackendWrapper> >& outBlo
|
||||
catch (...)
|
||||
{
|
||||
std::exception_ptr e = std::current_exception();
|
||||
for (; processedOutputs < wrapper->outProms.size(); ++processedOutputs)
|
||||
for (; processedOutputs < wrapper.outProms.size(); ++processedOutputs)
|
||||
{
|
||||
try {
|
||||
wrapper->outProms[processedOutputs].setException(e);
|
||||
wrapper.outProms[processedOutputs].setException(e);
|
||||
} catch(...) {
|
||||
CV_LOG_ERROR(NULL, "DNN: Exception occurred during async inference exception propagation");
|
||||
}
|
||||
}
|
||||
}
|
||||
wrapper->isReady = true;
|
||||
wrapper.isReady = true;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace dnn
|
||||
class BatchNormLayerImpl CV_FINAL : public BatchNormLayer
|
||||
{
|
||||
public:
|
||||
Mat origin_weights, origin_bias;
|
||||
Mat weights_, bias_;
|
||||
UMat umat_weight, umat_bias;
|
||||
mutable int dims;
|
||||
@@ -82,11 +83,11 @@ public:
|
||||
const float* weightsData = hasWeights ? blobs[weightsBlobIndex].ptr<float>() : 0;
|
||||
const float* biasData = hasBias ? blobs[biasBlobIndex].ptr<float>() : 0;
|
||||
|
||||
weights_.create(1, (int)n, CV_32F);
|
||||
bias_.create(1, (int)n, CV_32F);
|
||||
origin_weights.create(1, (int)n, CV_32F);
|
||||
origin_bias.create(1, (int)n, CV_32F);
|
||||
|
||||
float* dstWeightsData = weights_.ptr<float>();
|
||||
float* dstBiasData = bias_.ptr<float>();
|
||||
float* dstWeightsData = origin_weights.ptr<float>();
|
||||
float* dstBiasData = origin_bias.ptr<float>();
|
||||
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
{
|
||||
@@ -94,15 +95,12 @@ public:
|
||||
dstWeightsData[i] = w;
|
||||
dstBiasData[i] = (hasBias ? biasData[i] : 0.0f) - w * meanData[i] * varMeanScale;
|
||||
}
|
||||
// We will use blobs to store origin weights and bias to restore them in case of reinitialization.
|
||||
weights_.copyTo(blobs[0].reshape(1, 1));
|
||||
bias_.copyTo(blobs[1].reshape(1, 1));
|
||||
}
|
||||
|
||||
virtual void finalize(InputArrayOfArrays, OutputArrayOfArrays) CV_OVERRIDE
|
||||
{
|
||||
blobs[0].reshape(1, 1).copyTo(weights_);
|
||||
blobs[1].reshape(1, 1).copyTo(bias_);
|
||||
origin_weights.reshape(1, 1).copyTo(weights_);
|
||||
origin_bias.reshape(1, 1).copyTo(bias_);
|
||||
}
|
||||
|
||||
void getScaleShift(Mat& scale, Mat& shift) const CV_OVERRIDE
|
||||
|
||||
@@ -328,7 +328,7 @@ public:
|
||||
std::iota(axes_data.begin(), axes_data.end(), 1);
|
||||
}
|
||||
auto axes = std::make_shared<ngraph::op::Constant>(ngraph::element::i64, ngraph::Shape{axes_data.size()}, axes_data);
|
||||
auto norm = std::make_shared<ngraph::op::NormalizeL2>(ieInpNode, axes, epsilon, ngraph::op::EpsMode::ADD);
|
||||
auto norm = std::make_shared<ngraph::op::v0::NormalizeL2>(ieInpNode, axes, epsilon, ngraph::op::EpsMode::ADD);
|
||||
|
||||
CV_Assert(blobs.empty() || numChannels == blobs[0].total());
|
||||
std::vector<size_t> shape(ieInpNode->get_shape().size(), 1);
|
||||
|
||||
@@ -1792,6 +1792,23 @@ void ONNXImporter::handleNode(const opencv_onnx::NodeProto& node_proto_)
|
||||
addConstant(layerParams.name, concatenated[0]);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < node_proto.input_size(); ++i)
|
||||
{
|
||||
if (constBlobs.find(node_proto.input(i)) != constBlobs.end())
|
||||
{
|
||||
LayerParams constParams;
|
||||
constParams.name = node_proto.input(i);
|
||||
constParams.type = "Const";
|
||||
constParams.blobs.push_back(getBlob(node_proto, i));
|
||||
|
||||
opencv_onnx::NodeProto proto;
|
||||
proto.add_output(constParams.name);
|
||||
addLayer(constParams, proto);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (layer_type == "Resize")
|
||||
{
|
||||
|
||||
@@ -30,10 +30,11 @@
|
||||
#define INF_ENGINE_RELEASE_2021_1 2021010000
|
||||
#define INF_ENGINE_RELEASE_2021_2 2021020000
|
||||
#define INF_ENGINE_RELEASE_2021_3 2021030000
|
||||
#define INF_ENGINE_RELEASE_2021_4 2021040000
|
||||
|
||||
#ifndef INF_ENGINE_RELEASE
|
||||
#warning("IE version have not been provided via command-line. Using 2021.3 by default")
|
||||
#define INF_ENGINE_RELEASE INF_ENGINE_RELEASE_2021_3
|
||||
#warning("IE version have not been provided via command-line. Using 2021.4 by default")
|
||||
#define INF_ENGINE_RELEASE INF_ENGINE_RELEASE_2021_4
|
||||
#endif
|
||||
|
||||
#define INF_ENGINE_VER_MAJOR_GT(ver) (((INF_ENGINE_RELEASE) / 10000) > ((ver) / 10000))
|
||||
|
||||
+1833
-1610
File diff suppressed because it is too large
Load Diff
@@ -196,7 +196,7 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_Caffe)
|
||||
Mat inp = blobFromImage(sample, 1.0f / 127.5, Size(300, 300), Scalar(127.5, 127.5, 127.5), false);
|
||||
float diffScores = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 1.5e-2 : 0.0;
|
||||
float diffSquares = (target == DNN_TARGET_MYRIAD) ? 0.063 : 0.0;
|
||||
float detectionConfThresh = (target == DNN_TARGET_MYRIAD) ? 0.252 : FLT_MIN;
|
||||
float detectionConfThresh = (target == DNN_TARGET_MYRIAD) ? 0.262 : FLT_MIN;
|
||||
processNet("dnn/MobileNetSSD_deploy.caffemodel", "dnn/MobileNetSSD_deploy.prototxt",
|
||||
inp, "detection_out", "", diffScores, diffSquares, detectionConfThresh);
|
||||
expectNoFallbacksFromIE(net);
|
||||
@@ -301,8 +301,8 @@ TEST_P(DNNTestNetwork, OpenPose_pose_coco)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
|
||||
#endif
|
||||
|
||||
const float l1 = (target == DNN_TARGET_MYRIAD) ? 0.0056 : 0.0;
|
||||
const float lInf = (target == DNN_TARGET_MYRIAD) ? 0.072 : 0.0;
|
||||
const float l1 = (target == DNN_TARGET_MYRIAD) ? 0.009 : 0.0;
|
||||
const float lInf = (target == DNN_TARGET_MYRIAD) ? 0.09 : 0.0;
|
||||
processNet("dnn/openpose_pose_coco.caffemodel", "dnn/openpose_pose_coco.prototxt",
|
||||
Size(46, 46), "", "", l1, lInf);
|
||||
expectNoFallbacksFromIE(net);
|
||||
@@ -321,8 +321,8 @@ TEST_P(DNNTestNetwork, OpenPose_pose_mpi)
|
||||
#endif
|
||||
|
||||
// output range: [-0.001, 0.97]
|
||||
const float l1 = (target == DNN_TARGET_MYRIAD) ? 0.012 : 0.0;
|
||||
const float lInf = (target == DNN_TARGET_MYRIAD || target == DNN_TARGET_OPENCL_FP16) ? 0.16 : 0.0;
|
||||
const float l1 = (target == DNN_TARGET_MYRIAD) ? 0.02 : 0.0;
|
||||
const float lInf = (target == DNN_TARGET_MYRIAD || target == DNN_TARGET_OPENCL_FP16) ? 0.2 : 0.0;
|
||||
processNet("dnn/openpose_pose_mpi.caffemodel", "dnn/openpose_pose_mpi.prototxt",
|
||||
Size(46, 46), "", "", l1, lInf);
|
||||
expectNoFallbacksFromIE(net);
|
||||
|
||||
@@ -288,6 +288,15 @@ TEST_P(DNNTestOpenVINO, models)
|
||||
ASSERT_FALSE(backendId != DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && backendId != DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) <<
|
||||
"Inference Engine backend is required";
|
||||
|
||||
#if INF_ENGINE_VER_MAJOR_EQ(2021040000)
|
||||
if (targetId == DNN_TARGET_MYRIAD && (
|
||||
modelName == "person-detection-retail-0013" || // ncDeviceOpen:1013 Failed to find booted device after boot
|
||||
modelName == "age-gender-recognition-retail-0013" // ncDeviceOpen:1013 Failed to find booted device after boot
|
||||
)
|
||||
)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_DNN_BACKEND_INFERENCE_ENGINE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
|
||||
#endif
|
||||
|
||||
#if INF_ENGINE_VER_MAJOR_GE(2020020000)
|
||||
if (targetId == DNN_TARGET_MYRIAD && backendId == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
|
||||
{
|
||||
|
||||
@@ -327,6 +327,7 @@ TEST_P(Test_ONNX_layers, Concatenation)
|
||||
if (target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER);
|
||||
}
|
||||
testONNXModels("concatenation");
|
||||
testONNXModels("concat_const_blobs");
|
||||
}
|
||||
|
||||
TEST_P(Test_ONNX_layers, Eltwise3D)
|
||||
|
||||
@@ -254,9 +254,14 @@ TEST_P(Test_Torch_layers, net_padding)
|
||||
|
||||
TEST_P(Test_Torch_layers, net_non_spatial)
|
||||
{
|
||||
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000)
|
||||
#if defined(INF_ENGINE_RELEASE) && ( \
|
||||
INF_ENGINE_VER_MAJOR_EQ(2021030000) || \
|
||||
INF_ENGINE_VER_MAJOR_EQ(2021040000) \
|
||||
)
|
||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // crash
|
||||
// 2021.3: crash
|
||||
// 2021.4: [ GENERAL_ERROR ] AssertionFailed: !out.networkInputs.empty()
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
|
||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception
|
||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16)
|
||||
|
||||
@@ -1314,6 +1314,13 @@ CV_EXPORTS_W void drawMatches( InputArray img1, const std::vector<KeyPoint>& key
|
||||
const std::vector<char>& matchesMask=std::vector<char>(), int flags=DrawMatchesFlags::DEFAULT );
|
||||
|
||||
/** @overload */
|
||||
CV_EXPORTS_W void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
|
||||
InputArray img2, const std::vector<KeyPoint>& keypoints2,
|
||||
const std::vector<DMatch>& matches1to2, InputOutputArray outImg,
|
||||
const int matchesThickness, const Scalar& matchColor=Scalar::all(-1),
|
||||
const Scalar& singlePointColor=Scalar::all(-1), const std::vector<char>& matchesMask=std::vector<char>(),
|
||||
int flags=DrawMatchesFlags::DEFAULT );
|
||||
|
||||
CV_EXPORTS_AS(drawMatchesKnn) void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
|
||||
InputArray img2, const std::vector<KeyPoint>& keypoints2,
|
||||
const std::vector<std::vector<DMatch> >& matches1to2, InputOutputArray outImg,
|
||||
|
||||
@@ -183,7 +183,8 @@ static void _prepareImgAndDrawKeypoints( InputArray img1, const std::vector<KeyP
|
||||
}
|
||||
|
||||
static inline void _drawMatch( InputOutputArray outImg, InputOutputArray outImg1, InputOutputArray outImg2 ,
|
||||
const KeyPoint& kp1, const KeyPoint& kp2, const Scalar& matchColor, int flags )
|
||||
const KeyPoint& kp1, const KeyPoint& kp2, const Scalar& matchColor, int flags,
|
||||
const int matchesThickness )
|
||||
{
|
||||
RNG& rng = theRNG();
|
||||
bool isRandMatchColor = matchColor == Scalar::all(-1);
|
||||
@@ -199,7 +200,7 @@ static inline void _drawMatch( InputOutputArray outImg, InputOutputArray outImg1
|
||||
line( outImg,
|
||||
Point(cvRound(pt1.x*draw_multiplier), cvRound(pt1.y*draw_multiplier)),
|
||||
Point(cvRound(dpt2.x*draw_multiplier), cvRound(dpt2.y*draw_multiplier)),
|
||||
color, 1, LINE_AA, draw_shift_bits );
|
||||
color, matchesThickness, LINE_AA, draw_shift_bits );
|
||||
}
|
||||
|
||||
void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
|
||||
@@ -207,6 +208,21 @@ void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
|
||||
const std::vector<DMatch>& matches1to2, InputOutputArray outImg,
|
||||
const Scalar& matchColor, const Scalar& singlePointColor,
|
||||
const std::vector<char>& matchesMask, int flags )
|
||||
{
|
||||
drawMatches( img1, keypoints1,
|
||||
img2, keypoints2,
|
||||
matches1to2, outImg,
|
||||
1, matchColor,
|
||||
singlePointColor, matchesMask,
|
||||
flags);
|
||||
}
|
||||
|
||||
void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
|
||||
InputArray img2, const std::vector<KeyPoint>& keypoints2,
|
||||
const std::vector<DMatch>& matches1to2, InputOutputArray outImg,
|
||||
const int matchesThickness, const Scalar& matchColor,
|
||||
const Scalar& singlePointColor, const std::vector<char>& matchesMask,
|
||||
int flags )
|
||||
{
|
||||
if( !matchesMask.empty() && matchesMask.size() != matches1to2.size() )
|
||||
CV_Error( Error::StsBadSize, "matchesMask must have the same size as matches1to2" );
|
||||
@@ -226,11 +242,12 @@ void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
|
||||
CV_Assert(i2 >= 0 && i2 < static_cast<int>(keypoints2.size()));
|
||||
|
||||
const KeyPoint &kp1 = keypoints1[i1], &kp2 = keypoints2[i2];
|
||||
_drawMatch( outImg, outImg1, outImg2, kp1, kp2, matchColor, flags );
|
||||
_drawMatch( outImg, outImg1, outImg2, kp1, kp2, matchColor, flags, matchesThickness );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
|
||||
InputArray img2, const std::vector<KeyPoint>& keypoints2,
|
||||
const std::vector<std::vector<DMatch> >& matches1to2, InputOutputArray outImg,
|
||||
@@ -254,7 +271,7 @@ void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
|
||||
if( matchesMask.empty() || matchesMask[i][j] )
|
||||
{
|
||||
const KeyPoint &kp1 = keypoints1[i1], &kp2 = keypoints2[i2];
|
||||
_drawMatch( outImg, outImg1, outImg2, kp1, kp2, matchColor, flags );
|
||||
_drawMatch( outImg, outImg1, outImg2, kp1, kp2, matchColor, flags, 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1881,6 +1881,7 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da
|
||||
(unsigned)pt.y < (unsigned)(image_widget->original_image->height)
|
||||
))
|
||||
{
|
||||
state &= gtk_accelerator_get_default_mod_mask();
|
||||
flags |= BIT_MAP(state, GDK_SHIFT_MASK, CV_EVENT_FLAG_SHIFTKEY) |
|
||||
BIT_MAP(state, GDK_CONTROL_MASK, CV_EVENT_FLAG_CTRLKEY) |
|
||||
BIT_MAP(state, GDK_MOD1_MASK, CV_EVENT_FLAG_ALTKEY) |
|
||||
|
||||
@@ -47,24 +47,16 @@
|
||||
namespace cv
|
||||
{
|
||||
|
||||
int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& rect2, OutputArray intersectingRegion )
|
||||
static int _rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& rect2, std::vector<Point2f> &intersection )
|
||||
{
|
||||
CV_INSTRUMENT_REGION();
|
||||
|
||||
// L2 metric
|
||||
const float samePointEps = std::max(1e-16f, 1e-6f * (float)std::max(rect1.size.area(), rect2.size.area()));
|
||||
|
||||
if (rect1.size.empty() || rect2.size.empty())
|
||||
{
|
||||
intersectingRegion.release();
|
||||
return INTERSECT_NONE;
|
||||
}
|
||||
|
||||
Point2f vec1[4], vec2[4];
|
||||
Point2f pts1[4], pts2[4];
|
||||
|
||||
std::vector <Point2f> intersection; intersection.reserve(24);
|
||||
|
||||
rect1.points(pts1);
|
||||
rect2.points(pts2);
|
||||
|
||||
@@ -92,8 +84,6 @@ int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& r
|
||||
intersection[i] = pts1[i];
|
||||
}
|
||||
|
||||
Mat(intersection).copyTo(intersectingRegion);
|
||||
|
||||
return INTERSECT_FULL;
|
||||
}
|
||||
}
|
||||
@@ -300,7 +290,50 @@ int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& r
|
||||
}
|
||||
|
||||
intersection.resize(N);
|
||||
Mat(intersection).copyTo(intersectingRegion);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& rect2, OutputArray intersectingRegion )
|
||||
{
|
||||
CV_INSTRUMENT_REGION();
|
||||
|
||||
if (rect1.size.empty() || rect2.size.empty())
|
||||
{
|
||||
intersectingRegion.release();
|
||||
return INTERSECT_NONE;
|
||||
}
|
||||
|
||||
// Shift rectangles closer to origin (0, 0) to improve the calculation of the intesection region
|
||||
// To do that, the average center of the rectangles is moved to the origin
|
||||
const Point2f averageCenter = (rect1.center + rect2.center) / 2.0f;
|
||||
|
||||
RotatedRect shiftedRect1(rect1);
|
||||
RotatedRect shiftedRect2(rect2);
|
||||
|
||||
// Move rectangles closer to origin
|
||||
shiftedRect1.center -= averageCenter;
|
||||
shiftedRect2.center -= averageCenter;
|
||||
|
||||
std::vector <Point2f> intersection; intersection.reserve(24);
|
||||
|
||||
const int ret = _rotatedRectangleIntersection(shiftedRect1, shiftedRect2, intersection);
|
||||
|
||||
// If return is not None, the intersection Points are shifted back to the original position
|
||||
// and copied to the interesectingRegion
|
||||
if (ret != INTERSECT_NONE)
|
||||
{
|
||||
for (size_t i = 0; i < intersection.size(); ++i)
|
||||
{
|
||||
intersection[i] += averageCenter;
|
||||
}
|
||||
|
||||
Mat(intersection).copyTo(intersectingRegion);
|
||||
}
|
||||
else
|
||||
{
|
||||
intersectingRegion.release();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -391,4 +391,21 @@ TEST(Imgproc_RotatedRectangleIntersection, regression_18520)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Imgproc_RotatedRectangleIntersection, regression_19824)
|
||||
{
|
||||
RotatedRect r1(
|
||||
Point2f(246805.033f, 4002326.94f),
|
||||
Size2f(26.40587f, 6.20026f),
|
||||
-62.10156f);
|
||||
RotatedRect r2(
|
||||
Point2f(246805.122f, 4002326.59f),
|
||||
Size2f(27.4821f, 8.5361f),
|
||||
-56.33761f);
|
||||
|
||||
std::vector<Point2f> intersections;
|
||||
int interType = cv::rotatedRectangleIntersection(r1, r2, intersections);
|
||||
EXPECT_EQ(INTERSECT_PARTIAL, interType);
|
||||
EXPECT_LE(intersections.size(), (size_t)7);
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -224,6 +224,9 @@ class ClassInfo(GeneralInfo):
|
||||
for m in decl[2]:
|
||||
if m.startswith("="):
|
||||
self.jname = m[1:]
|
||||
if m == '/Simple':
|
||||
self.smart = False
|
||||
|
||||
self.base = ''
|
||||
if decl[1]:
|
||||
#self.base = re.sub(r"\b"+self.jname+r"\b", "", decl[1].replace(":", "")).strip()
|
||||
@@ -370,7 +373,7 @@ class JavaWrapperGenerator(object):
|
||||
|
||||
def clear(self):
|
||||
self.namespaces = ["cv"]
|
||||
self.classes = { "Mat" : ClassInfo([ 'class Mat', '', [], [] ], self.namespaces) }
|
||||
self.classes = { "Mat" : ClassInfo([ 'class Mat', '', ['/Simple'], [] ], self.namespaces) }
|
||||
self.module = ""
|
||||
self.Module = ""
|
||||
self.ported_func_list = []
|
||||
@@ -390,10 +393,15 @@ class JavaWrapperGenerator(object):
|
||||
if name in type_dict and not classinfo.base:
|
||||
logging.warning('duplicated: %s', classinfo)
|
||||
return
|
||||
if self.isSmartClass(classinfo):
|
||||
jni_name = "*((*(Ptr<"+classinfo.fullName(isCPP=True)+">*)%(n)s_nativeObj).get())"
|
||||
else:
|
||||
jni_name = "(*("+classinfo.fullName(isCPP=True)+"*)%(n)s_nativeObj)"
|
||||
type_dict.setdefault(name, {}).update(
|
||||
{ "j_type" : classinfo.jname,
|
||||
"jn_type" : "long", "jn_args" : (("__int64", ".nativeObj"),),
|
||||
"jni_name" : "(*("+classinfo.fullName(isCPP=True)+"*)%(n)s_nativeObj)", "jni_type" : "jlong",
|
||||
"jni_name" : jni_name,
|
||||
"jni_type" : "jlong",
|
||||
"suffix" : "J",
|
||||
"j_import" : "org.opencv.%s.%s" % (self.module, classinfo.jname)
|
||||
}
|
||||
@@ -401,7 +409,8 @@ class JavaWrapperGenerator(object):
|
||||
type_dict.setdefault(name+'*', {}).update(
|
||||
{ "j_type" : classinfo.jname,
|
||||
"jn_type" : "long", "jn_args" : (("__int64", ".nativeObj"),),
|
||||
"jni_name" : "("+classinfo.fullName(isCPP=True)+"*)%(n)s_nativeObj", "jni_type" : "jlong",
|
||||
"jni_name" : "&("+jni_name+")",
|
||||
"jni_type" : "jlong",
|
||||
"suffix" : "J",
|
||||
"j_import" : "org.opencv.%s.%s" % (self.module, classinfo.jname)
|
||||
}
|
||||
@@ -889,7 +898,13 @@ class JavaWrapperGenerator(object):
|
||||
ret = "return env->NewStringUTF(_retval_.c_str());"
|
||||
default = 'return env->NewStringUTF("");'
|
||||
elif self.isWrapped(fi.ctype): # wrapped class:
|
||||
ret = "return (jlong) new %s(_retval_);" % self.fullTypeName(fi.ctype)
|
||||
ret = None
|
||||
if fi.ctype in self.classes:
|
||||
ret_ci = self.classes[fi.ctype]
|
||||
if self.isSmartClass(ret_ci):
|
||||
ret = "return (jlong)(new Ptr<%(ctype)s>(new %(ctype)s(_retval_)));" % { 'ctype': self.fullTypeName(fi.ctype) }
|
||||
if ret is None:
|
||||
ret = "return (jlong) new %s(_retval_);" % self.fullTypeName(fi.ctype)
|
||||
elif fi.ctype.startswith('Ptr_'):
|
||||
c_prologue.append("typedef Ptr<%s> %s;" % (self.fullTypeName(fi.ctype[4:]), fi.ctype))
|
||||
ret = "return (jlong)(new %(ctype)s(_retval_));" % { 'ctype':fi.ctype }
|
||||
@@ -1128,17 +1143,7 @@ JNIEXPORT void JNICALL Java_org_opencv_%(module)s_%(j_cls)s_delete
|
||||
if ci.smart != None:
|
||||
return ci.smart
|
||||
|
||||
# if parents are smart (we hope) then children are!
|
||||
# if not we believe the class is smart if it has "create" method
|
||||
ci.smart = False
|
||||
if ci.base or ci.name == 'Algorithm':
|
||||
ci.smart = True
|
||||
else:
|
||||
for fi in ci.methods:
|
||||
if fi.name == "create":
|
||||
ci.smart = True
|
||||
break
|
||||
|
||||
ci.smart = True # smart class is not properly handled in case of base/derived classes
|
||||
return ci.smart
|
||||
|
||||
def smartWrap(self, ci, fullname):
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
diff --git a/inference-engine/src/CMakeLists.txt b/inference-engine/src/CMakeLists.txt
|
||||
index 0ba0dd78..7d34e7cb 100644
|
||||
--- a/inference-engine/src/CMakeLists.txt
|
||||
+++ b/inference-engine/src/CMakeLists.txt
|
||||
@@ -26,9 +26,9 @@ endif()
|
||||
|
||||
add_subdirectory(hetero_plugin)
|
||||
|
||||
-add_subdirectory(auto_plugin)
|
||||
+#add_subdirectory(auto_plugin)
|
||||
|
||||
-add_subdirectory(multi_device)
|
||||
+#add_subdirectory(multi_device)
|
||||
|
||||
add_subdirectory(transformations)
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
diff --git a/cmake/developer_package/add_ie_target.cmake b/cmake/developer_package/add_ie_target.cmake
|
||||
index d49f16a4d..2726ca787 100644
|
||||
--- a/cmake/developer_package/add_ie_target.cmake
|
||||
+++ b/cmake/developer_package/add_ie_target.cmake
|
||||
@@ -92,7 +92,7 @@ function(addIeTarget)
|
||||
if (ARG_TYPE STREQUAL EXECUTABLE)
|
||||
add_executable(${ARG_NAME} ${all_sources})
|
||||
elseif(ARG_TYPE STREQUAL STATIC OR ARG_TYPE STREQUAL SHARED)
|
||||
- add_library(${ARG_NAME} ${ARG_TYPE} ${all_sources})
|
||||
+ add_library(${ARG_NAME} ${ARG_TYPE} EXCLUDE_FROM_ALL ${all_sources})
|
||||
else()
|
||||
message(SEND_ERROR "Invalid target type ${ARG_TYPE} specified for target name ${ARG_NAME}")
|
||||
endif()
|
||||
diff --git a/inference-engine/CMakeLists.txt b/inference-engine/CMakeLists.txt
|
||||
index 1ac7fd8bf..df7091e51 100644
|
||||
--- a/inference-engine/CMakeLists.txt
|
||||
+++ b/inference-engine/CMakeLists.txt
|
||||
@@ -39,7 +39,7 @@ if(ENABLE_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
-add_subdirectory(tools)
|
||||
+#add_subdirectory(tools)
|
||||
|
||||
function(ie_build_samples)
|
||||
# samples should be build with the same flags as from OpenVINO package,
|
||||
@@ -58,7 +58,7 @@ endfunction()
|
||||
|
||||
# gflags and format_reader targets are kept inside of samples directory and
|
||||
# they must be built even if samples build is disabled (required for tests and tools).
|
||||
-ie_build_samples()
|
||||
+#ie_build_samples()
|
||||
|
||||
if(ENABLE_PYTHON)
|
||||
add_subdirectory(ie_bridges/python)
|
||||
@@ -142,7 +142,7 @@ endif()
|
||||
# Developer package
|
||||
#
|
||||
|
||||
-openvino_developer_export_targets(COMPONENT openvino_common TARGETS format_reader gflags ie_samples_utils)
|
||||
+#openvino_developer_export_targets(COMPONENT openvino_common TARGETS format_reader gflags ie_samples_utils)
|
||||
|
||||
# for Template plugin
|
||||
if(NGRAPH_INTERPRETER_ENABLE)
|
||||
@@ -166,7 +166,7 @@ function(ie_generate_dev_package_config)
|
||||
@ONLY)
|
||||
endfunction()
|
||||
|
||||
-ie_generate_dev_package_config()
|
||||
+#ie_generate_dev_package_config()
|
||||
|
||||
#
|
||||
# Coverage
|
||||
diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt
|
||||
index e8ed1a5c4..1fc9fc3ff 100644
|
||||
--- a/inference-engine/src/inference_engine/CMakeLists.txt
|
||||
+++ b/inference-engine/src/inference_engine/CMakeLists.txt
|
||||
@@ -110,7 +110,7 @@ add_cpplint_target(${TARGET_NAME}_plugin_api_cpplint FOR_SOURCES ${plugin_api_sr
|
||||
|
||||
# Create object library
|
||||
|
||||
-add_library(${TARGET_NAME}_obj OBJECT
|
||||
+add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL
|
||||
${LIBRARY_SRC}
|
||||
${LIBRARY_HEADERS}
|
||||
${PUBLIC_HEADERS})
|
||||
@@ -181,7 +181,7 @@ ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
|
||||
|
||||
# Static library used for unit tests which are always built
|
||||
|
||||
-add_library(${TARGET_NAME}_s STATIC
|
||||
+add_library(${TARGET_NAME}_s STATIC EXCLUDE_FROM_ALL
|
||||
$<TARGET_OBJECTS:${TARGET_NAME}_legacy_obj>
|
||||
$<TARGET_OBJECTS:${TARGET_NAME}_obj>
|
||||
${IE_STATIC_DEPENDENT_FILES})
|
||||
diff --git a/inference-engine/src/legacy_api/CMakeLists.txt b/inference-engine/src/legacy_api/CMakeLists.txt
|
||||
index 8eae82bd2..e0e6745b1 100644
|
||||
--- a/inference-engine/src/legacy_api/CMakeLists.txt
|
||||
+++ b/inference-engine/src/legacy_api/CMakeLists.txt
|
||||
@@ -26,7 +26,7 @@ endif()
|
||||
|
||||
file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
|
||||
|
||||
-add_library(${TARGET_NAME}_obj OBJECT
|
||||
+add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL
|
||||
${LIBRARY_SRC}
|
||||
${PUBLIC_HEADERS})
|
||||
|
||||
diff --git a/inference-engine/src/mkldnn_plugin/CMakeLists.txt b/inference-engine/src/mkldnn_plugin/CMakeLists.txt
|
||||
index fe57b29dd..07831e2fb 100644
|
||||
--- a/inference-engine/src/mkldnn_plugin/CMakeLists.txt
|
||||
+++ b/inference-engine/src/mkldnn_plugin/CMakeLists.txt
|
||||
@@ -67,7 +67,7 @@ ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
|
||||
|
||||
# add test object library
|
||||
|
||||
-add_library(${TARGET_NAME}_obj OBJECT ${SOURCES} ${HEADERS})
|
||||
+add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL ${SOURCES} ${HEADERS})
|
||||
target_link_libraries(${TARGET_NAME}_obj PUBLIC mkldnn)
|
||||
|
||||
target_include_directories(${TARGET_NAME}_obj PRIVATE $<TARGET_PROPERTY:inference_engine_preproc_s,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
diff --git a/inference-engine/src/preprocessing/CMakeLists.txt b/inference-engine/src/preprocessing/CMakeLists.txt
|
||||
index f9548339d..ef962145a 100644
|
||||
--- a/inference-engine/src/preprocessing/CMakeLists.txt
|
||||
+++ b/inference-engine/src/preprocessing/CMakeLists.txt
|
||||
@@ -101,7 +101,7 @@ endif()
|
||||
|
||||
# Create object library
|
||||
|
||||
-add_library(${TARGET_NAME}_obj OBJECT
|
||||
+add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL
|
||||
${LIBRARY_SRC}
|
||||
${LIBRARY_HEADERS})
|
||||
|
||||
@@ -153,7 +153,7 @@ ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
|
||||
|
||||
# Static library used for unit tests which are always built
|
||||
|
||||
-add_library(${TARGET_NAME}_s STATIC
|
||||
+add_library(${TARGET_NAME}_s STATIC EXCLUDE_FROM_ALL
|
||||
$<TARGET_OBJECTS:${TARGET_NAME}_obj>)
|
||||
|
||||
set_ie_threading_interface_for(${TARGET_NAME}_s)
|
||||
diff --git a/inference-engine/src/vpu/common/CMakeLists.txt b/inference-engine/src/vpu/common/CMakeLists.txt
|
||||
index 249e47c28..4ddf63049 100644
|
||||
--- a/inference-engine/src/vpu/common/CMakeLists.txt
|
||||
+++ b/inference-engine/src/vpu/common/CMakeLists.txt
|
||||
@@ -5,7 +5,7 @@
|
||||
file(GLOB_RECURSE SOURCES *.cpp *.hpp *.h)
|
||||
|
||||
function(add_common_target TARGET_NAME STATIC_IE)
|
||||
- add_library(${TARGET_NAME} STATIC ${SOURCES})
|
||||
+ add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES})
|
||||
|
||||
ie_faster_build(${TARGET_NAME}
|
||||
UNITY
|
||||
@@ -60,7 +60,7 @@ add_common_target("vpu_common_lib" FALSE)
|
||||
|
||||
# Unit tests support for graph transformer
|
||||
if(WIN32)
|
||||
- add_common_target("vpu_common_lib_test_static" TRUE)
|
||||
+ #add_common_target("vpu_common_lib_test_static" TRUE)
|
||||
else()
|
||||
add_library("vpu_common_lib_test_static" ALIAS "vpu_common_lib")
|
||||
endif()
|
||||
diff --git a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt
|
||||
index bc73ab5b1..b4c1547fc 100644
|
||||
--- a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt
|
||||
+++ b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt
|
||||
@@ -5,7 +5,7 @@
|
||||
file(GLOB_RECURSE SOURCES *.cpp *.hpp *.h *.inc)
|
||||
|
||||
function(add_graph_transformer_target TARGET_NAME STATIC_IE)
|
||||
- add_library(${TARGET_NAME} STATIC ${SOURCES})
|
||||
+ add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES})
|
||||
|
||||
set_ie_threading_interface_for(${TARGET_NAME})
|
||||
|
||||
@@ -70,7 +70,7 @@ add_graph_transformer_target("vpu_graph_transformer" FALSE)
|
||||
|
||||
# Unit tests support for graph transformer
|
||||
if(WIN32)
|
||||
- add_graph_transformer_target("vpu_graph_transformer_test_static" TRUE)
|
||||
+ #add_graph_transformer_target("vpu_graph_transformer_test_static" TRUE)
|
||||
else()
|
||||
add_library("vpu_graph_transformer_test_static" ALIAS "vpu_graph_transformer")
|
||||
endif()
|
||||
diff --git a/inference-engine/thirdparty/pugixml/CMakeLists.txt b/inference-engine/thirdparty/pugixml/CMakeLists.txt
|
||||
index 8bcb2801a..f7e031c01 100644
|
||||
--- a/inference-engine/thirdparty/pugixml/CMakeLists.txt
|
||||
+++ b/inference-engine/thirdparty/pugixml/CMakeLists.txt
|
||||
@@ -41,7 +41,7 @@ if(BUILD_SHARED_LIBS)
|
||||
else()
|
||||
add_library(pugixml STATIC ${SOURCES})
|
||||
if (MSVC)
|
||||
- add_library(pugixml_mt STATIC ${SOURCES})
|
||||
+ #add_library(pugixml_mt STATIC ${SOURCES})
|
||||
#if (WIN32)
|
||||
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
|
||||
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
|
||||
diff --git a/ngraph/core/builder/CMakeLists.txt b/ngraph/core/builder/CMakeLists.txt
|
||||
index ff5c381e7..2797ec9ab 100644
|
||||
--- a/ngraph/core/builder/CMakeLists.txt
|
||||
+++ b/ngraph/core/builder/CMakeLists.txt
|
||||
@@ -16,7 +16,7 @@ source_group("src" FILES ${LIBRARY_SRC})
|
||||
source_group("include" FILES ${PUBLIC_HEADERS})
|
||||
|
||||
# Create shared library
|
||||
-add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS})
|
||||
+add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${LIBRARY_SRC} ${PUBLIC_HEADERS})
|
||||
|
||||
if(COMMAND ie_faster_build)
|
||||
ie_faster_build(${TARGET_NAME}
|
||||
diff --git a/ngraph/core/reference/CMakeLists.txt b/ngraph/core/reference/CMakeLists.txt
|
||||
index ef4a764ab..f6d3172e2 100644
|
||||
--- a/ngraph/core/reference/CMakeLists.txt
|
||||
+++ b/ngraph/core/reference/CMakeLists.txt
|
||||
@@ -16,7 +16,7 @@ source_group("src" FILES ${LIBRARY_SRC})
|
||||
source_group("include" FILES ${PUBLIC_HEADERS})
|
||||
|
||||
# Create shared library
|
||||
-add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS})
|
||||
+add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${LIBRARY_SRC} ${PUBLIC_HEADERS})
|
||||
|
||||
if(COMMAND ie_faster_build)
|
||||
ie_faster_build(${TARGET_NAME}
|
||||
diff --git a/openvino/itt/CMakeLists.txt b/openvino/itt/CMakeLists.txt
|
||||
index e9f880b8c..c63f4df63 100644
|
||||
--- a/openvino/itt/CMakeLists.txt
|
||||
+++ b/openvino/itt/CMakeLists.txt
|
||||
@@ -6,7 +6,7 @@ set(TARGET_NAME itt)
|
||||
|
||||
file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.hpp")
|
||||
|
||||
-add_library(${TARGET_NAME} STATIC ${SOURCES})
|
||||
+add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES})
|
||||
|
||||
add_library(openvino::itt ALIAS ${TARGET_NAME})
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
iff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index e0706a72e..9a053b1e4 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -6,6 +6,10 @@ cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
project(OpenVINO)
|
||||
|
||||
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /FS")
|
||||
+set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
|
||||
+set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
|
||||
+
|
||||
set(OpenVINO_MAIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(IE_MAIN_SOURCE_DIR ${OpenVINO_MAIN_SOURCE_DIR}/inference-engine)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
diff --git a/cmake/developer_package/vs_version/vs_version.cmake b/cmake/developer_package/vs_version/vs_version.cmake
|
||||
index 14d4c0e1e..6a44f73b9 100644
|
||||
--- a/cmake/developer_package/vs_version/vs_version.cmake
|
||||
+++ b/cmake/developer_package/vs_version/vs_version.cmake
|
||||
@@ -8,9 +8,9 @@ set(IE_VS_VER_FILEVERSION_STR "${IE_VERSION_MAJOR}.${IE_VERSION_MINOR}.${IE_VERS
|
||||
|
||||
set(IE_VS_VER_COMPANY_NAME_STR "Intel Corporation")
|
||||
set(IE_VS_VER_PRODUCTVERSION_STR "${CI_BUILD_NUMBER}")
|
||||
-set(IE_VS_VER_PRODUCTNAME_STR "OpenVINO toolkit")
|
||||
+set(IE_VS_VER_PRODUCTNAME_STR "OpenVINO toolkit (for OpenCV Windows package)")
|
||||
set(IE_VS_VER_COPYRIGHT_STR "Copyright (C) 2018-2021, Intel Corporation")
|
||||
-set(IE_VS_VER_COMMENTS_STR "https://docs.openvinotoolkit.org/")
|
||||
+set(IE_VS_VER_COMMENTS_STR "https://github.com/opencv/opencv/wiki/Intel%27s-Deep-Learning-Inference-Engine-backend")
|
||||
|
||||
#
|
||||
# ie_add_vs_version_file(NAME <name>
|
||||
@@ -0,0 +1 @@
|
||||
os.environ['CI_BUILD_NUMBER'] = '2021.4.0-opencv_winpack_dldt'
|
||||
@@ -0,0 +1,4 @@
|
||||
applyPatch('20210630-dldt-disable-unused-targets.patch')
|
||||
applyPatch('20210630-dldt-pdb.patch')
|
||||
applyPatch('20210630-dldt-disable-multidevice-autoplugin.patch')
|
||||
applyPatch('20210630-dldt-vs-version.patch')
|
||||
@@ -0,0 +1,56 @@
|
||||
sysroot_bin_dir = prepare_dir(self.sysrootdir / 'bin')
|
||||
copytree(self.build_dir / 'install', self.sysrootdir / 'ngraph')
|
||||
#rm_one(self.sysrootdir / 'ngraph' / 'lib' / 'ngraph.dll')
|
||||
|
||||
build_config = 'Release' if not self.config.build_debug else 'Debug'
|
||||
build_bin_dir = self.build_dir / 'bin' / 'intel64' / build_config
|
||||
|
||||
def copy_bin(name):
|
||||
global build_bin_dir, sysroot_bin_dir
|
||||
copytree(build_bin_dir / name, sysroot_bin_dir / name)
|
||||
|
||||
dll_suffix = 'd' if self.config.build_debug else ''
|
||||
def copy_dll(name):
|
||||
global copy_bin, dll_suffix
|
||||
copy_bin(name + dll_suffix + '.dll')
|
||||
copy_bin(name + dll_suffix + '.pdb')
|
||||
|
||||
copy_bin('cache.json')
|
||||
copy_dll('clDNNPlugin')
|
||||
copy_dll('HeteroPlugin')
|
||||
copy_dll('inference_engine')
|
||||
copy_dll('inference_engine_ir_reader')
|
||||
#copy_dll('inference_engine_ir_v7_reader')
|
||||
copy_dll('inference_engine_legacy')
|
||||
copy_dll('inference_engine_transformations') # runtime
|
||||
copy_dll('inference_engine_lp_transformations') # runtime
|
||||
#copy_dll('inference_engine_preproc') # runtime
|
||||
copy_dll('MKLDNNPlugin') # runtime
|
||||
copy_dll('myriadPlugin') # runtime
|
||||
#copy_dll('MultiDevicePlugin') # runtime, not used
|
||||
copy_dll('ngraph')
|
||||
copy_bin('plugins.xml')
|
||||
copy_bin('pcie-ma2x8x.elf')
|
||||
copy_bin('usb-ma2x8x.mvcmd')
|
||||
|
||||
copytree(self.srcdir / 'inference-engine' / 'temp' / 'tbb' / 'bin', sysroot_bin_dir)
|
||||
copytree(self.srcdir / 'inference-engine' / 'temp' / 'tbb', self.sysrootdir / 'tbb')
|
||||
|
||||
sysroot_ie_dir = prepare_dir(self.sysrootdir / 'deployment_tools' / 'inference_engine')
|
||||
sysroot_ie_lib_dir = prepare_dir(sysroot_ie_dir / 'lib' / 'intel64')
|
||||
|
||||
copytree(self.srcdir / 'inference-engine' / 'include', sysroot_ie_dir / 'include')
|
||||
if not self.config.build_debug:
|
||||
copytree(build_bin_dir / 'ngraph.lib', sysroot_ie_lib_dir / 'ngraph.lib')
|
||||
copytree(build_bin_dir / 'inference_engine.lib', sysroot_ie_lib_dir / 'inference_engine.lib')
|
||||
copytree(build_bin_dir / 'inference_engine_ir_reader.lib', sysroot_ie_lib_dir / 'inference_engine_ir_reader.lib')
|
||||
copytree(build_bin_dir / 'inference_engine_legacy.lib', sysroot_ie_lib_dir / 'inference_engine_legacy.lib')
|
||||
else:
|
||||
copytree(build_bin_dir / 'ngraphd.lib', sysroot_ie_lib_dir / 'ngraphd.lib')
|
||||
copytree(build_bin_dir / 'inference_engined.lib', sysroot_ie_lib_dir / 'inference_engined.lib')
|
||||
copytree(build_bin_dir / 'inference_engine_ir_readerd.lib', sysroot_ie_lib_dir / 'inference_engine_ir_readerd.lib')
|
||||
copytree(build_bin_dir / 'inference_engine_legacyd.lib', sysroot_ie_lib_dir / 'inference_engine_legacyd.lib')
|
||||
|
||||
sysroot_license_dir = prepare_dir(self.sysrootdir / 'etc' / 'licenses')
|
||||
copytree(self.srcdir / 'LICENSE', sysroot_license_dir / 'dldt-LICENSE')
|
||||
copytree(self.sysrootdir / 'tbb/LICENSE', sysroot_license_dir / 'tbb-LICENSE')
|
||||
@@ -214,7 +214,7 @@ class BuilderDLDT:
|
||||
patch_hashsum = hashlib.md5(self.patch_file_contents.encode('utf-8')).hexdigest()
|
||||
except:
|
||||
log.warn("Can't compute hashsum of patches: %s", self.patch_file)
|
||||
self.patch_hashsum = patch_hashsum
|
||||
self.patch_hashsum = self.config.override_patch_hashsum if self.config.override_patch_hashsum else patch_hashsum
|
||||
|
||||
|
||||
def prepare_sources(self):
|
||||
@@ -355,7 +355,6 @@ class Builder:
|
||||
BUILD_PERF_TESTS='OFF',
|
||||
ENABLE_CXX11='ON',
|
||||
WITH_INF_ENGINE='ON',
|
||||
INF_ENGINE_RELEASE=str(self.config.dldt_release),
|
||||
WITH_TBB='ON',
|
||||
CPU_BASELINE='AVX2',
|
||||
CMAKE_INSTALL_PREFIX=str(self.install_dir),
|
||||
@@ -381,6 +380,9 @@ class Builder:
|
||||
OPENCV_PYTHON_INSTALL_PATH='python',
|
||||
)
|
||||
|
||||
if self.config.dldt_release:
|
||||
cmake_vars['INF_ENGINE_RELEASE'] = str(self.config.dldt_release)
|
||||
|
||||
cmake_vars['INF_ENGINE_LIB_DIRS:PATH'] = str(builderDLDT.sysrootdir / 'deployment_tools/inference_engine/lib/intel64')
|
||||
assert os.path.exists(cmake_vars['INF_ENGINE_LIB_DIRS:PATH']), cmake_vars['INF_ENGINE_LIB_DIRS:PATH']
|
||||
cmake_vars['INF_ENGINE_INCLUDE_DIRS:PATH'] = str(builderDLDT.sysrootdir / 'deployment_tools/inference_engine/include')
|
||||
@@ -464,8 +466,8 @@ class Builder:
|
||||
def main():
|
||||
|
||||
dldt_src_url = 'https://github.com/openvinotoolkit/openvino'
|
||||
dldt_src_commit = '2021.3'
|
||||
dldt_release = '2021030000'
|
||||
dldt_src_commit = '2021.4'
|
||||
dldt_release = None
|
||||
|
||||
build_cache_dir_default = os.environ.get('BUILD_CACHE_DIR', '.build_cache')
|
||||
build_subst_drive = os.environ.get('BUILD_SUBST_DRIVE', None)
|
||||
@@ -492,13 +494,15 @@ def main():
|
||||
parser.add_argument('--dldt_src_branch', help='DLDT checkout branch')
|
||||
parser.add_argument('--dldt_src_commit', default=dldt_src_commit, help='DLDT source commit / tag (default: %s)' % dldt_src_commit)
|
||||
parser.add_argument('--dldt_src_git_clone_extra', action='append', help='DLDT git clone extra args')
|
||||
parser.add_argument('--dldt_release', default=dldt_release, help='DLDT release code for INF_ENGINE_RELEASE (default: %s)' % dldt_release)
|
||||
parser.add_argument('--dldt_release', default=dldt_release, help='DLDT release code for INF_ENGINE_RELEASE, e.g 2021030000 (default: %s)' % dldt_release)
|
||||
|
||||
parser.add_argument('--dldt_reference_dir', help='DLDT reference git repository (optional)')
|
||||
parser.add_argument('--dldt_src_dir', help='DLDT custom source repository (skip git checkout and patching, use for TESTING only)')
|
||||
|
||||
parser.add_argument('--dldt_config', help='Specify DLDT build configuration (defaults to evaluate from DLDT commit/branch)')
|
||||
|
||||
parser.add_argument('--override_patch_hashsum', default='', help='(script debug mode)')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
log.basicConfig(
|
||||
|
||||
@@ -89,7 +89,7 @@ void MatchingMethod( int, void* )
|
||||
|
||||
//! [create_result_matrix]
|
||||
/// Create the result matrix
|
||||
int result_cols = img.cols - templ.cols + 1;
|
||||
int result_cols = img.cols - templ.cols + 1;
|
||||
int result_rows = img.rows - templ.rows + 1;
|
||||
|
||||
result.create( result_rows, result_cols, CV_32FC1 );
|
||||
|
||||
@@ -72,18 +72,18 @@ void Hist_and_Backproj(int, void* )
|
||||
//! [initialize]
|
||||
int histSize = MAX( bins, 2 );
|
||||
float hue_range[] = { 0, 180 };
|
||||
const float* ranges = { hue_range };
|
||||
const float* ranges[] = { hue_range };
|
||||
//! [initialize]
|
||||
|
||||
//! [Get the Histogram and normalize it]
|
||||
Mat hist;
|
||||
calcHist( &hue, 1, 0, Mat(), hist, 1, &histSize, &ranges, true, false );
|
||||
calcHist( &hue, 1, 0, Mat(), hist, 1, &histSize, ranges, true, false );
|
||||
normalize( hist, hist, 0, 255, NORM_MINMAX, -1, Mat() );
|
||||
//! [Get the Histogram and normalize it]
|
||||
|
||||
//! [Get Backprojection]
|
||||
Mat backproj;
|
||||
calcBackProject( &hue, 1, 0, hist, backproj, &ranges, 1, true );
|
||||
calcBackProject( &hue, 1, 0, hist, backproj, ranges, 1, true );
|
||||
//! [Get Backprojection]
|
||||
|
||||
//! [Draw the backproj]
|
||||
|
||||
@@ -37,7 +37,7 @@ int main(int argc, char** argv)
|
||||
|
||||
//! [Set the ranges ( for B,G,R) )]
|
||||
float range[] = { 0, 256 }; //the upper boundary is exclusive
|
||||
const float* histRange = { range };
|
||||
const float* histRange[] = { range };
|
||||
//! [Set the ranges ( for B,G,R) )]
|
||||
|
||||
//! [Set histogram param]
|
||||
@@ -46,9 +46,9 @@ int main(int argc, char** argv)
|
||||
|
||||
//! [Compute the histograms]
|
||||
Mat b_hist, g_hist, r_hist;
|
||||
calcHist( &bgr_planes[0], 1, 0, Mat(), b_hist, 1, &histSize, &histRange, uniform, accumulate );
|
||||
calcHist( &bgr_planes[1], 1, 0, Mat(), g_hist, 1, &histSize, &histRange, uniform, accumulate );
|
||||
calcHist( &bgr_planes[2], 1, 0, Mat(), r_hist, 1, &histSize, &histRange, uniform, accumulate );
|
||||
calcHist( &bgr_planes[0], 1, 0, Mat(), b_hist, 1, &histSize, histRange, uniform, accumulate );
|
||||
calcHist( &bgr_planes[1], 1, 0, Mat(), g_hist, 1, &histSize, histRange, uniform, accumulate );
|
||||
calcHist( &bgr_planes[2], 1, 0, Mat(), r_hist, 1, &histSize, histRange, uniform, accumulate );
|
||||
//! [Compute the histograms]
|
||||
|
||||
//! [Draw the histograms for B, G and R]
|
||||
|
||||
@@ -188,7 +188,7 @@ def main():
|
||||
|
||||
fig = plt.figure()
|
||||
ax = fig.gca(projection='3d')
|
||||
ax.set_aspect("equal")
|
||||
ax.set_aspect("auto")
|
||||
|
||||
cam_width = args.cam_width
|
||||
cam_height = args.cam_height
|
||||
|
||||
@@ -32,7 +32,7 @@ def draw_gaussain(img, mean, cov, color):
|
||||
w, u, _vt = cv.SVDecomp(cov)
|
||||
ang = np.arctan2(u[1, 0], u[0, 0])*(180/np.pi)
|
||||
s1, s2 = np.sqrt(w)*3.0
|
||||
cv.ellipse(img, (x, y), (s1, s2), ang, 0, 360, color, 1, cv.LINE_AA)
|
||||
cv.ellipse(img, (int(x), int(y)), (int(s1), int(s2)), ang, 0, 360, color, 1, cv.LINE_AA)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -48,7 +48,7 @@ def hist_lines(im):
|
||||
cv.normalize(hist_item,hist_item,0,255,cv.NORM_MINMAX)
|
||||
hist=np.int32(np.around(hist_item))
|
||||
for x,y in enumerate(hist):
|
||||
cv.line(h,(x,0),(x,y),(255,255,255))
|
||||
cv.line(h,(x,0),(x,y[0]),(255,255,255))
|
||||
y = np.flipud(h)
|
||||
return y
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@ class App:
|
||||
|
||||
for (x0, y0), (x1, y1), good in zip(self.p0[:,0], self.p1[:,0], status[:,0]):
|
||||
if good:
|
||||
cv.line(vis, (x0, y0), (x1, y1), (0, 128, 0))
|
||||
cv.circle(vis, (x1, y1), 2, (red, green)[good], -1)
|
||||
cv.line(vis, (int(x0), int(y0)), (int(x1), int(y1)), (0, 128, 0))
|
||||
cv.circle(vis, (int(x1), int(y1)), 2, (red, green)[good], -1)
|
||||
draw_str(vis, (20, 20), 'track count: %d' % len(self.p1))
|
||||
if self.use_ransac:
|
||||
draw_str(vis, (20, 40), 'RANSAC')
|
||||
@@ -86,7 +86,7 @@ class App:
|
||||
p = cv.goodFeaturesToTrack(frame_gray, **feature_params)
|
||||
if p is not None:
|
||||
for x, y in p[:,0]:
|
||||
cv.circle(vis, (x, y), 2, green, -1)
|
||||
cv.circle(vis, (int(x), int(y)), 2, green, -1)
|
||||
draw_str(vis, (20, 20), 'feature count: %d' % len(p))
|
||||
|
||||
cv.imshow('lk_homography', vis)
|
||||
|
||||
@@ -65,7 +65,7 @@ class App:
|
||||
if len(tr) > self.track_len:
|
||||
del tr[0]
|
||||
new_tracks.append(tr)
|
||||
cv.circle(vis, (x, y), 2, (0, 255, 0), -1)
|
||||
cv.circle(vis, (int(x), int(y)), 2, (0, 255, 0), -1)
|
||||
self.tracks = new_tracks
|
||||
cv.polylines(vis, [np.int32(tr) for tr in self.tracks], False, (0, 255, 0))
|
||||
draw_str(vis, (20, 20), 'track count: %d' % len(self.tracks))
|
||||
|
||||
@@ -30,7 +30,7 @@ def main():
|
||||
color = (0, 255, 0)
|
||||
|
||||
cap = cv.VideoCapture(0)
|
||||
cap.set(cv.CAP_PROP_AUTOFOCUS, False) # Known bug: https://github.com/opencv/opencv/pull/5474
|
||||
cap.set(cv.CAP_PROP_AUTOFOCUS, 0) # Known bug: https://github.com/opencv/opencv/pull/5474
|
||||
|
||||
cv.namedWindow("Video")
|
||||
|
||||
@@ -67,7 +67,7 @@ def main():
|
||||
break
|
||||
elif k == ord('g'):
|
||||
convert_rgb = not convert_rgb
|
||||
cap.set(cv.CAP_PROP_CONVERT_RGB, convert_rgb)
|
||||
cap.set(cv.CAP_PROP_CONVERT_RGB, 1 if convert_rgb else 0)
|
||||
|
||||
print('Done')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user