diff --git a/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h b/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h index 0b0b06ce6c..075c406aba 100644 --- a/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h +++ b/3rdparty/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h @@ -146,6 +146,14 @@ inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { return __atomic_load_n(ptr, __ATOMIC_RELAXED); } +inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, + Atomic64 old_value, + Atomic64 new_value) { + __atomic_compare_exchange_n(ptr, &old_value, new_value, false, + __ATOMIC_RELEASE, __ATOMIC_ACQUIRE); + return old_value; +} + #endif // defined(__LP64__) } // namespace internal diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 2dfbbb8620..a7ef8e1389 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -14,6 +14,7 @@ if(DOXYGEN_FOUND) add_custom_target(doxygen) # not documented modules list + set(blacklist "${DOXYGEN_BLACKLIST}") list(APPEND blacklist "ts" "java_bindings_generator" "java" "python_bindings_generator" "python2" "python3" "js" "world") unset(CMAKE_DOXYGEN_TUTORIAL_CONTRIB_ROOT) unset(CMAKE_DOXYGEN_TUTORIAL_JS_ROOT) diff --git a/doc/tutorials/imgproc/pyramids/pyramids.markdown b/doc/tutorials/imgproc/pyramids/pyramids.markdown index b832b22fb8..c11a80527f 100644 --- a/doc/tutorials/imgproc/pyramids/pyramids.markdown +++ b/doc/tutorials/imgproc/pyramids/pyramids.markdown @@ -56,7 +56,7 @@ Theory entire pyramid. - The procedure above was useful to downsample an image. What if we want to make it bigger?: columns filled with zeros (\f$0 \f$) - - First, upsize the image to twice the original in each dimension, wit the new even rows and + - First, upsize the image to twice the original in each dimension, with the new even rows and - Perform a convolution with the same kernel shown above (multiplied by 4) to approximate the values of the "missing pixels" - These two procedures (downsampling and upsampling as explained above) are implemented by the diff --git a/modules/core/include/opencv2/core/utils/configuration.private.hpp b/modules/core/include/opencv2/core/utils/configuration.private.hpp index fa1b045178..b35f35e9d4 100644 --- a/modules/core/include/opencv2/core/utils/configuration.private.hpp +++ b/modules/core/include/opencv2/core/utils/configuration.private.hpp @@ -5,11 +5,17 @@ #ifndef OPENCV_CONFIGURATION_PRIVATE_HPP #define OPENCV_CONFIGURATION_PRIVATE_HPP +#include "opencv2/core/cvstd.hpp" +#include +#include + namespace cv { namespace utils { +typedef std::vector Paths; CV_EXPORTS bool getConfigurationParameterBool(const char* name, bool defaultValue); CV_EXPORTS size_t getConfigurationParameterSizeT(const char* name, size_t defaultValue); CV_EXPORTS cv::String getConfigurationParameterString(const char* name, const char* defaultValue); +CV_EXPORTS Paths getConfigurationParameterPaths(const char* name, const Paths &defaultValue = Paths()); }} // namespace diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index d8e2fd811b..f0deb2d067 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -238,6 +238,20 @@ static const bool CV_OPENCL_DISABLE_BUFFER_RECT_OPERATIONS = utils::getConfigura #endif ); +static const String getBuildExtraOptions() +{ + static String param_buildExtraOptions; + static bool initialized = false; + if (!initialized) + { + param_buildExtraOptions = utils::getConfigurationParameterString("OPENCV_OPENCL_BUILD_EXTRA_OPTIONS", ""); + initialized = true; + if (!param_buildExtraOptions.empty()) + CV_LOG_WARNING(NULL, "OpenCL: using extra build options: '" << param_buildExtraOptions << "'"); + } + return param_buildExtraOptions; +} + #endif // HAVE_OPENCL struct UMat2D @@ -3517,6 +3531,9 @@ struct Program::Impl buildflags = joinBuildOptions(buildflags, " -D AMD_DEVICE"); else if (device.isIntel()) buildflags = joinBuildOptions(buildflags, " -D INTEL_DEVICE"); + const String param_buildExtraOptions = getBuildExtraOptions(); + if (!param_buildExtraOptions.empty()) + buildflags = joinBuildOptions(buildflags, param_buildExtraOptions); } compile(ctx, src_, errmsg); } diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp index b27570203d..974585d577 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -43,6 +43,7 @@ #include "precomp.hpp" #include +#include #include #include @@ -1594,18 +1595,26 @@ static TLSData& getThreadIDTLS() } // namespace int utils::getThreadID() { return getThreadIDTLS().get()->id; } -bool utils::getConfigurationParameterBool(const char* name, bool defaultValue) + +class ParseError { -#ifdef NO_GETENV - const char* envValue = NULL; -#else - const char* envValue = getenv(name); -#endif - if (envValue == NULL) + std::string bad_value; +public: + ParseError(const std::string bad_value_) :bad_value(bad_value_) {} + std::string toString(const std::string ¶m) const { - return defaultValue; + std::ostringstream out; + out << "Invalid value for parameter " << param << ": " << bad_value; + return out.str(); } - cv::String value = envValue; +}; + +template +T parseOption(const std::string &); + +template<> +inline bool parseOption(const std::string & value) +{ if (value == "1" || value == "True" || value == "true" || value == "TRUE") { return true; @@ -1614,22 +1623,12 @@ bool utils::getConfigurationParameterBool(const char* name, bool defaultValue) { return false; } - CV_Error(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str())); + throw ParseError(value); } - -size_t utils::getConfigurationParameterSizeT(const char* name, size_t defaultValue) +template<> +inline size_t parseOption(const std::string &value) { -#ifdef NO_GETENV - const char* envValue = NULL; -#else - const char* envValue = getenv(name); -#endif - if (envValue == NULL) - { - return defaultValue; - } - cv::String value = envValue; size_t pos = 0; for (; pos < value.size(); pos++) { @@ -1645,17 +1644,80 @@ size_t utils::getConfigurationParameterSizeT(const char* name, size_t defaultVal return v * 1024 * 1024; else if (suffixStr == "KB" || suffixStr == "Kb" || suffixStr == "kb") return v * 1024; - CV_Error(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str())); + throw ParseError(value); } -cv::String utils::getConfigurationParameterString(const char* name, const char* defaultValue) +template<> +inline cv::String parseOption(const std::string &value) +{ + return value; +} + +template<> +inline utils::Paths parseOption(const std::string &value) +{ + utils::Paths result; +#ifdef _WIN32 + const char sep = ';'; +#else + const char sep = ':'; +#endif + size_t start_pos = 0; + while (start_pos != std::string::npos) + { + const size_t pos = value.find(sep, start_pos); + const std::string one_piece(value, start_pos, pos == std::string::npos ? pos : pos - start_pos); + if (!one_piece.empty()) + result.push_back(one_piece); + start_pos = pos == std::string::npos ? pos : pos + 1; + } + return result; +} + +static inline const char * envRead(const char * name) { #ifdef NO_GETENV - const char* envValue = NULL; + CV_UNUSED(name); + return NULL; #else - const char* envValue = getenv(name); + return getenv(name); #endif - return envValue ? cv::String(envValue) : (defaultValue ? cv::String(defaultValue) : cv::String()); +} + +template +inline T read(const std::string & k, const T & defaultValue) +{ + try + { + const char * res = envRead(k.c_str()); + if (res) + return parseOption(std::string(res)); + } + catch (const ParseError &err) + { + CV_Error(cv::Error::StsBadArg, err.toString(k)); + } + return defaultValue; +} + +bool utils::getConfigurationParameterBool(const char* name, bool defaultValue) +{ + return read(name, defaultValue); +} + +size_t utils::getConfigurationParameterSizeT(const char* name, size_t defaultValue) +{ + return read(name, defaultValue); +} + +cv::String utils::getConfigurationParameterString(const char* name, const char* defaultValue) +{ + return read(name, defaultValue ? cv::String(defaultValue) : cv::String()); +} + +utils::Paths utils::getConfigurationParameterPaths(const char* name, const utils::Paths &defaultValue) +{ + return read(name, defaultValue); } diff --git a/modules/dnn/src/opencl/conv_layer_spatial.cl b/modules/dnn/src/opencl/conv_layer_spatial.cl index c60b8fcdbb..37aceee983 100644 --- a/modules/dnn/src/opencl/conv_layer_spatial.cl +++ b/modules/dnn/src/opencl/conv_layer_spatial.cl @@ -280,15 +280,6 @@ convolve_simd( in_addr += INPUT_PITCH; - Dtype weight_buf[WEIGHT_PREF]; - int w_idx=0; - - for (int i = 0; i < WEIGHT_PREF; i++) - { - weight_buf[i] = weights[weight_addr]; - weight_addr += SIMD_SIZE; - } - #define BLOCK_IN(n, c) intel_sub_group_shuffle(in_buf[n], (c)) int kr = 0; // kr = Kernel Row @@ -297,20 +288,18 @@ convolve_simd( int kc = 0; // kc = Kernel Column LOOP(KERNEL_WIDTH, kc, { + Dtype weight_value = weights[weight_addr]; + weight_addr += SIMD_SIZE; for (int br=0; br < OUT_BLOCK_HEIGHT; br++) { for(int bc=0; bc < OUT_BLOCK_WIDTH; bc++) { Dtype input = BLOCK_IN((br * STRIDE_Y + kr * DILATION_Y), bc * STRIDE_X + kc * DILATION_X); - out[br * OUT_BLOCK_WIDTH + bc] = mad(weight_buf[w_idx % WEIGHT_PREF], input, out[br * OUT_BLOCK_WIDTH + bc]); + out[br * OUT_BLOCK_WIDTH + bc] = mad(weight_value, input, out[br * OUT_BLOCK_WIDTH + bc]); } } - weight_buf[w_idx % WEIGHT_PREF] = weights[weight_addr]; - weight_addr += SIMD_SIZE; - ++w_idx; }); }); - weight_addr -= WEIGHT_PREF * SIMD_SIZE; } fm = fm % ALIGNED_NUM_FILTERS; diff --git a/modules/features2d/CMakeLists.txt b/modules/features2d/CMakeLists.txt index 2a6456f69b..f18f69edb3 100644 --- a/modules/features2d/CMakeLists.txt +++ b/modules/features2d/CMakeLists.txt @@ -1,2 +1,2 @@ set(the_description "2D Features Framework") -ocv_define_module(features2d opencv_imgproc OPTIONAL opencv_flann opencv_highgui WRAP java python) +ocv_define_module(features2d opencv_imgproc OPTIONAL opencv_flann opencv_highgui WRAP java python js) diff --git a/modules/features2d/include/opencv2/features2d.hpp b/modules/features2d/include/opencv2/features2d.hpp index 254a82f40c..3785c69f95 100644 --- a/modules/features2d/include/opencv2/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d.hpp @@ -137,7 +137,11 @@ public: /** @brief Abstract base class for 2D image feature detectors and descriptor extractors */ +#ifdef __EMSCRIPTEN__ +class CV_EXPORTS_W Feature2D : public Algorithm +#else class CV_EXPORTS_W Feature2D : public virtual Algorithm +#endif { public: virtual ~Feature2D(); diff --git a/modules/features2d/src/matchers.cpp b/modules/features2d/src/matchers.cpp index 3a2d48c21b..ca137e28f0 100644 --- a/modules/features2d/src/matchers.cpp +++ b/modules/features2d/src/matchers.cpp @@ -40,7 +40,9 @@ //M*/ #include "precomp.hpp" +#ifdef HAVE_OPENCV_FLANN #include "opencv2/flann/miniflann.hpp" +#endif #include #include "opencl_kernels_features2d.hpp" diff --git a/modules/imgcodecs/include/opencv2/imgcodecs.hpp b/modules/imgcodecs/include/opencv2/imgcodecs.hpp index 5839c58c90..c5ffff97b2 100644 --- a/modules/imgcodecs/include/opencv2/imgcodecs.hpp +++ b/modules/imgcodecs/include/opencv2/imgcodecs.hpp @@ -63,7 +63,7 @@ namespace cv //! Imread flags enum ImreadModes { IMREAD_UNCHANGED = -1, //!< If set, return the loaded image as is (with alpha channel, otherwise it gets cropped). - IMREAD_GRAYSCALE = 0, //!< If set, always convert image to the single channel grayscale image. + IMREAD_GRAYSCALE = 0, //!< If set, always convert image to the single channel grayscale image (codec internal conversion). IMREAD_COLOR = 1, //!< If set, always convert image to the 3 channel BGR color image. IMREAD_ANYDEPTH = 2, //!< If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit. IMREAD_ANYCOLOR = 4, //!< If set, the image is read in any possible color format. @@ -155,6 +155,8 @@ Currently, the following file formats are supported: - The function determines the type of an image by the content, not by the file extension. - In the case of color images, the decoded images will have the channels stored in **B G R** order. +- When using IMREAD_GRAYSCALE, the codec's internal grayscale conversion will be used, if available. + Results may differ to the output of cvtColor() - On Microsoft Windows\* OS and MacOSX\*, the codecs shipped with an OpenCV image (libjpeg, libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs, and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware diff --git a/modules/java/generator/android/java/org/opencv/android/FpsMeter.java b/modules/java/generator/android/java/org/opencv/android/FpsMeter.java index 88e826cf96..d22c68e415 100644 --- a/modules/java/generator/android/java/org/opencv/android/FpsMeter.java +++ b/modules/java/generator/android/java/org/opencv/android/FpsMeter.java @@ -14,7 +14,7 @@ public class FpsMeter { private static final int STEP = 20; private static final DecimalFormat FPS_FORMAT = new DecimalFormat("0.00"); - private int mFramesCouner; + private int mFramesCounter; private double mFrequency; private long mprevFrameTime; private String mStrfps; @@ -24,7 +24,7 @@ public class FpsMeter { int mHeight = 0; public void init() { - mFramesCouner = 0; + mFramesCounter = 0; mFrequency = Core.getTickFrequency(); mprevFrameTime = Core.getTickCount(); mStrfps = ""; @@ -39,8 +39,8 @@ public class FpsMeter { init(); mIsInitialized = true; } else { - mFramesCouner++; - if (mFramesCouner % STEP == 0) { + mFramesCounter++; + if (mFramesCounter % STEP == 0) { long time = Core.getTickCount(); double fps = STEP * mFrequency / (time - mprevFrameTime); mprevFrameTime = time; diff --git a/modules/js/src/embindgen.py b/modules/js/src/embindgen.py index 5865049595..7ba9b6038f 100644 --- a/modules/js/src/embindgen.py +++ b/modules/js/src/embindgen.py @@ -125,7 +125,22 @@ video = {'': ['CamShift', 'calcOpticalFlowFarneback', 'calcOpticalFlowPyrLK', 'c 'BackgroundSubtractor': ['apply', 'getBackgroundImage']} dnn = {'dnn_Net': ['setInput', 'forward'], - '': ['readNetFromCaffe', 'readNetFromTensorflow', 'readNetFromTorch', 'readNetFromDarknet', 'blobFromImage']} + '': ['readNetFromCaffe', 'readNetFromTensorflow', 'readNetFromTorch', 'readNetFromDarknet', + 'readNetFromONNX', 'readNet', 'blobFromImage']} + +features2d = {'Feature2D': ['detect', 'compute', 'detectAndCompute', 'descriptorSize', 'descriptorType', 'defaultNorm', 'empty', 'getDefaultName'], + 'BRISK': ['create', 'getDefaultName'], + 'ORB': ['create', 'setMaxFeatures', 'setScaleFactor', 'setNLevels', 'setEdgeThreshold', 'setFirstLevel', 'setWTA_K', 'setScoreType', 'setPatchSize', 'getFastThreshold', 'getDefaultName'], + 'MSER': ['create', 'detectRegions', 'setDelta', 'getDelta', 'setMinArea', 'getMinArea', 'setMaxArea', 'getMaxArea', 'setPass2Only', 'getPass2Only', 'getDefaultName'], + 'FastFeatureDetector': ['create', 'setThreshold', 'getThreshold', 'setNonmaxSuppression', 'getNonmaxSuppression', 'setType', 'getType', 'getDefaultName'], + 'AgastFeatureDetector': ['create', 'setThreshold', 'getThreshold', 'setNonmaxSuppression', 'getNonmaxSuppression', 'setType', 'getType', 'getDefaultName'], + 'GFTTDetector': ['create', 'setMaxFeatures', 'getMaxFeatures', 'setQualityLevel', 'getQualityLevel', 'setMinDistance', 'getMinDistance', 'setBlockSize', 'getBlockSize', 'setHarrisDetector', 'getHarrisDetector', 'setK', 'getK', 'getDefaultName'], + # 'SimpleBlobDetector': ['create'], + 'KAZE': ['create', 'setExtended', 'getExtended', 'setUpright', 'getUpright', 'setThreshold', 'getThreshold', 'setNOctaves', 'getNOctaves', 'setNOctaveLayers', 'getNOctaveLayers', 'setDiffusivity', 'getDiffusivity', 'getDefaultName'], + 'AKAZE': ['create', 'setDescriptorType', 'getDescriptorType', 'setDescriptorSize', 'getDescriptorSize', 'setDescriptorChannels', 'getDescriptorChannels', 'setThreshold', 'getThreshold', 'setNOctaves', 'getNOctaves', 'setNOctaveLayers', 'getNOctaveLayers', 'setDiffusivity', 'getDiffusivity', 'getDefaultName'], + 'DescriptorMatcher': ['add', 'clear', 'empty', 'isMaskSupported', 'train', 'match', 'knnMatch', 'radiusMatch', 'clone', 'create'], + 'BFMatcher': ['isMaskSupported', 'create'], + '': ['FAST', 'AGAST', 'drawKeypoints', 'drawMatches']} def makeWhiteList(module_list): wl = {} @@ -137,7 +152,7 @@ def makeWhiteList(module_list): wl[k] = m[k] return wl -white_list = makeWhiteList([core, imgproc, objdetect, video, dnn]) +white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d]) # Features to be exported export_enums = False @@ -218,7 +233,8 @@ def handle_ptr(tp): def handle_vector(tp): if tp.startswith('vector_'): - tp = 'std::vector<' + "::".join(tp.split('_')[1:]) + '>' + tp = handle_vector(tp[tp.find('_') + 1:]) + tp = 'std::vector<' + "::".join(tp.split('_')) + '>' return tp @@ -861,13 +877,12 @@ class JSWrapperGenerator(object): [class_info.cname, property.name]))) dv = '' - base = Template("""base<$base$isPoly>""") + base = Template("""base<$base>""") assert len(class_info.bases) <= 1 , "multiple inheritance not supported" if len(class_info.bases) == 1: - dv = "," + base.substitute(base=', '.join(class_info.bases), - isPoly = " ,true" if class_info.name=="Feature2D" else "") + dv = "," + base.substitute(base=', '.join(class_info.bases)) self.bindings.append(class_template.substitute(cpp_name=class_info.cname, js_name=name, diff --git a/modules/objdetect/src/hog.cpp b/modules/objdetect/src/hog.cpp index 3a6cdd8bde..40839dfb3a 100644 --- a/modules/objdetect/src/hog.cpp +++ b/modules/objdetect/src/hog.cpp @@ -136,6 +136,8 @@ void HOGDescriptor::setSVMDetector(InputArray _svmDetector) bool HOGDescriptor::read(FileNode& obj) { + CV_Assert(!obj["winSize"].empty()); + if( !obj.isMap() ) return false; FileNodeIterator it = obj["winSize"].begin(); diff --git a/modules/ts/misc/report.py b/modules/ts/misc/report.py index 5c962b774b..f0a87f2a12 100755 --- a/modules/ts/misc/report.py +++ b/modules/ts/misc/report.py @@ -66,7 +66,7 @@ if __name__ == "__main__": tbl.newColumn(m, metrix_table[m][0], align = "center") needNewRow = True - for case in sorted(tests): + for case in sorted(tests, key=lambda x: str(x)): if needNewRow: tbl.newRow() if not options.showall: diff --git a/modules/ts/misc/run_suite.py b/modules/ts/misc/run_suite.py index 2eaeae1c3f..a3c4be7546 100644 --- a/modules/ts/misc/run_suite.py +++ b/modules/ts/misc/run_suite.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import os import re +import sys from run_utils import Err, log, execute, getPlatformVersion, isColorEnabled, TempEnvDir from run_long import LONG_TESTS_DEBUG_VALGRIND, longTestFilter @@ -116,6 +117,8 @@ class TestSuite(object): return None, ret elif module in ['python2', 'python3']: executable = os.getenv('OPENCV_PYTHON_BINARY', None) + if executable is None or module == 'python{}'.format(sys.version_info[0]): + executable = sys.executable if executable is None: executable = path if not self.tryCommand([executable, '--version'], workingDir): diff --git a/modules/ts/misc/summary.py b/modules/ts/misc/summary.py index f03b62b9bf..5549b6c6dc 100755 --- a/modules/ts/misc/summary.py +++ b/modules/ts/misc/summary.py @@ -177,7 +177,7 @@ if __name__ == "__main__": prevGroupName = None needNewRow = True lastRow = None - for name in sorted(test_cases.iterkeys(), key=alphanum_keyselector): + for name in sorted(test_cases.keys(), key=alphanum_keyselector): cases = test_cases[name] if needNewRow: lastRow = tbl.newRow() diff --git a/modules/ts/misc/table_formatter.py b/modules/ts/misc/table_formatter.py index 6069dea3b4..1c1fd7852e 100755 --- a/modules/ts/misc/table_formatter.py +++ b/modules/ts/misc/table_formatter.py @@ -98,7 +98,7 @@ class table(object): def layoutTable(self): columns = self.columns.values() - columns.sort(key=lambda c: c.index) + columns = sorted(columns, key=lambda c: c.index) colspanned = [] rowspanned = [] @@ -206,7 +206,7 @@ class table(object): cell.width = len(max(cell.text, key = lambda line: len(line))) def reformatTextValue(self, value): - if sys.version_info > (3,): # PY3 fix + if sys.version_info >= (2,7): unicode = str if isinstance(value, str): vstr = value @@ -340,7 +340,7 @@ class table(object): if align == "right": pattern = "%" + str(width) + "s" elif align == "center": - pattern = "%" + str((width - len(line)) / 2 + len(line)) + "s" + " " * (width - len(line) - (width - len(line)) / 2) + pattern = "%" + str((width - len(line)) // 2 + len(line)) + "s" + " " * (width - len(line) - (width - len(line)) // 2) else: pattern = "%-" + str(width) + "s" @@ -354,7 +354,7 @@ class table(object): if valign == "bottom": return height - space if valign == "middle": - return (height - space + 1) / 2 + return (height - space + 1) // 2 return 0 def htmlPrintTable(self, out, embeedcss = False): diff --git a/modules/ts/misc/testlog_parser.py b/modules/ts/misc/testlog_parser.py index 5f4414059d..80c5a0bc5a 100755 --- a/modules/ts/misc/testlog_parser.py +++ b/modules/ts/misc/testlog_parser.py @@ -202,7 +202,7 @@ def parseLogFile(filename): if attr_name.startswith('cv_') } - tests = map(TestInfo, log.getElementsByTagName("testcase")) + tests = list(map(TestInfo, log.getElementsByTagName("testcase"))) return TestRunInfo(properties, tests) diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp index ce337ea10f..b6a180f636 100644 --- a/modules/videoio/src/cap_ffmpeg_impl.hpp +++ b/modules/videoio/src/cap_ffmpeg_impl.hpp @@ -1541,7 +1541,7 @@ static AVStream *icv_add_video_stream_FFMPEG(AVFormatContext *oc, identically 1. */ frame_rate=(int)(fps+0.5); frame_rate_base=1; - while (fabs((double)frame_rate/frame_rate_base) - fps > 0.001){ + while (fabs(((double)frame_rate/frame_rate_base) - fps) > 0.001){ frame_rate_base*=10; frame_rate=(int)(fps*frame_rate_base + 0.5); } @@ -2374,7 +2374,7 @@ AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CV_CODEC int frame_rate = static_cast(fps+0.5); int frame_rate_base = 1; - while (fabs(static_cast(frame_rate)/frame_rate_base) - fps > 0.001) + while (fabs((static_cast(frame_rate)/frame_rate_base) - fps) > 0.001) { frame_rate_base *= 10; frame_rate = static_cast(fps*frame_rate_base + 0.5); diff --git a/platforms/ios/build_framework.py b/platforms/ios/build_framework.py index 87264efed7..c298962ba5 100755 --- a/platforms/ios/build_framework.py +++ b/platforms/ios/build_framework.py @@ -39,10 +39,11 @@ def execute(cmd, cwd = None): def getXCodeMajor(): ret = check_output(["xcodebuild", "-version"]) - m = re.match(r'XCode\s+(\d)\..*', ret, flags=re.IGNORECASE) + m = re.match(r'Xcode\s+(\d+)\..*', ret, flags=re.IGNORECASE) if m: return int(m.group(1)) - return 0 + else: + raise Exception("Failed to parse Xcode version") class Builder: def __init__(self, opencv, contrib, dynamic, bitcodedisabled, exclude, targets): diff --git a/platforms/js/build_js.py b/platforms/js/build_js.py index 143139bce2..2e55b7b308 100644 --- a/platforms/js/build_js.py +++ b/platforms/js/build_js.py @@ -83,6 +83,7 @@ class Builder: "-DCV_TRACE=OFF", "-DBUILD_SHARED_LIBS=OFF", "-DWITH_1394=OFF", + "-DWITH_ADE=OFF", "-DWITH_VTK=OFF", "-DWITH_EIGEN=OFF", "-DWITH_FFMPEG=OFF", @@ -114,8 +115,9 @@ class Builder: "-DBUILD_opencv_apps=OFF", "-DBUILD_opencv_calib3d=ON", "-DBUILD_opencv_dnn=ON", - "-DBUILD_opencv_features2d=OFF", + "-DBUILD_opencv_features2d=ON", "-DBUILD_opencv_flann=OFF", + "-DBUILD_opencv_gapi=OFF", "-DBUILD_opencv_ml=OFF", "-DBUILD_opencv_photo=OFF", "-DBUILD_opencv_imgcodecs=OFF",