mirror of
https://github.com/opencv/opencv.git
synced 2025-06-06 00:43:52 +08:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
commit
0a6f216f83
2
3rdparty/carotene/src/resize.cpp
vendored
2
3rdparty/carotene/src/resize.cpp
vendored
@ -758,7 +758,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
|
||||
}
|
||||
else if (channels == 3)
|
||||
{
|
||||
if ((wr == 2.0f) && (wr == 2.0f))
|
||||
if ((wr == 2.0f) && (hr == 2.0f))
|
||||
{
|
||||
#ifndef __ANDROID__
|
||||
size_t roiw16 = dsize.width >= 15 ? (dsize.width - 15) * 3 : 0;
|
||||
|
@ -7,9 +7,17 @@ if(BUILD_ZLIB)
|
||||
ocv_clear_vars(ZLIB_FOUND)
|
||||
else()
|
||||
ocv_clear_internal_cache_vars(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
|
||||
if(ANDROID)
|
||||
set(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .so)
|
||||
endif()
|
||||
find_package(ZLIB "${MIN_VER_ZLIB}")
|
||||
if(ANDROID)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
if(ZLIB_FOUND AND ANDROID)
|
||||
if(ZLIB_LIBRARIES MATCHES "/usr/(lib|lib32|lib64)/libz.so$")
|
||||
if(ZLIB_LIBRARIES MATCHES "/usr/lib.*/libz.so$")
|
||||
set(ZLIB_LIBRARIES z)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -564,7 +564,11 @@ macro(ocv_check_flag_support lang flag varname base_options)
|
||||
elseif("_${lang}_" MATCHES "_C_")
|
||||
set(_lang C)
|
||||
elseif("_${lang}_" MATCHES "_OBJCXX_")
|
||||
set(_lang OBJCXX)
|
||||
if(DEFINED CMAKE_OBJCXX_COMPILER) # CMake 3.16+ and enable_language(OBJCXX) call are required
|
||||
set(_lang OBJCXX)
|
||||
else()
|
||||
set(_lang CXX)
|
||||
endif()
|
||||
else()
|
||||
set(_lang ${lang})
|
||||
endif()
|
||||
|
@ -22,10 +22,10 @@ Installing OpenCV-Python from Pre-built Binaries
|
||||
|
||||
This method serves best when using just for programming and developing OpenCV applications.
|
||||
|
||||
Install package [python-opencv](https://packages.ubuntu.com/trusty/python-opencv) with following command in terminal (as root user).
|
||||
Install package [python3-opencv](https://packages.ubuntu.com/focal/python3-opencv) with following command in terminal (as root user).
|
||||
|
||||
```
|
||||
$ sudo apt-get install python-opencv
|
||||
$ sudo apt-get install python3-opencv
|
||||
```
|
||||
|
||||
Open Python IDLE (or IPython) and type following codes in Python terminal.
|
||||
|
@ -170,7 +170,7 @@ Our program exits if the user presses **ESC**. Besides, it has two options:
|
||||
We use the function **pyrDown()** with three arguments (similarly to **pyrUp()**):
|
||||
- *src*: The current and destination image (to be shown on screen, supposedly half the input
|
||||
image)
|
||||
- *Size( tmp.cols/2, tmp.rows/2 )* : The destination size. Since we are upsampling,
|
||||
- *Size( tmp.cols/2, tmp.rows/2 )* : The destination size. Since we are downsampling,
|
||||
**pyrDown()** expects half the size the input image (in this case *src*).
|
||||
|
||||
@add_toggle_cpp
|
||||
|
@ -2266,7 +2266,7 @@ bool findCirclesGrid( InputArray _image, Size patternSize,
|
||||
}
|
||||
}
|
||||
|
||||
if (!H.empty()) // undone rectification
|
||||
if (!centers.empty() && !H.empty()) // undone rectification
|
||||
{
|
||||
Mat orgPointsMat;
|
||||
transform(centers, orgPointsMat, H.inv());
|
||||
|
@ -710,5 +710,45 @@ TEST(Calib3d_AsymmetricCirclesPatternDetector, regression_18713)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Calib3d_AsymmetricCirclesPatternDetector, regression_19498)
|
||||
{
|
||||
float pts_[121][2] = {
|
||||
{ 84.7462f, 404.504f }, { 49.1586f, 404.092f }, { 12.3362f, 403.434f }, { 102.542f, 386.214f }, { 67.6042f, 385.475f },
|
||||
{ 31.4982f, 384.569f }, { 141.231f, 377.856f }, { 332.834f, 370.745f }, { 85.7663f, 367.261f }, { 50.346f, 366.051f },
|
||||
{ 13.7726f, 364.663f }, { 371.746f, 362.011f }, { 68.8543f, 347.883f }, { 32.9334f, 346.263f }, { 331.926f, 343.291f },
|
||||
{ 351.535f, 338.112f }, { 51.7951f, 328.247f }, { 15.4613f, 326.095f }, { 311.719f, 319.578f }, { 330.947f, 313.708f },
|
||||
{ 256.706f, 307.584f }, { 34.6834f, 308.167f }, { 291.085f, 295.429f }, { 17.4316f, 287.824f }, { 252.928f, 277.92f },
|
||||
{ 270.19f, 270.93f }, { 288.473f, 263.484f }, { 216.401f, 260.94f }, { 232.195f, 253.656f }, { 266.757f, 237.708f },
|
||||
{ 211.323f, 229.005f }, { 227.592f, 220.498f }, { 154.749f, 188.52f }, { 222.52f, 184.906f }, { 133.85f, 163.968f },
|
||||
{ 200.024f, 158.05f }, { 147.485f, 153.643f }, { 161.967f, 142.633f }, { 177.396f, 131.059f }, { 125.909f, 128.116f },
|
||||
{ 139.817f, 116.333f }, { 91.8639f, 114.454f }, { 104.343f, 102.542f }, { 117.635f, 89.9116f }, { 70.9465f, 89.4619f },
|
||||
{ 82.8524f, 76.7862f }, { 131.738f, 76.4741f }, { 95.5012f, 63.3351f }, { 109.034f, 49.0424f }, { 314.886f, 374.711f },
|
||||
{ 351.735f, 366.489f }, { 279.113f, 357.05f }, { 313.371f, 348.131f }, { 260.123f, 335.271f }, { 276.346f, 330.325f },
|
||||
{ 293.588f, 325.133f }, { 240.86f, 313.143f }, { 273.436f, 301.667f }, { 206.762f, 296.574f }, { 309.877f, 288.796f },
|
||||
{ 187.46f, 274.319f }, { 201.521f, 267.804f }, { 248.973f, 245.918f }, { 181.644f, 244.655f }, { 196.025f, 237.045f },
|
||||
{ 148.41f, 229.131f }, { 161.604f, 221.215f }, { 175.455f, 212.873f }, { 244.748f, 211.459f }, { 128.661f, 206.109f },
|
||||
{ 190.217f, 204.108f }, { 141.346f, 197.568f }, { 205.876f, 194.781f }, { 168.937f, 178.948f }, { 121.006f, 173.714f },
|
||||
{ 183.998f, 168.806f }, { 88.9095f, 159.731f }, { 100.559f, 149.867f }, { 58.553f, 146.47f }, { 112.849f, 139.302f },
|
||||
{ 80.0968f, 125.74f }, { 39.24f, 123.671f }, { 154.582f, 103.85f }, { 59.7699f, 101.49f }, { 266.334f, 385.387f },
|
||||
{ 234.053f, 368.718f }, { 263.347f, 361.184f }, { 244.763f, 339.958f }, { 198.16f, 328.214f }, { 211.675f, 323.407f },
|
||||
{ 225.905f, 318.426f }, { 192.98f, 302.119f }, { 221.267f, 290.693f }, { 161.437f, 286.46f }, { 236.656f, 284.476f },
|
||||
{ 168.023f, 251.799f }, { 105.385f, 221.988f }, { 116.724f, 214.25f }, { 97.2959f, 191.81f }, { 108.89f, 183.05f },
|
||||
{ 77.9896f, 169.242f }, { 48.6763f, 156.088f }, { 68.9635f, 136.415f }, { 29.8484f, 133.886f }, { 49.1966f, 112.826f },
|
||||
{ 113.059f, 29.003f }, { 251.698f, 388.562f }, { 281.689f, 381.929f }, { 297.875f, 378.518f }, { 248.376f, 365.025f },
|
||||
{ 295.791f, 352.763f }, { 216.176f, 348.586f }, { 230.143f, 344.443f }, { 179.89f, 307.457f }, { 174.083f, 280.51f },
|
||||
{ 142.867f, 265.085f }, { 155.127f, 258.692f }, { 124.187f, 243.661f }, { 136.01f, 236.553f }, { 86.4651f, 200.13f },
|
||||
{ 67.5711f, 178.221f }
|
||||
};
|
||||
|
||||
Mat candidates(121, 1, CV_32FC2, (void*)pts_);
|
||||
Size patternSize(13, 8);
|
||||
|
||||
std::vector< Point2f > result;
|
||||
bool res = false;
|
||||
|
||||
EXPECT_NO_THROW(res = findCirclesGrid(candidates, patternSize, result, CALIB_CB_SYMMETRIC_GRID, Ptr<FeatureDetector>()/*blobDetector=NULL*/));
|
||||
EXPECT_FALSE(res);
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
/* End of file. */
|
||||
|
@ -50,7 +50,6 @@
|
||||
#endif
|
||||
|
||||
#include "opencv2/core/cvdef.h"
|
||||
#include "opencv2/core/version.hpp"
|
||||
#include "opencv2/core/base.hpp"
|
||||
#include "opencv2/core/cvstd.hpp"
|
||||
#include "opencv2/core/traits.hpp"
|
||||
|
@ -45,6 +45,8 @@
|
||||
#ifndef OPENCV_CORE_CVDEF_H
|
||||
#define OPENCV_CORE_CVDEF_H
|
||||
|
||||
#include "opencv2/core/version.hpp"
|
||||
|
||||
//! @addtogroup core_utils
|
||||
//! @{
|
||||
|
||||
|
@ -40,7 +40,6 @@ Notes:
|
||||
#endif
|
||||
|
||||
#include "opencv2/core/cvdef.h"
|
||||
#include "opencv2/core/version.hpp"
|
||||
|
||||
#ifdef OPENCV_SIMD_CONFIG_HEADER
|
||||
#include CVAUX_STR(OPENCV_SIMD_CONFIG_HEADER)
|
||||
|
@ -42,6 +42,7 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "hal_internal.hpp"
|
||||
|
||||
#ifdef HAVE_LAPACK
|
||||
|
@ -45,8 +45,6 @@
|
||||
#ifndef OPENCV_CORE_HAL_INTERNAL_HPP
|
||||
#define OPENCV_CORE_HAL_INTERNAL_HPP
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_LAPACK
|
||||
|
||||
int lapack_LU32f(float* a, size_t a_step, int m, float* b, size_t b_step, int n, int* info);
|
||||
|
@ -25,7 +25,6 @@
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
#include <sstream>
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
#include "opencv2/core/opencl/runtime/opencl_clamdblas.hpp"
|
||||
#include "opencv2/core/opencl/runtime/opencl_core.hpp"
|
||||
|
@ -1,6 +1,10 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencv2/core/mat.hpp"
|
||||
#include "opencv2/core/types_c.h"
|
||||
#include "precomp.hpp"
|
||||
|
||||
// glue
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
|
||||
|
||||
#include "opencv2/core/mat.hpp"
|
||||
#include "precomp.hpp"
|
||||
#include "opencv2/core/mat.hpp"
|
||||
|
||||
namespace cv {
|
||||
|
||||
|
@ -2,11 +2,10 @@
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencv2/core/mat.hpp"
|
||||
#include "opencv2/core/types_c.h"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
#include "precomp.hpp"
|
||||
|
||||
#undef HAVE_IPP
|
||||
#undef CV_IPP_RUN_FAST
|
||||
|
@ -2,10 +2,9 @@
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencv2/core/mat.hpp"
|
||||
#include "opencv2/core/types_c.h"
|
||||
#include "precomp.hpp"
|
||||
|
||||
namespace cv {
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
|
||||
|
||||
#include "opencv2/core/mat.hpp"
|
||||
#include "precomp.hpp"
|
||||
#include "opencv2/core/mat.hpp"
|
||||
|
||||
namespace cv {
|
||||
|
||||
|
@ -241,6 +241,10 @@ namespace cv {
|
||||
{
|
||||
activation_param.type = "Sigmoid";
|
||||
}
|
||||
else if (type == "tanh")
|
||||
{
|
||||
activation_param.type = "TanH";
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_Error(cv::Error::StsParseError, "Unsupported activation: " + type);
|
||||
|
@ -54,11 +54,11 @@ public:
|
||||
for (int i = 0; i < ratios.size(); ++i)
|
||||
{
|
||||
float ratio = ratios.get<float>(i);
|
||||
float width = std::floor(baseSize / sqrt(ratio) + 0.5f);
|
||||
float height = std::floor(width * ratio + 0.5f);
|
||||
for (int j = 0; j < scales.size(); ++j)
|
||||
{
|
||||
float scale = scales.get<float>(j);
|
||||
float width = std::floor(baseSize / sqrt(ratio) + 0.5f);
|
||||
float height = std::floor(width * ratio + 0.5f);
|
||||
widths.push_back(scale * width);
|
||||
heights.push_back(scale * height);
|
||||
}
|
||||
|
@ -735,6 +735,11 @@ TEST_P(Test_Darknet_layers, mish)
|
||||
testDarknetLayer("mish", true);
|
||||
}
|
||||
|
||||
TEST_P(Test_Darknet_layers, tanh)
|
||||
{
|
||||
testDarknetLayer("tanh");
|
||||
}
|
||||
|
||||
TEST_P(Test_Darknet_layers, avgpool_softmax)
|
||||
{
|
||||
testDarknetLayer("avgpool_softmax");
|
||||
|
@ -148,7 +148,7 @@ ocv_create_module(${HIGHGUI_LIBRARIES})
|
||||
|
||||
macro(ocv_highgui_configure_target)
|
||||
if(APPLE)
|
||||
add_apple_compiler_options(the_module)
|
||||
add_apple_compiler_options(${the_module})
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
|
@ -149,7 +149,7 @@ ocv_create_module(${GRFMT_LIBS} ${IMGCODECS_LIBRARIES})
|
||||
|
||||
macro(ocv_imgcodecs_configure_target)
|
||||
if(APPLE)
|
||||
add_apple_compiler_options(the_module)
|
||||
add_apple_compiler_options(${the_module})
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
@ -167,4 +167,8 @@ ocv_add_accuracy_tests()
|
||||
if(TARGET opencv_test_imgcodecs AND HAVE_JASPER AND "$ENV{OPENCV_IO_ENABLE_JASPER}")
|
||||
ocv_target_compile_definitions(opencv_test_imgcodecs PRIVATE OPENCV_IMGCODECS_ENABLE_JASPER_TESTS=1)
|
||||
endif()
|
||||
if(TARGET opencv_test_imgcodecs AND HAVE_PNG AND NOT (PNG_VERSION VERSION_LESS "1.6.31"))
|
||||
# details: https://github.com/glennrp/libpng/commit/68cb0aaee3de6371b81a4613476d9b33e43e95b1
|
||||
ocv_target_compile_definitions(opencv_test_imgcodecs PRIVATE OPENCV_IMGCODECS_PNG_WITH_EXIF=1)
|
||||
endif()
|
||||
ocv_add_perf_tests()
|
||||
|
@ -7,12 +7,6 @@ namespace opencv_test { namespace {
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
|
||||
#ifdef HAVE_LIBPNG_PNG_H
|
||||
#include <libpng/png.h>
|
||||
#else
|
||||
#include <png.h>
|
||||
#endif
|
||||
|
||||
TEST(Imgcodecs_Png, write_big)
|
||||
{
|
||||
const string root = cvtest::TS::ptr()->get_data_path();
|
||||
@ -99,7 +93,6 @@ TEST(Imgcodecs_Png, read_color_palette_with_alpha)
|
||||
EXPECT_EQ(img.at<Vec3b>(0, 1), Vec3b(0, 0, 255));
|
||||
}
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
/**
|
||||
* Test for check whether reading exif orientation tag was processed successfully or not
|
||||
* The test info is the set of 8 images named testExifRotate_{1 to 8}.png
|
||||
@ -144,7 +137,11 @@ TEST(Imgcodecs_Png, read_color_palette_with_alpha)
|
||||
typedef testing::TestWithParam<string> Imgcodecs_PNG_Exif;
|
||||
|
||||
// Solution to issue 16579: PNG read doesn't support Exif orientation data
|
||||
#ifdef OPENCV_IMGCODECS_PNG_WITH_EXIF
|
||||
TEST_P(Imgcodecs_PNG_Exif, exif_orientation)
|
||||
#else
|
||||
TEST_P(Imgcodecs_PNG_Exif, DISABLED_exif_orientation)
|
||||
#endif
|
||||
{
|
||||
const string root = cvtest::TS::ptr()->get_data_path();
|
||||
const string filename = root + GetParam();
|
||||
@ -188,7 +185,6 @@ const string exif_files[] =
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ExifFiles, Imgcodecs_PNG_Exif,
|
||||
testing::ValuesIn(exif_files));
|
||||
#endif // PNG_eXIf_SUPPORTED
|
||||
|
||||
#endif // HAVE_PNG
|
||||
|
||||
|
@ -865,6 +865,8 @@ namespace
|
||||
OutputArray status,
|
||||
OutputArray err = cv::noArray()) CV_OVERRIDE;
|
||||
|
||||
virtual String getDefaultName() const CV_OVERRIDE { return "SparseOpticalFlow.SparsePyrLKOpticalFlow"; }
|
||||
|
||||
private:
|
||||
#ifdef HAVE_OPENCL
|
||||
bool checkParam()
|
||||
@ -934,7 +936,8 @@ namespace
|
||||
{
|
||||
if (!lkSparse_run(prevPyr[level], nextPyr[level], prevPts,
|
||||
nextPts, status, err,
|
||||
prevPts.cols, level))
|
||||
static_cast<int>(prevPts.total()),
|
||||
level))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -618,6 +618,8 @@ public:
|
||||
|
||||
virtual void calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE;
|
||||
|
||||
virtual String getDefaultName() const CV_OVERRIDE { return "DenseOpticalFlow.FarnebackOpticalFlow"; }
|
||||
|
||||
private:
|
||||
int numLevels_;
|
||||
double pyrScale_;
|
||||
|
@ -444,7 +444,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
// -----------------------Show the undistorted image for the image list ------------------------
|
||||
//! [show_results]
|
||||
if( s.inputType == Settings::IMAGE_LIST && s.showUndistorsed )
|
||||
if( s.inputType == Settings::IMAGE_LIST && s.showUndistorsed && !cameraMatrix.empty())
|
||||
{
|
||||
Mat view, rview, map1, map2;
|
||||
|
||||
|
@ -270,7 +270,11 @@ def removeIdentity(graph_def):
|
||||
identities = {}
|
||||
for node in graph_def.node:
|
||||
if node.op == 'Identity' or node.op == 'IdentityN':
|
||||
identities[node.name] = node.input[0]
|
||||
inp = node.input[0]
|
||||
if inp in identities:
|
||||
identities[node.name] = identities[inp]
|
||||
else:
|
||||
identities[node.name] = inp
|
||||
graph_def.node.remove(node)
|
||||
|
||||
for node in graph_def.node:
|
||||
|
Loading…
Reference in New Issue
Block a user