mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 01:13:28 +08:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
commit
6a2077cbd8
@ -1941,7 +1941,7 @@ void cvCalibrationMatrixValues( const CvMat *calibMatr, CvSize imgSize,
|
||||
CV_Error(CV_StsNullPtr, "Some of parameters is a NULL pointer!");
|
||||
|
||||
if(!CV_IS_MAT(calibMatr))
|
||||
CV_Error(CV_StsUnsupportedFormat, "Input parameters must be a matrices!");
|
||||
CV_Error(CV_StsUnsupportedFormat, "Input parameters must be matrices!");
|
||||
|
||||
double dummy = .0;
|
||||
Point2d pp;
|
||||
@ -3289,7 +3289,7 @@ cvDecomposeProjectionMatrix( const CvMat *projMatr, CvMat *calibMatr,
|
||||
CV_Error(CV_StsNullPtr, "Some of parameters is a NULL pointer!");
|
||||
|
||||
if(!CV_IS_MAT(projMatr) || !CV_IS_MAT(calibMatr) || !CV_IS_MAT(rotMatr) || !CV_IS_MAT(posVect))
|
||||
CV_Error(CV_StsUnsupportedFormat, "Input parameters must be a matrices!");
|
||||
CV_Error(CV_StsUnsupportedFormat, "Input parameters must be matrices!");
|
||||
|
||||
if(projMatr->cols != 4 || projMatr->rows != 3)
|
||||
CV_Error(CV_StsUnmatchedSizes, "Size of projection matrix must be 3x4!");
|
||||
|
@ -2379,7 +2379,7 @@ inline void v_load_deinterleave( const unsigned* ptr, v_uint32x8& a, v_uint32x8&
|
||||
__m256i ab0 = _mm256_loadu_si256((const __m256i*)ptr);
|
||||
__m256i ab1 = _mm256_loadu_si256((const __m256i*)(ptr + 8));
|
||||
|
||||
const int sh = 0+2*4+1*16+3*64;
|
||||
enum { sh = 0+2*4+1*16+3*64 };
|
||||
__m256i p0 = _mm256_shuffle_epi32(ab0, sh);
|
||||
__m256i p1 = _mm256_shuffle_epi32(ab1, sh);
|
||||
__m256i pl = _mm256_permute2x128_si256(p0, p1, 0 + 2*16);
|
||||
|
@ -244,7 +244,13 @@ struct v_uint64x2
|
||||
explicit v_uint64x2(__m128i v) : val(v) {}
|
||||
v_uint64x2(uint64 v0, uint64 v1)
|
||||
{
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1920/*MSVS 2019*/ && defined(_M_X64)
|
||||
val = _mm_setr_epi64x((int64_t)v0, (int64_t)v1);
|
||||
#elif defined(__GNUC__)
|
||||
val = _mm_setr_epi64((__m64)v0, (__m64)v1);
|
||||
#else
|
||||
val = _mm_setr_epi32((int)v0, (int)(v0 >> 32), (int)v1, (int)(v1 >> 32));
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64 get0() const
|
||||
@ -272,7 +278,13 @@ struct v_int64x2
|
||||
explicit v_int64x2(__m128i v) : val(v) {}
|
||||
v_int64x2(int64 v0, int64 v1)
|
||||
{
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1920/*MSVS 2019*/ && defined(_M_X64)
|
||||
val = _mm_setr_epi64x((int64_t)v0, (int64_t)v1);
|
||||
#elif defined(__GNUC__)
|
||||
val = _mm_setr_epi64((__m64)v0, (__m64)v1);
|
||||
#else
|
||||
val = _mm_setr_epi32((int)v0, (int)(v0 >> 32), (int)v1, (int)(v1 >> 32));
|
||||
#endif
|
||||
}
|
||||
|
||||
int64 get0() const
|
||||
|
@ -131,7 +131,7 @@ void* allocSingletonNewBuffer(size_t size) { return malloc(size); }
|
||||
#if defined __ANDROID__ || defined __unix__ || defined __FreeBSD__ || defined __OpenBSD__ || defined __HAIKU__ || defined __Fuchsia__
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
#if defined __QNXNTO__
|
||||
#if defined __QNX__
|
||||
# include <sys/elf.h>
|
||||
#else
|
||||
# include <elf.h>
|
||||
@ -551,7 +551,7 @@ struct HWFeatures
|
||||
}
|
||||
#endif // CV_CPUID_X86
|
||||
|
||||
#if defined __ANDROID__ || defined __linux__ || defined __FreeBSD__
|
||||
#if defined __ANDROID__ || defined __linux__ || defined __FreeBSD__ || defined __QNX__
|
||||
#ifdef __aarch64__
|
||||
have[CV_CPU_NEON] = true;
|
||||
have[CV_CPU_FP16] = true;
|
||||
|
@ -373,6 +373,23 @@ template<typename R> struct TheTest
|
||||
EXPECT_EQ((LaneType)12, vx_setall_res2_[i]);
|
||||
}
|
||||
|
||||
#if CV_SIMD_WIDTH == 16
|
||||
{
|
||||
uint64 a = CV_BIG_INT(0x7fffffffffffffff);
|
||||
uint64 b = (uint64)CV_BIG_INT(0xcfffffffffffffff);
|
||||
v_uint64x2 uint64_vec(a, b);
|
||||
EXPECT_EQ(a, uint64_vec.get0());
|
||||
EXPECT_EQ(b, v_extract_n<1>(uint64_vec));
|
||||
}
|
||||
{
|
||||
int64 a = CV_BIG_INT(0x7fffffffffffffff);
|
||||
int64 b = CV_BIG_INT(-1);
|
||||
v_int64x2 int64_vec(a, b);
|
||||
EXPECT_EQ(a, int64_vec.get0());
|
||||
EXPECT_EQ(b, v_extract_n<1>(int64_vec));
|
||||
}
|
||||
#endif
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ bool BmpDecoder::readHeader()
|
||||
throw;
|
||||
}
|
||||
// in 32 bit case alpha channel is used - so require CV_8UC4 type
|
||||
m_type = iscolor ? (m_bpp == 32 ? CV_8UC4 : CV_8UC3 ) : CV_8UC1;
|
||||
m_type = iscolor ? ((m_bpp == 32 && m_rle_code != BMP_RGB) ? CV_8UC4 : CV_8UC3 ) : CV_8UC1;
|
||||
m_origin = m_height > 0 ? ORIGIN_BL : ORIGIN_TL;
|
||||
m_height = std::abs(m_height);
|
||||
|
||||
|
@ -295,6 +295,16 @@ TEST(Imgcodecs_Bmp, read_rle8)
|
||||
EXPECT_PRED_FORMAT2(cvtest::MatComparator(0, 0), rle, ord);
|
||||
}
|
||||
|
||||
TEST(Imgcodecs_Bmp, read_32bit_rgb)
|
||||
{
|
||||
const string root = cvtest::TS::ptr()->get_data_path();
|
||||
const string filenameInput = root + "readwrite/test_32bit_rgb.bmp";
|
||||
|
||||
const Mat img = cv::imread(filenameInput, IMREAD_UNCHANGED);
|
||||
ASSERT_FALSE(img.empty());
|
||||
ASSERT_EQ(CV_8UC3, img.type());
|
||||
}
|
||||
|
||||
TEST(Imgcodecs_Bmp, rgba_bit_mask)
|
||||
{
|
||||
const string root = cvtest::TS::ptr()->get_data_path();
|
||||
@ -321,6 +331,7 @@ TEST(Imgcodecs_Bmp, read_32bit_xrgb)
|
||||
ASSERT_EQ(data[3], 255);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_IMGCODEC_HDR
|
||||
TEST(Imgcodecs_Hdr, regression)
|
||||
{
|
||||
|
@ -2253,7 +2253,6 @@ static void HoughCircles( InputArray _image, OutputArray _circles,
|
||||
}
|
||||
|
||||
CV_Assert(!_image.empty() && _image.type() == CV_8UC1 && (_image.isMat() || _image.isUMat()));
|
||||
CV_Assert(_circles.isMat() || _circles.isVector());
|
||||
|
||||
if( dp <= 0 || minDist <= 0 || param1 <= 0)
|
||||
CV_Error( Error::StsOutOfRange, "dp, min_dist and canny_threshold must be all positive numbers" );
|
||||
|
@ -317,8 +317,9 @@ namespace minEnclosingTriangle {
|
||||
*/
|
||||
static void findMinEnclosingTriangle(cv::InputArray points,
|
||||
CV_OUT cv::OutputArray triangle, CV_OUT double &area) {
|
||||
std::vector<cv::Point2f> resultingTriangle, polygon;
|
||||
CV_Assert(!points.empty());
|
||||
std::vector<cv::Point2f> resultingTriangle;
|
||||
cv::Mat polygon;
|
||||
convexHull(points, polygon, true, true);
|
||||
findMinEnclosingTriangle(polygon, resultingTriangle, area);
|
||||
cv::Mat(resultingTriangle).copyTo(triangle);
|
||||
|
@ -2457,5 +2457,38 @@ TEST(Imgproc_minAreaRect, reproducer_19769)
|
||||
EXPECT_TRUE(checkMinAreaRect(rr, contour)) << rr.center << " " << rr.size << " " << rr.angle;
|
||||
}
|
||||
|
||||
TEST(Imgproc_minEnclosingTriangle, regression_17585)
|
||||
{
|
||||
const int N = 3;
|
||||
float pts_[N][2] = { {0, 0}, {0, 1}, {1, 1} };
|
||||
cv::Mat points(N, 2, CV_32FC1, static_cast<void*>(pts_));
|
||||
vector<Point2f> triangle;
|
||||
|
||||
EXPECT_NO_THROW(minEnclosingTriangle(points, triangle));
|
||||
}
|
||||
|
||||
TEST(Imgproc_minEnclosingTriangle, regression_20890)
|
||||
{
|
||||
vector<Point> points;
|
||||
points.push_back(Point(0, 0));
|
||||
points.push_back(Point(0, 1));
|
||||
points.push_back(Point(1, 1));
|
||||
vector<Point2f> triangle;
|
||||
|
||||
EXPECT_NO_THROW(minEnclosingTriangle(points, triangle));
|
||||
}
|
||||
|
||||
TEST(Imgproc_minEnclosingTriangle, regression_mat_with_diff_channels)
|
||||
{
|
||||
const int N = 3;
|
||||
float pts_[N][2] = { {0, 0}, {0, 1}, {1, 1} };
|
||||
cv::Mat points1xN(1, N, CV_32FC2, static_cast<void*>(pts_));
|
||||
cv::Mat pointsNx1(N, 1, CV_32FC2, static_cast<void*>(pts_));
|
||||
vector<Point2f> triangle;
|
||||
|
||||
EXPECT_NO_THROW(minEnclosingTriangle(points1xN, triangle));
|
||||
EXPECT_NO_THROW(minEnclosingTriangle(pointsNx1, triangle));
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
/* End of file. */
|
||||
|
@ -830,6 +830,7 @@ static void ffmpeg_log_callback(void *ptr, int level, const char *fmt, va_list v
|
||||
static bool skip_header = false;
|
||||
static int prev_level = -1;
|
||||
CV_UNUSED(ptr);
|
||||
if (level>av_log_get_level()) return;
|
||||
if (!skip_header || level != prev_level) printf("[OPENCV:FFMPEG:%02d] ", level);
|
||||
vprintf(fmt, vargs);
|
||||
size_t fmt_len = strlen(fmt);
|
||||
@ -850,9 +851,15 @@ public:
|
||||
{
|
||||
#ifndef NO_GETENV
|
||||
char* debug_option = getenv("OPENCV_FFMPEG_DEBUG");
|
||||
if (debug_option != NULL)
|
||||
char* level_option = getenv("OPENCV_FFMPEG_LOGLEVEL");
|
||||
int level = AV_LOG_VERBOSE;
|
||||
if (level_option != NULL)
|
||||
{
|
||||
av_log_set_level(AV_LOG_VERBOSE);
|
||||
level = atoi(level_option);
|
||||
}
|
||||
if ( (debug_option != NULL) || (level_option != NULL) )
|
||||
{
|
||||
av_log_set_level(level);
|
||||
av_log_set_callback(ffmpeg_log_callback);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user