Commit 7e2ebecd authored by Alexander Alekhin's avatar Alexander Alekhin

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

parents 581d0ef8 054bd23a
......@@ -109,6 +109,7 @@ bool isResizeLinearOpenCVSupported(const Size2D &ssize, const Size2D &dsize, u32
&& dsize.width >= 2 && dsize.height >= 8
&& (2*dsize.width != ssize.width || 2*dsize.height != ssize.height)) // 2x downscaling is performed as area in OpenCV which differs from this implementation
return isSupportedConfiguration();
return false;
default:
return false;
};
......
......@@ -47,7 +47,6 @@
#include "saturate_cast.hpp"
#include "vec_traits.hpp"
#include "type_traits.hpp"
#include "device_functions.h"
/** @file
* @deprecated Use @ref cudev instead.
......
......@@ -585,7 +585,7 @@ __CV_ENUM_FLAGS_BITWISE_XOR_EQ (EnumType, EnumType)
#ifdef CV_XADD
// allow to use user-defined macro
#elif defined __GNUC__ || defined __clang__
# if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ && !defined __EMSCRIPTEN__ && !defined(__CUDACC__)
# if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ && !defined __EMSCRIPTEN__ && !defined(__CUDACC__) && !defined __INTEL_COMPILER
# ifdef __ATOMIC_ACQ_REL
# define CV_XADD(addr, delta) __c11_atomic_fetch_add((_Atomic(int)*)(addr), delta, __ATOMIC_ACQ_REL)
# else
......
......@@ -33,7 +33,7 @@ public class RotatedRect {
angle = vals.length > 4 ? (double) vals[4] : 0;
} else {
center.x = 0;
center.x = 0;
center.y = 0;
size.width = 0;
size.height = 0;
angle = 0;
......
......@@ -60,7 +60,7 @@ namespace
#ifdef WINRT
WIN32_FIND_DATAW data;
#else
WIN32_FIND_DATA data;
WIN32_FIND_DATAA data;
#endif
HANDLE handle;
dirent ent;
......
......@@ -307,7 +307,7 @@ void cv::merge(const Mat* mv, size_t n, OutputArray _dst)
return;
}
CV_IPP_RUN_FAST(ipp_merge(mv, dst, (int)n));
CV_IPP_RUN(allch1, ipp_merge(mv, dst, (int)n));
if( !allch1 )
{
......
......@@ -1878,6 +1878,29 @@ TEST(Core_Split, crash_12171)
EXPECT_EQ(2, dst2.ptr<uchar>(1)[1]);
}
TEST(Core_Merge, bug_13544)
{
Mat src1(2, 2, CV_8UC3, Scalar::all(1));
Mat src2(2, 2, CV_8UC3, Scalar::all(2));
Mat src3(2, 2, CV_8UC3, Scalar::all(3));
Mat src_arr[] = { src1, src2, src3 };
Mat dst;
merge(src_arr, 3, dst);
ASSERT_EQ(9, dst.channels()); // Avoid memory access out of buffer
EXPECT_EQ(3, (int)dst.ptr<uchar>(0)[6]);
EXPECT_EQ(3, (int)dst.ptr<uchar>(0)[7]);
EXPECT_EQ(3, (int)dst.ptr<uchar>(0)[8]);
EXPECT_EQ(1, (int)dst.ptr<uchar>(1)[0]);
EXPECT_EQ(1, (int)dst.ptr<uchar>(1)[1]);
EXPECT_EQ(1, (int)dst.ptr<uchar>(1)[2]);
EXPECT_EQ(2, (int)dst.ptr<uchar>(1)[3]);
EXPECT_EQ(2, (int)dst.ptr<uchar>(1)[4]);
EXPECT_EQ(2, (int)dst.ptr<uchar>(1)[5]);
EXPECT_EQ(3, (int)dst.ptr<uchar>(1)[6]);
EXPECT_EQ(3, (int)dst.ptr<uchar>(1)[7]);
EXPECT_EQ(3, (int)dst.ptr<uchar>(1)[8]);
}
struct CustomType // like cv::Keypoint
{
Point2f pt;
......
......@@ -262,6 +262,9 @@ public:
}
int ngroups = inpCn / blobs[0].size[1];
if (ngroups == 0 || ngroups * blobs[0].size[1] != inpCn)
CV_Error(Error::StsError, format("Number of input channels should "
"be multiple of %d but got %d", blobs[0].size[1], inpCn));
CV_Assert(ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0);
int dims[] = {inputs[0][0], outCn, out.height, out.width};
......
......@@ -4201,7 +4201,14 @@ enum ColormapTypes
COLORMAP_HSV = 9, //!< ![HSV](pics/colormaps/colorscale_hsv.jpg)
COLORMAP_PINK = 10, //!< ![pink](pics/colormaps/colorscale_pink.jpg)
COLORMAP_HOT = 11, //!< ![hot](pics/colormaps/colorscale_hot.jpg)
COLORMAP_PARULA = 12 //!< ![parula](pics/colormaps/colorscale_parula.jpg)
COLORMAP_PARULA = 12, //!< ![parula](pics/colormaps/colorscale_parula.jpg)
COLORMAP_MAGMA = 13, //!< ![magma](pics/colormaps/colorscale_magma.jpg)
COLORMAP_INFERNO = 14, //!< ![inferno](pics/colormaps/colorscale_inferno.jpg)
COLORMAP_PLASMA = 15, //!< ![plasma](pics/colormaps/colorscale_plasma.jpg)
COLORMAP_VIRIDIS = 16, //!< ![viridis](pics/colormaps/colorscale_viridis.jpg)
COLORMAP_CIVIDIS = 17, //!< ![cividis](pics/colormaps/colorscale_cividis.jpg)
COLORMAP_TWILIGHT = 18, //!< ![twilight](pics/colormaps/colorscale_twilight.jpg)
COLORMAP_TWILIGHT_SHIFTED = 19 //!< ![twilight shifted](pics/colormaps/colorscale_twilight_shifted.jpg)
};
/** @example samples/cpp/falsecolor.cpp
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -27,8 +27,8 @@ class CropLayer(object):
batchSize, numChannels = inputShape[0], inputShape[1]
height, width = targetShape[2], targetShape[3]
self.ystart = (inputShape[2] - targetShape[2]) / 2
self.xstart = (inputShape[3] - targetShape[3]) / 2
self.ystart = (inputShape[2] - targetShape[2]) // 2
self.xstart = (inputShape[3] - targetShape[3]) // 2
self.yend = self.ystart + height
self.xend = self.xstart + width
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment