From 0d32a24cba1d00fe3e305593c3bd7b352cb3763f Mon Sep 17 00:00:00 2001 From: lamm45 <96844552+lamm45@users.noreply.github.com> Date: Sun, 10 Apr 2022 13:13:30 -0400 Subject: [PATCH 01/17] Fix some doc references in geometric image transformations module --- modules/imgproc/include/opencv2/imgproc.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/imgproc/include/opencv2/imgproc.hpp b/modules/imgproc/include/opencv2/imgproc.hpp index 9425ba88d5..a21c9227af 100644 --- a/modules/imgproc/include/opencv2/imgproc.hpp +++ b/modules/imgproc/include/opencv2/imgproc.hpp @@ -118,7 +118,7 @@ sophisticated [interpolation methods](http://en.wikipedia.org/wiki/Multivariate_ where a polynomial function is fit into some neighborhood of the computed pixel \f$(f_x(x,y), f_y(x,y))\f$, and then the value of the polynomial at \f$(f_x(x,y), f_y(x,y))\f$ is taken as the interpolated pixel value. In OpenCV, you can choose between several interpolation methods. See -resize for details. +#resize for details. @note The geometrical transformations do not work with `CV_8S` or `CV_32S` images. @@ -2265,7 +2265,7 @@ way: resize(src, dst, Size(), 0.5, 0.5, interpolation); @endcode To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to -enlarge an image, it will generally look best with c#INTER_CUBIC (slow) or #INTER_LINEAR +enlarge an image, it will generally look best with #INTER_CUBIC (slow) or #INTER_LINEAR (faster but still looks OK). @param src input image. @@ -2357,7 +2357,7 @@ The function remap transforms the source image using the specified map: where values of pixels with non-integer coordinates are computed using one of available interpolation methods. \f$map_x\f$ and \f$map_y\f$ can be encoded as separate floating-point maps in \f$map_1\f$ and \f$map_2\f$ respectively, or interleaved floating-point maps of \f$(x,y)\f$ in -\f$map_1\f$, or fixed-point maps created by using convertMaps. The reason you might want to +\f$map_1\f$, or fixed-point maps created by using #convertMaps. The reason you might want to convert from floating to fixed-point representations of a map is that they can yield much faster (\~2x) remapping operations. In the converted case, \f$map_1\f$ contains pairs (cvFloor(x), cvFloor(y)) and \f$map_2\f$ contains indices in a table of interpolation coefficients. @@ -2367,7 +2367,7 @@ This function cannot operate in-place. @param src Source image. @param dst Destination image. It has the same size as map1 and the same type as src . @param map1 The first map of either (x,y) points or just x values having the type CV_16SC2 , -CV_32FC1, or CV_32FC2. See convertMaps for details on converting a floating point +CV_32FC1, or CV_32FC2. See #convertMaps for details on converting a floating point representation to fixed-point for speed. @param map2 The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively. @@ -2392,7 +2392,7 @@ options ( (map1.type(), map2.type()) \f$\rightarrow\f$ (dstmap1.type(), dstmap2. supported: - \f$\texttt{(CV_32FC1, CV_32FC1)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}\f$. This is the -most frequently used conversion operation, in which the original floating-point maps (see remap ) +most frequently used conversion operation, in which the original floating-point maps (see #remap) are converted to a more compact and much faster fixed-point representation. The first output array contains the rounded coordinates and the second array (created only when nninterpolation=false ) contains indices in the interpolation tables. From 2958142e315c912fcf9fa6c0d42e9fd8d0f3a2df Mon Sep 17 00:00:00 2001 From: Qingnan Duan Date: Mon, 18 Apr 2022 14:18:27 +0800 Subject: [PATCH 02/17] Remove extra not in doc --- modules/core/include/opencv2/core/mat.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/include/opencv2/core/mat.hpp b/modules/core/include/opencv2/core/mat.hpp index 919fa0b6f9..54eee9bfa8 100644 --- a/modules/core/include/opencv2/core/mat.hpp +++ b/modules/core/include/opencv2/core/mat.hpp @@ -1030,7 +1030,7 @@ public: @param copyData Flag to specify whether the underlying data of the STL vector should be copied to (true) or shared with (false) the newly constructed matrix. When the data is copied, the allocated buffer is managed using Mat reference counting mechanism. While the data is shared, - the reference counter is NULL, and you should not deallocate the data until the matrix is not + the reference counter is NULL, and you should not deallocate the data until the matrix is destructed. */ template explicit Mat(const std::vector<_Tp>& vec, bool copyData=false); From 1cdd8510fd9d3957df4fa513a1fbc2df32bf0346 Mon Sep 17 00:00:00 2001 From: Yulv-git Date: Sat, 30 Apr 2022 13:29:25 +0800 Subject: [PATCH 03/17] Fix some typos in doc. --- 3rdparty/openvx/README.md | 2 +- .../js_morphological_ops/js_morphological_ops.markdown | 2 +- doc/js_tutorials/js_setup/js_nodejs/js_nodejs.markdown | 2 +- .../py_feature_homography/py_feature_homography.markdown | 4 ++-- .../py_morphological_ops/py_morphological_ops.markdown | 2 +- .../imgproc/morph_lines_detection/morph_lines_detection.md | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/3rdparty/openvx/README.md b/3rdparty/openvx/README.md index 2f869a42bf..339b5072cc 100644 --- a/3rdparty/openvx/README.md +++ b/3rdparty/openvx/README.md @@ -77,7 +77,7 @@ E.g. external ref-counting is implemented for 1.0 version and native OpenVX one Also there are some **C++ 11** features are used (e.g. rvalue ref-s) when their availability is detected at ***compile time***. -C++ exceptions are used for errors indication instead of return codes. There are two types of exceptions are defined: `RuntimeError` is thrown when OpenVX C call returned unsuccessful result and `WrapperError` is thrown when a problem is occured in the wrappers code. Both exception calsses are derived from `std::exception` (actually from its inheritants). +C++ exceptions are used for errors indication instead of return codes. There are two types of exceptions are defined: `RuntimeError` is thrown when OpenVX C call returned unsuccessful result and `WrapperError` is thrown when a problem is occurred in the wrappers code. Both exception calsses are derived from `std::exception` (actually from its inheritants). The so called **OpenVX objects** (e.g. `vx_image`) are represented as C++ classes in wrappers. All these classes use automatic ref-counting that allows development of exception-safe code. diff --git a/doc/js_tutorials/js_imgproc/js_morphological_ops/js_morphological_ops.markdown b/doc/js_tutorials/js_imgproc/js_morphological_ops/js_morphological_ops.markdown index b5e10e0e67..9ffa218bb2 100644 --- a/doc/js_tutorials/js_imgproc/js_morphological_ops/js_morphological_ops.markdown +++ b/doc/js_tutorials/js_imgproc/js_morphological_ops/js_morphological_ops.markdown @@ -52,7 +52,7 @@ Try it ### 2. Dilation -It is just opposite of erosion. Here, a pixel element is '1' if atleast one pixel under the kernel +It is just opposite of erosion. Here, a pixel element is '1' if at least one pixel under the kernel is '1'. So it increases the white region in the image or size of foreground object increases. Normally, in cases like noise removal, erosion is followed by dilation. Because, erosion removes white noises, but it also shrinks our object. So we dilate it. Since noise is gone, they won't come diff --git a/doc/js_tutorials/js_setup/js_nodejs/js_nodejs.markdown b/doc/js_tutorials/js_setup/js_nodejs/js_nodejs.markdown index 2fe17c5db6..17ced36b5a 100644 --- a/doc/js_tutorials/js_setup/js_nodejs/js_nodejs.markdown +++ b/doc/js_tutorials/js_setup/js_nodejs/js_nodejs.markdown @@ -223,7 +223,7 @@ Before the example, is worth consider first how files are handled in emscripten These C++ sources use standard APIs to access the filesystem and the implementation often ends up in system calls that read a file in the hard drive. Since JavaScript applications in the browser don't have access to the local filesystem, [emscripten emulates a standard filesystem](https://emscripten.org/docs/api_reference/Filesystem-API.html) so compiled C++ code works out of the box. -In the browser, this filesystem is emulated in memory while in Node.js there's also the possibility of using the local filesystem directly. This is often preferable since there's no need of copy file's content in memory. This section is explains how to do do just that, this is, configuring emscripten so files are accessed directly from our local filesystem and relative paths match files relative to the current local directory as expected. +In the browser, this filesystem is emulated in memory while in Node.js there's also the possibility of using the local filesystem directly. This is often preferable since there's no need of copy file's content in memory. This section explains how to do just that, this is, configuring emscripten so files are accessed directly from our local filesystem and relative paths match files relative to the current local directory as expected. ### The example ### diff --git a/doc/py_tutorials/py_feature2d/py_feature_homography/py_feature_homography.markdown b/doc/py_tutorials/py_feature2d/py_feature_homography/py_feature_homography.markdown index f8836b095b..6abac2c57b 100644 --- a/doc/py_tutorials/py_feature2d/py_feature_homography/py_feature_homography.markdown +++ b/doc/py_tutorials/py_feature2d/py_feature_homography/py_feature_homography.markdown @@ -18,7 +18,7 @@ is sufficient to find the object exactly on the trainImage. For that, we can use a function from calib3d module, ie **cv.findHomography()**. If we pass the set of points from both the images, it will find the perspective transformation of that object. Then we -can use **cv.perspectiveTransform()** to find the object. It needs atleast four correct points to +can use **cv.perspectiveTransform()** to find the object. It needs at least four correct points to find the transformation. We have seen that there can be some possible errors while matching which may affect the result. To @@ -64,7 +64,7 @@ for m,n in matches: if m.distance < 0.7*n.distance: good.append(m) @endcode -Now we set a condition that atleast 10 matches (defined by MIN_MATCH_COUNT) are to be there to +Now we set a condition that at least 10 matches (defined by MIN_MATCH_COUNT) are to be there to find the object. Otherwise simply show a message saying not enough matches are present. If enough matches are found, we extract the locations of matched keypoints in both the images. They diff --git a/doc/py_tutorials/py_imgproc/py_morphological_ops/py_morphological_ops.markdown b/doc/py_tutorials/py_imgproc/py_morphological_ops/py_morphological_ops.markdown index 35e716d8e9..84a62d14cd 100644 --- a/doc/py_tutorials/py_imgproc/py_morphological_ops/py_morphological_ops.markdown +++ b/doc/py_tutorials/py_imgproc/py_morphological_ops/py_morphological_ops.markdown @@ -48,7 +48,7 @@ Result: ### 2. Dilation -It is just opposite of erosion. Here, a pixel element is '1' if atleast one pixel under the kernel +It is just opposite of erosion. Here, a pixel element is '1' if at least one pixel under the kernel is '1'. So it increases the white region in the image or size of foreground object increases. Normally, in cases like noise removal, erosion is followed by dilation. Because, erosion removes white noises, but it also shrinks our object. So we dilate it. Since noise is gone, they won't come diff --git a/doc/tutorials/imgproc/morph_lines_detection/morph_lines_detection.md b/doc/tutorials/imgproc/morph_lines_detection/morph_lines_detection.md index ccce36270c..39a76a74ce 100644 --- a/doc/tutorials/imgproc/morph_lines_detection/morph_lines_detection.md +++ b/doc/tutorials/imgproc/morph_lines_detection/morph_lines_detection.md @@ -123,7 +123,7 @@ Get image from [here](https://raw.githubusercontent.com/opencv/opencv/3.4/doc/tu #### Output images -Now we are ready to apply morphological operations in order to extract the horizontal and vertical lines and as a consequence to separate the the music notes from the music sheet, but first let's initialize the output images that we will use for that reason: +Now we are ready to apply morphological operations in order to extract the horizontal and vertical lines and as a consequence to separate the music notes from the music sheet, but first let's initialize the output images that we will use for that reason: @add_toggle_cpp @snippet samples/cpp/tutorial_code/ImgProc/morph_lines_detection/Morphology_3.cpp init From 15ac54d5d608bce2c6cda3a0a403449d6bd3a9bc Mon Sep 17 00:00:00 2001 From: Yulv-git Date: Sat, 30 Apr 2022 13:40:07 +0800 Subject: [PATCH 04/17] Fix some typos in modules/. --- modules/core/include/opencv2/core/mat.hpp | 2 +- modules/cudafilters/include/opencv2/cudafilters.hpp | 2 +- modules/cudafilters/src/cuda/median_filter.cu | 2 +- modules/dnn/src/darknet/darknet_io.cpp | 2 +- modules/dnn/src/onnx/opencv-onnx.proto | 2 +- modules/imgproc/include/opencv2/imgproc.hpp | 2 +- modules/imgproc/src/opencl/medianFilter.cl | 2 +- modules/imgproc/test/test_convhull.cpp | 2 +- modules/ml/src/lr.cpp | 2 +- modules/videoio/src/cap_gstreamer.cpp | 2 +- modules/videoio/src/cap_intelperc.cpp | 8 ++++---- modules/videoio/src/cap_intelperc.hpp | 2 +- modules/videoio/src/cap_libv4l.cpp | 2 +- modules/videoio/test/test_video_io.cpp | 2 +- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/modules/core/include/opencv2/core/mat.hpp b/modules/core/include/opencv2/core/mat.hpp index 919fa0b6f9..289ba7f7c5 100644 --- a/modules/core/include/opencv2/core/mat.hpp +++ b/modules/core/include/opencv2/core/mat.hpp @@ -2290,7 +2290,7 @@ public: const_iterator begin() const; const_iterator end() const; - //! template methods for for operation over all matrix elements. + //! template methods for operation over all matrix elements. // the operations take care of skipping gaps in the end of rows (if any) template void forEach(const Functor& operation); template void forEach(const Functor& operation) const; diff --git a/modules/cudafilters/include/opencv2/cudafilters.hpp b/modules/cudafilters/include/opencv2/cudafilters.hpp index 1e25e5602d..8cd109f775 100644 --- a/modules/cudafilters/include/opencv2/cudafilters.hpp +++ b/modules/cudafilters/include/opencv2/cudafilters.hpp @@ -318,7 +318,7 @@ CV_EXPORTS Ptr createColumnSumFilter(int srcType, int dstType, int ksize /** @brief Performs median filtering for each point of the source image. -@param srcType type of of source image. Only CV_8UC1 images are supported for now. +@param srcType type of source image. Only CV_8UC1 images are supported for now. @param windowSize Size of the kernerl used for the filtering. Uses a (windowSize x windowSize) filter. @param partition Specifies the parallel granularity of the workload. This parameter should be used GPU experts when optimizing performance. diff --git a/modules/cudafilters/src/cuda/median_filter.cu b/modules/cudafilters/src/cuda/median_filter.cu index dd43a365c0..0b9f3c718e 100644 --- a/modules/cudafilters/src/cuda/median_filter.cu +++ b/modules/cudafilters/src/cuda/median_filter.cu @@ -235,7 +235,7 @@ namespace cv { namespace cuda { namespace device } __syncthreads(); - // For all remaining rows in the median filter, add the values to the the histogram + // For all remaining rows in the median filter, add the values to the histogram for (int j=threadIdx.x; j 1) { // layer ids in layers_vec - inputs of Slice layers - // after adding offset to layers_vec: layer ids - ouputs of Slice layers + // after adding offset to layers_vec: layer ids - outputs of Slice layers for (size_t k = 0; k < layers_vec.size(); ++k) layers_vec[k] += layers_vec.size(); diff --git a/modules/dnn/src/onnx/opencv-onnx.proto b/modules/dnn/src/onnx/opencv-onnx.proto index b24220adb9..8dd69cb2d9 100644 --- a/modules/dnn/src/onnx/opencv-onnx.proto +++ b/modules/dnn/src/onnx/opencv-onnx.proto @@ -61,7 +61,7 @@ enum Version { // The version field is always serialized and we will use it to store the // version that the graph is generated from. This helps us set up version // control. - // For the IR, we are using simple numbers starting with with 0x00000001, + // For the IR, we are using simple numbers starting with 0x00000001, // which was the version we published on Oct 10, 2017. IR_VERSION_2017_10_10 = 0x0000000000000001; diff --git a/modules/imgproc/include/opencv2/imgproc.hpp b/modules/imgproc/include/opencv2/imgproc.hpp index 9425ba88d5..5ba36040c9 100644 --- a/modules/imgproc/include/opencv2/imgproc.hpp +++ b/modules/imgproc/include/opencv2/imgproc.hpp @@ -1537,7 +1537,7 @@ CV_EXPORTS_W void boxFilter( InputArray src, OutputArray dst, int ddepth, For every pixel \f$ (x, y) \f$ in the source image, the function calculates the sum of squares of those neighboring pixel values which overlap the filter placed over the pixel \f$ (x, y) \f$. -The unnormalized square box filter can be useful in computing local image statistics such as the the local +The unnormalized square box filter can be useful in computing local image statistics such as the local variance and standard deviation around the neighborhood of a pixel. @param src input image diff --git a/modules/imgproc/src/opencl/medianFilter.cl b/modules/imgproc/src/opencl/medianFilter.cl index f9a6c9e8f4..b517a38059 100644 --- a/modules/imgproc/src/opencl/medianFilter.cl +++ b/modules/imgproc/src/opencl/medianFilter.cl @@ -43,7 +43,7 @@ #ifdef USE_4OPT -//Utility macros for for 1,2,4 channel images: +//Utility macros for 1,2,4 channel images: // - LOAD4/STORE4 - load/store 4-pixel groups from/to global memory // - SHUFFLE4_3/SHUFFLE4_5 - rearrange scattered border/central pixels into regular 4-pixel variables diff --git a/modules/imgproc/test/test_convhull.cpp b/modules/imgproc/test/test_convhull.cpp index aa553e5efe..e5f6bd8e63 100644 --- a/modules/imgproc/test/test_convhull.cpp +++ b/modules/imgproc/test/test_convhull.cpp @@ -1015,7 +1015,7 @@ int CV_MinCircleTest::validate_test_results( int test_case_idx ) if( point_count >= 2 && (j < 2 || (j == 2 && cvTsDist(v[0],v[1]) < (radius-1)*2/eps)) ) { ts->printf( cvtest::TS::LOG, - "There should be at at least 3 points near the circle boundary or 2 points on the diameter\n" ); + "There should be at least 3 points near the circle boundary or 2 points on the diameter\n" ); code = cvtest::TS::FAIL_BAD_ACCURACY; goto _exit_; } diff --git a/modules/ml/src/lr.cpp b/modules/ml/src/lr.cpp index ed4fb4c720..b43e104045 100644 --- a/modules/ml/src/lr.cpp +++ b/modules/ml/src/lr.cpp @@ -126,7 +126,7 @@ bool LogisticRegressionImpl::train(const Ptr& trainData, int) int num_classes = (int) this->forward_mapper.size(); if(num_classes < 2) { - CV_Error( CV_StsBadArg, "data should have atleast 2 classes" ); + CV_Error( CV_StsBadArg, "data should have at least 2 classes" ); } // add a column of ones to the data (bias/intercept term) diff --git a/modules/videoio/src/cap_gstreamer.cpp b/modules/videoio/src/cap_gstreamer.cpp index dd6387d892..34bc98eaba 100644 --- a/modules/videoio/src/cap_gstreamer.cpp +++ b/modules/videoio/src/cap_gstreamer.cpp @@ -334,7 +334,7 @@ GStreamerCapture::~GStreamerCapture() /*! * \brief CvCapture_GStreamer::grabFrame * \return - * Grabs a sample from the pipeline, awaiting consumation by retreiveFrame. + * Grabs a sample from the pipeline, awaiting consumation by retrieveFrame. * The pipeline is started if it was not running yet */ bool GStreamerCapture::grabFrame() diff --git a/modules/videoio/src/cap_intelperc.cpp b/modules/videoio/src/cap_intelperc.cpp index 093b1fd235..63e43ee0da 100644 --- a/modules/videoio/src/cap_intelperc.cpp +++ b/modules/videoio/src/cap_intelperc.cpp @@ -507,21 +507,21 @@ bool IntelPerCStreamDepth::setProperty(int propIdx, double propVal) } bool IntelPerCStreamDepth::retrieveDepthAsOutputArray(cv::OutputArray image) { - return retriveFrame(CV_16SC1, 0, image); + return retrieveFrame(CV_16SC1, 0, image); } bool IntelPerCStreamDepth::retrieveIRAsOutputArray(cv::OutputArray image) { - return retriveFrame(CV_16SC1, 1, image); + return retrieveFrame(CV_16SC1, 1, image); } bool IntelPerCStreamDepth::retrieveUVAsOutputArray(cv::OutputArray image) { - return retriveFrame(CV_32FC2, 2, image); + return retrieveFrame(CV_32FC2, 2, image); } bool IntelPerCStreamDepth::validProfile(const PXCCapture::VideoStream::ProfileInfo& pinfo) { return (PXCImage::COLOR_FORMAT_DEPTH == pinfo.imageInfo.format); } -bool IntelPerCStreamDepth::retriveFrame(int type, int planeIdx, cv::OutputArray frame) +bool IntelPerCStreamDepth::retrieveFrame(int type, int planeIdx, cv::OutputArray frame) { if (!m_pxcImage.IsValid()) return false; diff --git a/modules/videoio/src/cap_intelperc.hpp b/modules/videoio/src/cap_intelperc.hpp index 209cd4736a..66ba3e21ca 100644 --- a/modules/videoio/src/cap_intelperc.hpp +++ b/modules/videoio/src/cap_intelperc.hpp @@ -85,7 +85,7 @@ public: protected: virtual bool validProfile(const PXCCapture::VideoStream::ProfileInfo& pinfo); protected: - bool retriveFrame(int type, int planeIdx, OutputArray frame); + bool retrieveFrame(int type, int planeIdx, OutputArray frame); }; class VideoCapture_IntelPerC : public IVideoCapture diff --git a/modules/videoio/src/cap_libv4l.cpp b/modules/videoio/src/cap_libv4l.cpp index 6fd0f757a8..1c1129ceaa 100644 --- a/modules/videoio/src/cap_libv4l.cpp +++ b/modules/videoio/src/cap_libv4l.cpp @@ -1858,7 +1858,7 @@ static int icvSetPropertyCAM_V4L(CvCaptureCAM_V4L* capture, int property_id, dou retval = icvSetControl(capture, property_id, value); } - /* return the the status */ + /* return the status */ return retval; } diff --git a/modules/videoio/test/test_video_io.cpp b/modules/videoio/test/test_video_io.cpp index 44947f02f4..e82ef9fd48 100644 --- a/modules/videoio/test/test_video_io.cpp +++ b/modules/videoio/test/test_video_io.cpp @@ -261,7 +261,7 @@ public: if (cvtest::debugLevel > 0) std::cout << "i = " << i << ": timestamp = " << timestamp << std::endl; const double frame_period = 1000.f/bunny_param.getFps(); - // NOTE: eps == frame_period, because videoCapture returns frame begining timestamp or frame end + // NOTE: eps == frame_period, because videoCapture returns frame beginning timestamp or frame end // timestamp depending on codec and back-end. So the first frame has timestamp 0 or frame_period. EXPECT_NEAR(timestamp, i*frame_period, frame_period) << "i=" << i; } From 667e5e4f890f24a638ca04f638967f1083468bb0 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Thu, 5 May 2022 09:59:29 +0200 Subject: [PATCH 05/17] Merge pull request #21943 from vrabaud:3.4_proc * Fix compilation with non glibc. _SC_NPROCESSORS_ONLN is non standard as defined on https://man7.org/linux/man-pages/man3/sysconf.3.html It seems to only be on glibc, cf https://www.gnu.org/software/libc/manual/html_node/Processor-Resources.html * Fix to defined(_SC_NPROCESSORS_ONLN) --- modules/core/src/parallel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/src/parallel.cpp b/modules/core/src/parallel.cpp index 95df5454c2..a4a7baf0f6 100644 --- a/modules/core/src/parallel.cpp +++ b/modules/core/src/parallel.cpp @@ -942,7 +942,7 @@ int getNumberOfCPUs_() #endif -#if !defined(_WIN32) && !defined(__APPLE__) +#if !defined(_WIN32) && !defined(__APPLE__) && defined(_SC_NPROCESSORS_ONLN) static unsigned cpu_count_sysconf = (unsigned)sysconf( _SC_NPROCESSORS_ONLN ); ncpus = minNonZero(ncpus, cpu_count_sysconf); From e4ed2d2e42d33cfcfa51a77ad696b5f8b8f44cef Mon Sep 17 00:00:00 2001 From: hellodoge <45069008+hellodoge@users.noreply.github.com> Date: Mon, 9 May 2022 15:52:43 +0300 Subject: [PATCH 06/17] fix JpegEncoder::write 3rdparty/libjpeg-turbo/src/jpeglib.h: `* NB: you must set up the error-manager BEFORE calling jpeg_create_xxx.` --- modules/imgcodecs/src/grfmt_jpeg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imgcodecs/src/grfmt_jpeg.cpp b/modules/imgcodecs/src/grfmt_jpeg.cpp index 758ac512e8..d9e056f1a8 100644 --- a/modules/imgcodecs/src/grfmt_jpeg.cpp +++ b/modules/imgcodecs/src/grfmt_jpeg.cpp @@ -602,9 +602,9 @@ bool JpegEncoder::write( const Mat& img, const std::vector& params ) JpegErrorMgr jerr; JpegDestination dest; - jpeg_create_compress(&cinfo); cinfo.err = jpeg_std_error(&jerr.pub); jerr.pub.error_exit = error_exit; + jpeg_create_compress(&cinfo); if( !m_buf ) { From dea08151994449296a3aac7074703df6779623aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pol=C3=A1k?= Date: Fri, 6 May 2022 14:41:52 +0200 Subject: [PATCH 07/17] Small imencode documentation improvement It was previously not clear that the extension should include the period, [and I am not the only person that encountered this problem](https://stackoverflow.com/questions/4254460/opencv-could-not-find-encoder-for-the-specified-extension). I assume that this is true for all supported extensions, but I haven't checked the source. --- modules/imgcodecs/include/opencv2/imgcodecs.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imgcodecs/include/opencv2/imgcodecs.hpp b/modules/imgcodecs/include/opencv2/imgcodecs.hpp index 5dbf348463..ba63e9934b 100644 --- a/modules/imgcodecs/include/opencv2/imgcodecs.hpp +++ b/modules/imgcodecs/include/opencv2/imgcodecs.hpp @@ -262,7 +262,7 @@ CV_EXPORTS Mat imdecode( InputArray buf, int flags, Mat* dst); The function imencode compresses the image and stores it in the memory buffer that is resized to fit the result. See cv::imwrite for the list of supported formats and flags description. -@param ext File extension that defines the output format. +@param ext File extension that defines the output format. Must include a leading period. @param img Image to be written. @param buf Output buffer resized to fit the compressed image. @param params Format-specific parameters. See cv::imwrite and cv::ImwriteFlags. From 07abb6240ee60053581d529316ac669fcd42f2a3 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Wed, 11 May 2022 17:53:40 +0300 Subject: [PATCH 08/17] GTest filtered list --- .github/workflows/PR-3.4-W10.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PR-3.4-W10.yaml b/.github/workflows/PR-3.4-W10.yaml index a7e8be71a2..d965982f5a 100644 --- a/.github/workflows/PR-3.4-W10.yaml +++ b/.github/workflows/PR-3.4-W10.yaml @@ -12,7 +12,7 @@ env: PR_AUTHOR_FORK: ${{ github.event.pull_request.head.repo.full_name }} SOURCE_BRANCH_NAME: ${{ github.head_ref }} TARGET_BRANCH_NAME: ${{ github.base_ref }} - GTEST_FILTER_STRING: '-Samples.findFile:ExposureCompensate.SimilarityThreshold:DNNTestNetwork.MobileNet_SSD_v2_TensorFlow*:DNNTestNetwork.Inception_v2_SSD_TensorFlow*:Test_TensorFlow_nets.Inception_v2_SSD*:Test_Darknet_nets.YOLOv4_tiny*:videoio/videocapture_acceleration.read/61:Drawing.ttf_text' + GTEST_FILTER_STRING: '-Samples.findFile' GIT_CACHE: c:\Slave\git_cache jobs: From 646025589b73bdf4b55da1604a093c9ab52b616d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joona=20Heikkil=C3=A4?= <21111572+cxcorp@users.noreply.github.com> Date: Wed, 11 May 2022 23:15:34 +0300 Subject: [PATCH 09/17] Fix global variable assignment in JS test suite In test_imgproc.js, the test_filter suite's last test assigns a variable to `size` without declaring it with `let`, polluting the global scope. This commit adds `let` to the statement, so that the variable is scoped to the test block. --- modules/js/test/test_imgproc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/js/test/test_imgproc.js b/modules/js/test/test_imgproc.js index 9ba5cd4e38..e643388412 100644 --- a/modules/js/test/test_imgproc.js +++ b/modules/js/test/test_imgproc.js @@ -948,7 +948,7 @@ QUnit.test('test_filter', function(assert) { cv.rotate(src, dst, cv.ROTATE_90_CLOCKWISE); - size = dst.size(); + let size = dst.size(); assert.equal(size.height, 2, "ROTATE_HEIGHT"); assert.equal(size.width, 3, "ROTATE_WIGTH"); From 8d0dae4cec928c67145574d5865d9ac4eb346b55 Mon Sep 17 00:00:00 2001 From: Chen Jun Date: Wed, 27 Apr 2022 18:13:57 +0800 Subject: [PATCH 10/17] Fix KalmanFilter comment error If there will be measurement before the next predict, `statePost` would be assigned to updated value. So I guess these steps are meant to handle when no measurement and KF only do the predict step. ```cpp statePre.copyTo(statePost); errorCovPre.copyTo(errorCovPost); ``` --- modules/video/src/kalman.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/video/src/kalman.cpp b/modules/video/src/kalman.cpp index f90f9f7b9e..10e7ffbe02 100644 --- a/modules/video/src/kalman.cpp +++ b/modules/video/src/kalman.cpp @@ -96,7 +96,7 @@ const Mat& KalmanFilter::predict(const Mat& control) // P'(k) = temp1*At + Q gemm(temp1, transitionMatrix, 1, processNoiseCov, 1, errorCovPre, GEMM_2_T); - // handle the case when there will be measurement before the next predict. + // handle the case when there will be no measurement before the next predict. statePre.copyTo(statePost); errorCovPre.copyTo(errorCovPost); From a3f81b79ed5528494a8cf5a007e57290a9c900b8 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com> Date: Thu, 12 May 2022 11:52:23 +0300 Subject: [PATCH 11/17] Merge pull request #21917 from asenyaev:asen/self_hosted_runner_linux_3.4 Workflow to use a self-hosted Github runner on Linux x86_64 for 3.4 branch * Changed a workflow to use a self-hosted Github runner for 3.4 branch --- .github/workflows/PR-3.4-U20.yaml | 39 ++++++++++++++++--------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/PR-3.4-U20.yaml b/.github/workflows/PR-3.4-U20.yaml index 2446a07478..e400962379 100644 --- a/.github/workflows/PR-3.4-U20.yaml +++ b/.github/workflows/PR-3.4-U20.yaml @@ -6,24 +6,29 @@ on: - 3.4 env: - EXTRA_CMAKE_OPTIONS: '-DBUILD_DOCS=ON -DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON -DENABLE_CCACHE=OFF' - OPENCV_TEST_DATA_PATH: '/opencv_extra/testdata' - OPENCV_DOCKER_WORKDIR: '/__w/opencv/opencv' + EXTRA_CMAKE_OPTIONS: '-DBUILD_DOCS=ON -DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 -DOPENCV_DOWNLOAD_PATH=/home/ci/binaries_cache -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON' PR_AUTHOR: ${{ github.event.pull_request.user.login }} PR_AUTHOR_FORK: ${{ github.event.pull_request.head.repo.full_name }} SOURCE_BRANCH_NAME: ${{ github.head_ref }} TARGET_BRANCH_NAME: ${{ github.base_ref }} - ANT_HOME: '/usr/share/ant' + ANT_HOME: /usr/share/ant + GIT_CACHE_DOCKER: /home/ci/git_cache PYTHONPATH: /opencv-build/python_loader:$PYTHONPATH + OPENCV_TEST_DATA_PATH: /opencv_extra/testdata + OPENCV_DOCKER_WORKDIR: /opencv jobs: BuildAndTest: - runs-on: ubuntu-20.04 + runs-on: opencv-cn-lin-x86-64 defaults: run: shell: bash container: image: quay.io/asenyaev/opencv-ubuntu:20.04 + volumes: + - /home/opencv-cn/git_cache:/home/ci/git_cache + - /home/opencv-cn/ci_cache/opencv:/home/ci/.ccache + - /home/opencv-cn/binaries_cache:/home/ci/binaries_cache steps: - name: PR info run: | @@ -31,13 +36,9 @@ jobs: echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}" echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}" - name: Clean - run: find . -mindepth 1 -delete + run: find ${{ env.OPENCV_DOCKER_WORKDIR }} -mindepth 1 -delete - name: Fetch opencv - uses: actions/checkout@v3 - with: - repository: opencv/opencv - ref: ${{ env.TARGET_BRANCH_NAME }} - fetch-depth: 0 + run: git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE_DOCKER }}/opencv.git https://github.com/opencv/opencv.git ${{ env.OPENCV_DOCKER_WORKDIR }} - name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch run: | cd ${{ env.OPENCV_DOCKER_WORKDIR }} @@ -46,7 +47,7 @@ jobs: git config user.name "opencv.ci" git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" - name: Clone opencv_extra - run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} https://github.com/opencv/opencv_extra.git /opencv_extra + run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE_DOCKER }}/opencv_extra.git https://github.com/opencv/opencv_extra.git /opencv_extra - name: Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch run: | OPENCV_EXTRA_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true @@ -141,12 +142,16 @@ jobs: run: cd /opencv-build && cmake --build . --config release --target check_pylint -- -j4 BuildContrib: - runs-on: ubuntu-20.04 + runs-on: opencv-cn-lin-x86-64 defaults: run: shell: bash container: image: quay.io/asenyaev/opencv-ubuntu:20.04 + volumes: + - /home/opencv-cn/git_cache:/home/ci/git_cache + - /home/opencv-cn/ci_cache/opencv:/home/ci/.ccache + - /home/opencv-cn/binaries_cache:/home/ci/binaries_cache steps: - name: PR info run: | @@ -154,13 +159,9 @@ jobs: echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}" echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}" - name: Clean - run: find . -mindepth 1 -delete + run: find ${{ env.OPENCV_DOCKER_WORKDIR }} -mindepth 1 -delete - name: Fetch opencv - uses: actions/checkout@v3 - with: - repository: opencv/opencv - ref: ${{ env.TARGET_BRANCH_NAME }} - fetch-depth: 0 + run: git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE_DOCKER }}/opencv.git https://github.com/opencv/opencv.git ${{ env.OPENCV_DOCKER_WORKDIR }} - name: Merge opencv with a test branch run: | cd ${{ env.OPENCV_DOCKER_WORKDIR }} From 64e1d23cba84dd6770afeadbf78ba92f1a359eec Mon Sep 17 00:00:00 2001 From: Julian Szigethy <70467158+Julian-Sz@users.noreply.github.com> Date: Tue, 10 May 2022 18:11:27 +0200 Subject: [PATCH 12/17] Fix: Python and Java switched in Explanation --- .../hough_circle/hough_circle.markdown | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.markdown b/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.markdown index c4a9989e2b..497215794b 100644 --- a/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.markdown +++ b/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.markdown @@ -74,11 +74,11 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o @end_toggle @add_toggle_java -@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py load +@snippet samples/java/tutorial_code/ImgTrans/HoughCircle/HoughCircles.java load @end_toggle @add_toggle_python -@snippet samples/java/tutorial_code/ImgTrans/HoughCircle/HoughCircles.java load +@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py load @end_toggle #### Convert it to grayscale: @@ -88,11 +88,11 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o @end_toggle @add_toggle_java -@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py convert_to_gray +@snippet samples/java/tutorial_code/ImgTrans/HoughCircle/HoughCircles.java convert_to_gray @end_toggle @add_toggle_python -@snippet samples/java/tutorial_code/ImgTrans/HoughCircle/HoughCircles.java convert_to_gray +@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py convert_to_gray @end_toggle #### Apply a Median blur to reduce noise and avoid false circle detection: @@ -102,11 +102,11 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o @end_toggle @add_toggle_java -@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py reduce_noise +@snippet samples/java/tutorial_code/ImgTrans/HoughCircle/HoughCircles.java reduce_noise @end_toggle @add_toggle_python -@snippet samples/java/tutorial_code/ImgTrans/HoughCircle/HoughCircles.java reduce_noise +@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py reduce_noise @end_toggle #### Proceed to apply Hough Circle Transform: @@ -116,11 +116,11 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o @end_toggle @add_toggle_java -@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py houghcircles +@snippet samples/java/tutorial_code/ImgTrans/HoughCircle/HoughCircles.java houghcircles @end_toggle @add_toggle_python -@snippet samples/java/tutorial_code/ImgTrans/HoughCircle/HoughCircles.java houghcircles +@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py houghcircles @end_toggle - with the arguments: @@ -144,11 +144,11 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o @end_toggle @add_toggle_java -@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py draw +@snippet samples/java/tutorial_code/ImgTrans/HoughCircle/HoughCircles.java draw @end_toggle @add_toggle_python -@snippet samples/java/tutorial_code/ImgTrans/HoughCircle/HoughCircles.java draw +@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py draw @end_toggle You can see that we will draw the circle(s) on red and the center(s) with a small green dot @@ -160,11 +160,11 @@ You can see that we will draw the circle(s) on red and the center(s) with a smal @end_toggle @add_toggle_java -@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py display +@snippet samples/java/tutorial_code/ImgTrans/HoughCircle/HoughCircles.java display @end_toggle @add_toggle_python -@snippet samples/java/tutorial_code/ImgTrans/HoughCircle/HoughCircles.java display +@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py display @end_toggle Result From 2b5b192cd728f2d8719cb672591f13d64bfd9f10 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Fri, 13 May 2022 01:37:55 +0300 Subject: [PATCH 13/17] Moved from https to ssh for Windows in Github Actions --- .github/workflows/PR-3.4-W10.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/PR-3.4-W10.yaml b/.github/workflows/PR-3.4-W10.yaml index d965982f5a..ec9614ccd4 100644 --- a/.github/workflows/PR-3.4-W10.yaml +++ b/.github/workflows/PR-3.4-W10.yaml @@ -30,25 +30,25 @@ jobs: - name: Clean run: cd ${{ github.workspace }} && rm -rf * - name: Fetch opencv - run: cd ${{ github.workspace }} && git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv.git https://github.com/opencv/opencv.git + run: cd ${{ github.workspace }} && git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv.git git@github.com:opencv/opencv.git - name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch run: | cd ${{ github.workspace }}\opencv git config user.email "opencv.ci" git config user.name "opencv.ci" - git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" + git pull -v "git@github.com:${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" - name: Fetch opencv_extra - run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv_extra.git https://github.com/opencv/opencv_extra.git + run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv_extra.git git@github.com:opencv/opencv_extra.git - name: Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch shell: bash run: | - RET=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true + RET=$(git ls-remote --heads "git@github.com:${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true if [[ ! -z "$RET" ]]; then echo "Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch" cd opencv_extra git config user.email "opencv.ci" git config user.name "opencv.ci" - git pull -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}" + git pull -v "git@github.com:${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}" else echo "No merge since ${{ env.PR_AUTHOR }}/opencv_extra does not have branch ${{ env.SOURCE_BRANCH_NAME }}" fi @@ -145,15 +145,15 @@ jobs: - name: Clean run: cd ${{ github.workspace }} && rm -rf * - name: Fetch opencv - run: cd ${{ github.workspace }} && git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv.git https://github.com/opencv/opencv.git + run: cd ${{ github.workspace }} && git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv.git git@github.com:opencv/opencv.git - name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch run: | cd ${{ github.workspace }}\opencv git config user.email "opencv.ci" git config user.name "opencv.ci" - git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" + git pull -v "git@github.com:${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" - name: Fetch opencv_contrib - run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv_contrib.git --depth 1 https://github.com/opencv/opencv_contrib.git + run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv_contrib.git --depth 1 git@github.com:opencv/opencv_contrib.git - name: Configure OpenCV Contrib run: | mkdir ${{ github.workspace }}\opencv-contrib-build && cd ${{ github.workspace }}\opencv-contrib-build From 2238ac7d596fa94013eaeb5a1797753b141231ea Mon Sep 17 00:00:00 2001 From: xiongzhen Date: Fri, 13 May 2022 09:44:25 +0300 Subject: [PATCH 14/17] Apply TIFFTAG_PREDICTOR option for LZW, DEFLATE and ADOBE_DEFLATE compression cases for smaller files. --- modules/imgcodecs/src/grfmt_tiff.cpp | 2 +- modules/imgcodecs/test/test_tiff.cpp | 42 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/modules/imgcodecs/src/grfmt_tiff.cpp b/modules/imgcodecs/src/grfmt_tiff.cpp index d6f05f7a65..04df6ff8bb 100644 --- a/modules/imgcodecs/src/grfmt_tiff.cpp +++ b/modules/imgcodecs/src/grfmt_tiff.cpp @@ -901,7 +901,7 @@ bool TiffEncoder::writeLibTiff( const std::vector& img_vec, const std::vect CV_TIFF_CHECK_CALL(TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, depth >= CV_32F ? SAMPLEFORMAT_IEEEFP : SAMPLEFORMAT_UINT)); - if (page_compression != COMPRESSION_NONE) + if (page_compression == COMPRESSION_LZW || page_compression == COMPRESSION_ADOBE_DEFLATE || page_compression == COMPRESSION_DEFLATE) { CV_TIFF_CHECK_CALL(TIFFSetField(tif, TIFFTAG_PREDICTOR, predictor)); } diff --git a/modules/imgcodecs/test/test_tiff.cpp b/modules/imgcodecs/test/test_tiff.cpp index add15ff681..063bd9ae50 100644 --- a/modules/imgcodecs/test/test_tiff.cpp +++ b/modules/imgcodecs/test/test_tiff.cpp @@ -219,6 +219,48 @@ TEST(Imgcodecs_Tiff, readWrite_32FC3_RAW) EXPECT_EQ(0, remove(filenameOutput.c_str())); } +TEST(Imgcodecs_Tiff, readWrite_predictor) +{ + /* see issue #21871 + */ + const uchar sample_data[160] = { + 0xff, 0xff, 0xff, 0xff, 0x88, 0x88, 0xff, 0xff, 0x88, 0x88, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, + 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, + 0xff, 0x00, 0x00, 0x44, 0xff, 0xff, 0x88, 0xff, 0x33, 0x00, 0x66, 0xff, 0xff, 0x88, 0x00, 0x44, + 0x88, 0x00, 0x44, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x44, 0xff, 0xff, 0x11, 0x00, 0xff, + 0x11, 0x00, 0x88, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, + 0x11, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x33, 0x00, 0x88, 0xff, 0x00, 0x66, 0xff, + 0x11, 0x00, 0x66, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x44, 0x33, 0x00, 0xff, 0xff, + 0x88, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xff, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x66, 0xff, 0xff, + 0xff, 0xff, 0x88, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff + }; + + cv::Mat mat(10, 16, CV_8UC1, (void*)sample_data); + int methods[] = { + COMPRESSION_NONE, COMPRESSION_LZW, + COMPRESSION_PACKBITS, COMPRESSION_DEFLATE, COMPRESSION_ADOBE_DEFLATE + }; + for (size_t i = 0; i < sizeof(methods) / sizeof(int); i++) + { + string out = cv::tempfile(".tif"); + + std::vector params; + params.push_back(TIFFTAG_COMPRESSION); + params.push_back(methods[i]); + params.push_back(TIFFTAG_PREDICTOR); + params.push_back(PREDICTOR_HORIZONTAL); + + EXPECT_NO_THROW(cv::imwrite(out, mat, params)); + + const Mat img = cv::imread(out, IMREAD_UNCHANGED); + ASSERT_FALSE(img.empty()); + + ASSERT_EQ(0, cv::norm(mat, img, cv::NORM_INF)); + + EXPECT_EQ(0, remove(out.c_str())); + } +} //================================================================================================== From 2cc4309bf8399586399c683eb23d95156814d2d8 Mon Sep 17 00:00:00 2001 From: Yuantao Feng Date: Sat, 14 May 2022 01:27:01 +0800 Subject: [PATCH 15/17] Merge pull request #21924 from fengyuentau:workflow_arm64_3.4 Workflow to build and test on ARM64 for 3.4 branch * add ARM64 workflow for 3.4 * add opencv_contrib fork check * rename RET to OPENCV_EXTRA_FORK --- .github/workflows/PR-3.4-ARM64.yaml | 189 ++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 .github/workflows/PR-3.4-ARM64.yaml diff --git a/.github/workflows/PR-3.4-ARM64.yaml b/.github/workflows/PR-3.4-ARM64.yaml new file mode 100644 index 0000000000..affb2cb9ec --- /dev/null +++ b/.github/workflows/PR-3.4-ARM64.yaml @@ -0,0 +1,189 @@ +name: PR:3.4 ARM64 + +on: + pull_request: + branches: + - 3.4 + +env: + EXTRA_CMAKE_OPTIONS: '-DBUILD_DOCS=ON -DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 -DBUILD_opencv_xfeatures2d=OFF -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON -DENABLE_CCACHE=OFF' + OPENCV_TEST_DATA_PATH: '/opencv_extra/testdata' + OPENCV_DOCKER_WORKDIR: '/__w/opencv/opencv' + PR_AUTHOR: ${{ github.event.pull_request.user.login }} + PR_AUTHOR_FORK: ${{ github.event.pull_request.head.repo.full_name }} + SOURCE_BRANCH_NAME: ${{ github.head_ref }} + TARGET_BRANCH_NAME: ${{ github.base_ref }} + ANT_HOME: '/usr/share/ant' + PYTHONPATH: /opencv-build/python_loader:$PYTHONPATH + +jobs: + BuildAndTest: + runs-on: opencv-cn-lin-arm64 + defaults: + run: + shell: bash + container: + image: docker.io/yuentau/ocv_ubuntu:20.04-arm64 + steps: + - name: PR info + run: | + echo "PR Author: ${{ env.PR_AUTHOR }}" + echo "PR Author fork: ${{ env.PR_AUTHOR_FORK }}" + echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}" + echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}" + - name: Clean + run: find . -mindepth 1 -delete + - name: Fetch opencv + uses: actions/checkout@v3 + with: + repository: opencv/opencv + ref: ${{ env.TARGET_BRANCH_NAME }} + fetch-depth: 0 + - name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch + run: | + cd ${{ env.OPENCV_DOCKER_WORKDIR }} + git config --global --add safe.directory ${{ env.OPENCV_DOCKER_WORKDIR }} + git config user.email "opencv.ci" + git config user.name "opencv.ci" + git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" + - name: Clone opencv_extra + run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} https://github.com/opencv/opencv_extra.git /opencv_extra + - name: Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch + run: | + OPENCV_EXTRA_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true + if [[ ! -z "$OPENCV_EXTRA_FORK" ]]; then + echo "Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch" + cd /opencv_extra + git config user.email "opencv.ci" + git config user.name "opencv.ci" + git pull -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}" + else + echo "No merge since ${{ env.PR_AUTHOR }}/opencv_extra does not have branch ${{ env.SOURCE_BRANCH_NAME }}" + fi + - name: Configure OpenCV + run: | + cmake -G Ninja -B /opencv-build ${{ env.EXTRA_CMAKE_OPTIONS }} ${{ env.OPENCV_DOCKER_WORKDIR }} + - name: Build OpenCV + run: | + cd /opencv-build + ninja + - name: Accuracy:calib3d + run: cd /opencv-build && xvfb-run -a bin/opencv_test_calib3d + - name: Accuracy:core + run: cd /opencv-build && xvfb-run -a bin/opencv_test_core + - name: Accuracy:dnn + run: cd /opencv-build && xvfb-run -a bin/opencv_test_dnn + - name: Accuracy:features2d + run: cd /opencv-build && xvfb-run -a bin/opencv_test_features2d + - name: Accuracy:flann + run: cd /opencv-build && xvfb-run -a bin/opencv_test_flann + - name: Accuracy:highgui + run: cd /opencv-build && xvfb-run -a bin/opencv_test_highgui + - name: Accuracy:imgcodecs + run: cd /opencv-build && xvfb-run -a bin/opencv_test_imgcodecs + - name: Accuracy:imgproc + run: cd /opencv-build && xvfb-run -a bin/opencv_test_imgproc + - name: Accuracy:ml + run: cd /opencv-build && xvfb-run -a bin/opencv_test_ml + - name: Accuracy:objdetect + run: cd /opencv-build && xvfb-run -a bin/opencv_test_objdetect --gtest_filter="-Objdetect_QRCode_Close.regression/0:Objdetect_QRCode_Close.regression/4" + - name: Accuracy:photo + run: cd /opencv-build && xvfb-run -a bin/opencv_test_photo --gtest_filter="-Photo_CalibrateDebevec.regression" + - name: Accuracy:shape + run: cd /opencv-build && xvfb-run -a bin/opencv_test_shape + - name: Accuracy:stitching + run: cd /opencv-build && xvfb-run -a bin/opencv_test_stitching + - name: Accuracy:superres + run: cd /opencv-build && xvfb-run -a bin/opencv_test_superres + - name: Accuracy:video + run: cd /opencv-build && xvfb-run -a bin/opencv_test_video + - name: Accuracy:videoio + run: cd /opencv-build && xvfb-run -a bin/opencv_test_videoio + - name: Accuracy:videostab + run: cd /opencv-build && xvfb-run -a bin/opencv_test_videostab + - name: Performance:calib3d + run: cd /opencv-build && xvfb-run -a bin/opencv_perf_calib3d --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 + - name: Performance:core + run: cd /opencv-build && xvfb-run -a bin/opencv_perf_core --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 + - name: Performance:dnn + run: cd /opencv-build && xvfb-run -a bin/opencv_perf_dnn --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 + - name: Performance:features2d + run: cd /opencv-build && xvfb-run -a bin/opencv_perf_features2d --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 + - name: Performance:imgcodecs + run: cd /opencv-build && xvfb-run -a bin/opencv_perf_imgcodecs --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 + - name: Performance:imgproc + run: cd /opencv-build && xvfb-run -a bin/opencv_perf_imgproc --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 + - name: Performance:objdetect + run: cd /opencv-build && xvfb-run -a bin/opencv_perf_objdetect --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter="-Perf_Objdetect_QRCode.detect/2:Perf_Objdetect_QRCode_Multi.decodeMulti*:Perf_Objdetect_QRCode_Multi.detectMulti*" + - name: Performance:photo + run: cd /opencv-build && xvfb-run -a bin/opencv_perf_photo --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 + - name: Performance:stitching + run: cd /opencv-build && xvfb-run -a bin/opencv_perf_stitching --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 + - name: Performance:superres + run: cd /opencv-build && xvfb-run -a bin/opencv_perf_superres --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 + - name: Performance:video + run: cd /opencv-build && xvfb-run -a bin/opencv_perf_video --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 + - name: Performance:videoio + run: cd /opencv-build && xvfb-run -a bin/opencv_perf_videoio --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 + - name: Python3 + run: | + cd ${{ env.OPENCV_DOCKER_WORKDIR }}/modules/python/test + python3 ./test.py --repo ../../../ -v + - name: Java + run: cd /opencv-build && xvfb-run -a python3 ${{ env.OPENCV_DOCKER_WORKDIR }}/modules/ts/misc/run.py . -a -t java + - name: Save Unit Test Results + uses: actions/upload-artifact@v3 + if: always() + with: + name: junit-html + path: /opencv-build/java_test/testResults/junit-noframes.html + + BuildContrib: + runs-on: opencv-cn-lin-arm64 + defaults: + run: + shell: bash + container: + image: docker.io/yuentau/ocv_ubuntu:20.04-arm64 + steps: + - name: PR info + run: | + echo "PR Author: ${{ env.PR_AUTHOR }}" + echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}" + echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}" + - name: Clean + run: find . -mindepth 1 -delete + - name: Fetch opencv + uses: actions/checkout@v3 + with: + repository: opencv/opencv + ref: ${{ env.TARGET_BRANCH_NAME }} + fetch-depth: 0 + - name: Merge opencv with a test branch + run: | + cd ${{ env.OPENCV_DOCKER_WORKDIR }} + git config --global --add safe.directory ${{ env.OPENCV_DOCKER_WORKDIR }} + git config user.email "opencv.ci" + git config user.name "opencv.ci" + git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" + - name: Clone opencv_contrib + run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} https://github.com/opencv/opencv_contrib.git /opencv_contrib + - name: Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch + run: | + OPENCV_CONTRIB_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}") || true + if [[ ! -z "$OPENCV_CONTRIB_FORK" ]]; then + echo "Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch" + cd /opencv_contrib + git config user.email "opencv.ci" + git config user.name "opencv.ci" + git pull -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}" + else + echo "No merge since ${{ env.PR_AUTHOR }}/opencv_contrib does not have branch ${{ env.SOURCE_BRANCH_NAME }}" + fi + - name: Configure OpenCV Contrib + run: | + cmake -G Ninja -B /opencv-contrib-build ${{ env.EXTRA_CMAKE_OPTIONS }} -DOPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules ${{ env.OPENCV_DOCKER_WORKDIR }} + - name: Build OpenCV Contrib + run: | + cd /opencv-contrib-build + ninja From affcea8822b92967cb7c213f5f3cefb3171b286e Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Fri, 13 May 2022 15:38:51 +0300 Subject: [PATCH 16/17] Added opencv_contrib branch check on Windows --- .github/workflows/PR-3.4-W10.yaml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/PR-3.4-W10.yaml b/.github/workflows/PR-3.4-W10.yaml index ec9614ccd4..2cfed6a32e 100644 --- a/.github/workflows/PR-3.4-W10.yaml +++ b/.github/workflows/PR-3.4-W10.yaml @@ -42,8 +42,8 @@ jobs: - name: Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch shell: bash run: | - RET=$(git ls-remote --heads "git@github.com:${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true - if [[ ! -z "$RET" ]]; then + OPENCV_EXTRA_FORK=$(git ls-remote --heads "git@github.com:/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true + if [[ ! -z "$OPENCV_EXTRA_FORK" ]]; then echo "Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch" cd opencv_extra git config user.email "opencv.ci" @@ -154,6 +154,19 @@ jobs: git pull -v "git@github.com:${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" - name: Fetch opencv_contrib run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv_contrib.git --depth 1 git@github.com:opencv/opencv_contrib.git + - name: Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch + shell: bash + run: | + OPENCV_CONTRIB_FORK=$(git ls-remote --heads "git@github.com:${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}") || true + if [[ ! -z "$OPENCV_CONTRIB_FORK" ]]; then + echo "Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch" + cd /opencv_contrib + git config user.email "opencv.ci" + git config user.name "opencv.ci" + git pull -v "git@github.com:${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}" + else + echo "No merge since ${{ env.PR_AUTHOR }}/opencv_contrib does not have branch ${{ env.SOURCE_BRANCH_NAME }}" + fi - name: Configure OpenCV Contrib run: | mkdir ${{ github.workspace }}\opencv-contrib-build && cd ${{ github.workspace }}\opencv-contrib-build From 1099b4c881c458e302698a272f4f16dd46cac414 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Fri, 13 May 2022 18:14:45 +0300 Subject: [PATCH 17/17] Move environment variables on a host side (GHA Windows) --- .github/workflows/PR-3.4-W10.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/PR-3.4-W10.yaml b/.github/workflows/PR-3.4-W10.yaml index 2cfed6a32e..528cd596d9 100644 --- a/.github/workflows/PR-3.4-W10.yaml +++ b/.github/workflows/PR-3.4-W10.yaml @@ -6,14 +6,13 @@ on: - 3.4 env: - EXTRA_CMAKE_OPTIONS: '-DCL_Z_OPTION=/Z7 -DOPENCV_DOWNLOAD_PATH=c:\Slave\workspace\binaries_cache -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON -DCMAKE_BUILD_TYPE=Release' + EXTRA_CMAKE_OPTIONS: '-DCL_Z_OPTION=/Z7 -DOPENCV_DOWNLOAD_PATH=%BINARIES_CACHE% -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON -DCMAKE_BUILD_TYPE=Release' OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata PR_AUTHOR: ${{ github.event.pull_request.user.login }} PR_AUTHOR_FORK: ${{ github.event.pull_request.head.repo.full_name }} SOURCE_BRANCH_NAME: ${{ github.head_ref }} TARGET_BRANCH_NAME: ${{ github.base_ref }} GTEST_FILTER_STRING: '-Samples.findFile' - GIT_CACHE: c:\Slave\git_cache jobs: BuildAndTest: @@ -30,7 +29,7 @@ jobs: - name: Clean run: cd ${{ github.workspace }} && rm -rf * - name: Fetch opencv - run: cd ${{ github.workspace }} && git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv.git git@github.com:opencv/opencv.git + run: cd ${{ github.workspace }} && git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference %GIT_CACHE%\opencv.git git@github.com:opencv/opencv.git - name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch run: | cd ${{ github.workspace }}\opencv @@ -38,7 +37,7 @@ jobs: git config user.name "opencv.ci" git pull -v "git@github.com:${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" - name: Fetch opencv_extra - run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv_extra.git git@github.com:opencv/opencv_extra.git + run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference %GIT_CACHE%\opencv_extra.git git@github.com:opencv/opencv_extra.git - name: Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch shell: bash run: | @@ -145,7 +144,7 @@ jobs: - name: Clean run: cd ${{ github.workspace }} && rm -rf * - name: Fetch opencv - run: cd ${{ github.workspace }} && git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv.git git@github.com:opencv/opencv.git + run: cd ${{ github.workspace }} && git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference %GIT_CACHE%\opencv.git git@github.com:opencv/opencv.git - name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch run: | cd ${{ github.workspace }}\opencv @@ -153,7 +152,7 @@ jobs: git config user.name "opencv.ci" git pull -v "git@github.com:${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" - name: Fetch opencv_contrib - run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv_contrib.git --depth 1 git@github.com:opencv/opencv_contrib.git + run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference %GIT_CACHE%\opencv_contrib.git --depth 1 git@github.com:opencv/opencv_contrib.git - name: Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch shell: bash run: |