endif()
endif()
+ message(STATUS "Detected processor: ${CMAKE_SYSTEM_PROCESSOR}")
if(MSVC64 OR MINGW64)
set(X86_64 1)
elseif(MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING))
set(PPC64 1)
endif()
- # Workaround for 32-bit operating systems on 64-bit x86_64 processor
- if(X86_64 AND CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT FORCE_X86_64)
- message(STATUS "sizeof(void) = 4 on x86 / x86_64 processor. Assume 32-bit compilation mode (X86=1)")
- unset(X86_64)
- set(X86 1)
+ # Workaround for 32-bit operating systems on x86_64/aarch64 processor
+ if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT FORCE_X86_64)
+ message(STATUS "sizeof(void) = 4 on 64 bit processor. Assume 32-bit compilation mode")
+ if (X86_64)
+ unset(X86_64)
+ set(X86 1)
+ endif()
+ if (AARCH64)
+ unset(AARCH64)
+ set(ARM 1)
+ endif()
endif()
# Similar code exists in OpenCVConfig.cmake
endforeach()
endif()
-if(ENABLE_CXX11)
- #cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
- set(CMAKE_CXX_STANDARD 11)
- set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
- set(CMAKE_CXX_EXTENSIONS OFF) # use -std=c++11 instead of -std=gnu++11
- if(CMAKE_CXX11_COMPILE_FEATURES)
- set(HAVE_CXX11 ON)
- endif()
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
+set(CMAKE_CXX_EXTENSIONS OFF) # use -std=c++11 instead of -std=gnu++11
+if(CMAKE_CXX11_COMPILE_FEATURES)
+ set(HAVE_CXX11 ON)
endif()
if(NOT HAVE_CXX11)
ocv_check_compiler_flag(CXX "" HAVE_CXX11 "${OpenCV_SOURCE_DIR}/cmake/checks/cxx11.cpp")
- if(NOT HAVE_CXX11 AND ENABLE_CXX11)
+ if(NOT HAVE_CXX11)
ocv_check_compiler_flag(CXX "-std=c++11" HAVE_STD_CXX11 "${OpenCV_SOURCE_DIR}/cmake/checks/cxx11.cpp")
if(HAVE_STD_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
endif()
endif()
+if(NOT HAVE_CXX11)
+ message(FATAL_ERROR "OpenCV 4.x requires C++11")
+endif()
* Structures and macros for integration with IPP *
\****************************************************************************************/
+#define OPENCV_IPP_REDUCE_SIZE 1
+
// Temporary disabled named IPP region. Accuracy
#define IPP_DISABLE_PYRAMIDS_UP 1 // Different results
#define IPP_DISABLE_PYRAMIDS_DOWN 1 // Different results
}
CvStatus;
-#ifdef HAVE_TEGRA_OPTIMIZATION
-namespace tegra {
-
-CV_EXPORTS bool useTegra();
-CV_EXPORTS void setUseTegra(bool flag);
-
-}
-#endif
-
#ifdef ENABLE_INSTRUMENTATION
namespace cv
{
#endif
// Instrument region
- #define CV_INSTRUMENT_REGION_META(NAME, ALWAYS_EXPAND, TYPE, IMPL) ::cv::instr::IntrumentationRegion __instr_region__(NAME, __FILE__, __LINE__, CV_INSTRUMENT_GET_RETURN_ADDRESS, ALWAYS_EXPAND, TYPE, IMPL);
+ #define CV_INSTRUMENT_REGION_META(NAME, ALWAYS_EXPAND, TYPE, IMPL) ::cv::instr::IntrumentationRegion CVAUX_CONCAT(__instr_region__, __LINE__) (NAME, __FILE__, __LINE__, CV_INSTRUMENT_GET_RETURN_ADDRESS, ALWAYS_EXPAND, TYPE, IMPL);
#define CV_INSTRUMENT_REGION_CUSTOM_META(NAME, ALWAYS_EXPAND, TYPE, IMPL)\
- void *__curr_address__ = [&]() {return CV_INSTRUMENT_GET_RETURN_ADDRESS;}();\
- ::cv::instr::IntrumentationRegion __instr_region__(NAME, __FILE__, __LINE__, __curr_address__, false, ::cv::instr::TYPE_GENERAL, ::cv::instr::IMPL_PLAIN);
+ void *CVAUX_CONCAT(__curr_address__, __LINE__) = [&]() {return CV_INSTRUMENT_GET_RETURN_ADDRESS;}();\
+ ::cv::instr::IntrumentationRegion CVAUX_CONCAT(__instr_region__, __LINE__) (NAME, __FILE__, __LINE__, CVAUX_CONCAT(__curr_address__, __LINE__), false, ::cv::instr::TYPE_GENERAL, ::cv::instr::IMPL_PLAIN);
// Instrument functions with non-void return type
#define CV_INSTRUMENT_FUN_RT_META(TYPE, IMPL, ERROR_COND, FUN, ...) ([&]()\
{\
*/
CV_EXPORTS void addDataSearchSubDirectory(const cv::String& subdir);
+/** @brief Retrieve location of OpenCV libraries or current executable
+ */
+CV_EXPORTS bool getBinLocation(std::string& dst);
+
+#if defined(_WIN32)
+/** @brief Retrieve location of OpenCV libraries or current executable
+
+@note WIN32 only
+ */
+CV_EXPORTS bool getBinLocation(std::wstring& dst);
+#endif
+
//! @}
} // namespace utils
}
+
static std::map<InferenceEngine::TargetDevice, InferenceEngine::InferenceEnginePluginPtr>& getSharedPlugins()
{
static std::map<InferenceEngine::TargetDevice, InferenceEngine::InferenceEnginePluginPtr> sharedPlugins;
CV_LOG_WARNING(NULL, "DNN-IE: Can't load extension plugin (extra layers for some networks). Specify path via OPENCV_DNN_IE_EXTRA_PLUGIN_PATH parameter");
}
// Some of networks can work without a library of extra layers.
+ #ifndef _WIN32
+ // Limit the number of CPU threads.
+ enginePtr->SetConfig({{
+ InferenceEngine::PluginConfigParams::KEY_CPU_THREADS_NUM, format("%d", getNumThreads()),
+ }}, 0);
+ #endif
}
plugin = InferenceEngine::InferencePlugin(enginePtr);
return (bool)enginePtr;
}
- void InfEngineBackendNet::addBlobs(const std::vector<Ptr<BackendWrapper> >& ptrs)
+ void InfEngineBackendNet::addBlobs(const std::vector<cv::Ptr<BackendWrapper> >& ptrs)
{
auto wrappers = infEngineWrappers(ptrs);
for (const auto& wrapper : wrappers)
#endif // HAVE_INF_ENGINE
}
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
void resetMyriadDevice()
{
#endif // HAVE_INF_ENGINE
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
}} // namespace dnn, namespace cv
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
- #if defined(__GNUC__) && INF_ENGINE_VER_MAJOR_LE(INF_ENGINE_RELEASE_2019R1)
+ //#define INFERENCE_ENGINE_DEPRECATED // turn off deprecation warnings from IE
+ //there is no way to suppress warnigns from IE only at this moment, so we are forced to suppress warnings globally
+ #if defined(__GNUC__)
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ #endif
+ #ifdef _MSC_VER
+ #pragma warning(disable: 4996) // was declared deprecated
+ #endif
+
+ #if defined(__GNUC__)
#pragma GCC visibility push(default)
#endif
#include <ie_builders.hpp>
- #if defined(__GNUC__) && INF_ENGINE_VER_MAJOR_LE(INF_ENGINE_RELEASE_2019R1)
+ #if defined(__GNUC__)
#pragma GCC visibility pop
#endif
void initPlugin(InferenceEngine::ICNNNetwork& net);
- void addBlobs(const std::vector<Ptr<BackendWrapper> >& ptrs);
+ void addBlobs(const std::vector<cv::Ptr<BackendWrapper> >& ptrs);
private:
InferenceEngine::Builder::Network netBuilder;
InferenceEngine::CNNNetwork t_net;
};
-CV__DNN_EXPERIMENTAL_NS_BEGIN
+CV__DNN_INLINE_NS_BEGIN
bool isMyriadX();
-CV__DNN_EXPERIMENTAL_NS_END
+CV__DNN_INLINE_NS_END
#endif // HAVE_INF_ENGINE
//! [Run face detection model]
function detectFaces(img) {
- var blob = cv.blobFromImage(img, 1, {width: 128, height: 96}, [104, 177, 123, 0], false, false);
+ var blob = cv.blobFromImage(img, 1, {width: 192, height: 144}, [104, 117, 123, 0], false, false);
netDet.setInput(blob);
var out = netDet.forward();
function loadModels(callback) {
var utils = new Utils('');
- var proto = 'https://raw.githubusercontent.com/opencv/opencv/3.4/samples/dnn/face_detector/deploy.prototxt';
+ var proto = 'https://raw.githubusercontent.com/opencv/opencv/master/samples/dnn/face_detector/deploy.prototxt';
var weights = 'https://raw.githubusercontent.com/opencv/opencv_3rdparty/dnn_samples_face_detector_20180205_fp16/res10_300x300_ssd_iter_140000_fp16.caffemodel';
var recognModel = 'https://raw.githubusercontent.com/pyannote/pyannote-data/master/openface.nn4.small2.v1.t7';
utils.createFileFromUrl('face_detector.prototxt', proto, () => {
document.getElementById('startStopButton').disabled = false;
};
-
- // Load opencv.js
- cv['onRuntimeInitialized']=()=>{
- main();
- };
</script>
</head>
- <body>
+ <body onload="cv['onRuntimeInitialized']=()=>{ main() }">
<button id="startStopButton" type="button" disabled="true">Start</button>
<div id="status"></div>
<canvas id="output" width=640 height=480 style="max-width: 100%"></canvas>