mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge branch 4.x
This commit is contained in:
@@ -394,19 +394,6 @@ GEMMSingleMul( const T* a_data, size_t a_step,
|
||||
{
|
||||
WT al(a_data[k]);
|
||||
j=0;
|
||||
#if CV_ENABLE_UNROLLED
|
||||
for(; j <= m - 4; j += 4 )
|
||||
{
|
||||
WT t0 = d_buf[j] + WT(b_data[j])*al;
|
||||
WT t1 = d_buf[j+1] + WT(b_data[j+1])*al;
|
||||
d_buf[j] = t0;
|
||||
d_buf[j+1] = t1;
|
||||
t0 = d_buf[j+2] + WT(b_data[j+2])*al;
|
||||
t1 = d_buf[j+3] + WT(b_data[j+3])*al;
|
||||
d_buf[j+2] = t0;
|
||||
d_buf[j+3] = t1;
|
||||
}
|
||||
#endif
|
||||
for( ; j < m; j++ )
|
||||
d_buf[j] += WT(b_data[j])*al;
|
||||
}
|
||||
|
||||
@@ -807,6 +807,14 @@ TEST_P(Test_ONNX_layers, CumSumExclusiveInplace)
|
||||
testONNXModels("cumsum_exclusive_inplace");
|
||||
}
|
||||
|
||||
// Issue: https://github.com/opencv/opencv/issues/25363
|
||||
// The issue was addressed in 4.x, but the solution does not fit 5.x design
|
||||
TEST_P(Test_ONNX_layers, DISABLED_Range)
|
||||
{
|
||||
testONNXModels("range_float");
|
||||
testONNXModels("range_float_negative");
|
||||
}
|
||||
|
||||
TEST_P(Test_ONNX_layers, Eltwise3D)
|
||||
{
|
||||
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_LT(2021040000)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "../test_precomp.hpp"
|
||||
#include "cvconfig.h"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
#include <functional>
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
@@ -16,7 +17,7 @@ namespace ocl {
|
||||
"../stitching/a3.png", \
|
||||
"../stitching/s2.jpg")
|
||||
|
||||
PARAM_TEST_CASE(Feature2DFixture, Ptr<Feature2D>, std::string)
|
||||
PARAM_TEST_CASE(Feature2DFixture, std::function<Ptr<Feature2D>()>, std::string)
|
||||
{
|
||||
std::string filename;
|
||||
Mat image, descriptors;
|
||||
@@ -27,7 +28,7 @@ PARAM_TEST_CASE(Feature2DFixture, Ptr<Feature2D>, std::string)
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
feature = GET_PARAM(0);
|
||||
feature = GET_PARAM(0)();
|
||||
filename = GET_PARAM(1);
|
||||
|
||||
image = readImage(filename);
|
||||
@@ -61,10 +62,10 @@ OCL_TEST_P(Feature2DFixture, DescriptorsSame)
|
||||
}
|
||||
|
||||
OCL_INSTANTIATE_TEST_CASE_P(AKAZE, Feature2DFixture,
|
||||
testing::Combine(testing::Values(AKAZE::create()), TEST_IMAGES));
|
||||
testing::Combine(testing::Values([]() { return AKAZE::create(); }), TEST_IMAGES));
|
||||
|
||||
OCL_INSTANTIATE_TEST_CASE_P(AKAZE_DESCRIPTOR_KAZE, Feature2DFixture,
|
||||
testing::Combine(testing::Values(AKAZE::create(AKAZE::DESCRIPTOR_KAZE)), TEST_IMAGES));
|
||||
testing::Combine(testing::Values([]() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); }), TEST_IMAGES));
|
||||
|
||||
}//ocl
|
||||
}//cvtest
|
||||
|
||||
@@ -18,31 +18,31 @@ const static std::string IMAGE_BIKES = "detectors_descriptors_evaluation/images_
|
||||
*/
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SIFT, DescriptorRotationInvariance,
|
||||
Value(IMAGE_TSUKUBA, SIFT::create(), SIFT::create(), 0.98f));
|
||||
Value(IMAGE_TSUKUBA, []() { return SIFT::create(); }, []() { return SIFT::create(); }, 0.98f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BRISK, DescriptorRotationInvariance,
|
||||
Value(IMAGE_TSUKUBA, BRISK::create(), BRISK::create(), 0.99f));
|
||||
Value(IMAGE_TSUKUBA, []() { return BRISK::create(); }, []() { return BRISK::create(); }, 0.99f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ORB, DescriptorRotationInvariance,
|
||||
Value(IMAGE_TSUKUBA, ORB::create(), ORB::create(), 0.99f));
|
||||
Value(IMAGE_TSUKUBA, []() { return ORB::create(); }, []() { return ORB::create(); }, 0.99f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE, DescriptorRotationInvariance,
|
||||
Value(IMAGE_TSUKUBA, AKAZE::create(), AKAZE::create(), 0.99f));
|
||||
Value(IMAGE_TSUKUBA, []() { return AKAZE::create(); }, []() { return AKAZE::create(); }, 0.99f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE_DESCRIPTOR_KAZE, DescriptorRotationInvariance,
|
||||
Value(IMAGE_TSUKUBA, AKAZE::create(AKAZE::DESCRIPTOR_KAZE), AKAZE::create(AKAZE::DESCRIPTOR_KAZE), 0.99f));
|
||||
Value(IMAGE_TSUKUBA, []() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); }, []() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); }, 0.99f));
|
||||
|
||||
/*
|
||||
* Descriptor's scale invariance check
|
||||
*/
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SIFT, DescriptorScaleInvariance,
|
||||
Value(IMAGE_BIKES, SIFT::create(0, 3, 0.09), SIFT::create(0, 3, 0.09), 0.78f));
|
||||
Value(IMAGE_BIKES, []() { return SIFT::create(0, 3, 0.09); }, []() { return SIFT::create(0, 3, 0.09); }, 0.78f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE, DescriptorScaleInvariance,
|
||||
Value(IMAGE_BIKES, AKAZE::create(), AKAZE::create(), 0.6f));
|
||||
Value(IMAGE_BIKES, []() { return AKAZE::create(); }, []() { return AKAZE::create(); }, 0.6f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE_DESCRIPTOR_KAZE, DescriptorScaleInvariance,
|
||||
Value(IMAGE_BIKES, AKAZE::create(AKAZE::DESCRIPTOR_KAZE), AKAZE::create(AKAZE::DESCRIPTOR_KAZE), 0.55f));
|
||||
Value(IMAGE_BIKES, []() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); }, []() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); }, 0.55f));
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -3,12 +3,17 @@
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
|
||||
#include "test_invariance_utils.hpp"
|
||||
#include <functional>
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
#define SHOW_DEBUG_LOG 1
|
||||
|
||||
typedef tuple<std::string, Ptr<FeatureDetector>, Ptr<DescriptorExtractor>, float>
|
||||
// NOTE: using factory function (function<Ptr<Type>()>) instead of object instance (Ptr<Type>) as a
|
||||
// test parameter, because parameters exist during whole test program run and consume a lot of memory
|
||||
typedef std::function<cv::Ptr<cv::FeatureDetector>()> DetectorFactory;
|
||||
typedef std::function<cv::Ptr<cv::DescriptorExtractor>()> ExtractorFactory;
|
||||
typedef tuple<std::string, DetectorFactory, ExtractorFactory, float>
|
||||
String_FeatureDetector_DescriptorExtractor_Float_t;
|
||||
|
||||
|
||||
@@ -61,8 +66,8 @@ protected:
|
||||
image0 = imread(filename);
|
||||
ASSERT_FALSE(image0.empty()) << "couldn't read input image";
|
||||
|
||||
featureDetector = get<1>(GetParam());
|
||||
descriptorExtractor = get<2>(GetParam());
|
||||
featureDetector = get<1>(GetParam())();
|
||||
descriptorExtractor = get<2>(GetParam())();
|
||||
minInliersRatio = get<3>(GetParam());
|
||||
}
|
||||
|
||||
|
||||
@@ -18,40 +18,40 @@ const static std::string IMAGE_BIKES = "detectors_descriptors_evaluation/images_
|
||||
*/
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SIFT, DetectorRotationInvariance,
|
||||
Value(IMAGE_TSUKUBA, SIFT::create(), 0.45f, 0.70f));
|
||||
Value(IMAGE_TSUKUBA, []() { return SIFT::create(); }, 0.45f, 0.70f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BRISK, DetectorRotationInvariance,
|
||||
Value(IMAGE_TSUKUBA, BRISK::create(), 0.45f, 0.76f));
|
||||
Value(IMAGE_TSUKUBA, []() { return BRISK::create(); }, 0.45f, 0.76f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ORB, DetectorRotationInvariance,
|
||||
Value(IMAGE_TSUKUBA, ORB::create(), 0.5f, 0.76f));
|
||||
Value(IMAGE_TSUKUBA, []() { return ORB::create(); }, 0.5f, 0.76f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE, DetectorRotationInvariance,
|
||||
Value(IMAGE_TSUKUBA, AKAZE::create(), 0.5f, 0.71f));
|
||||
Value(IMAGE_TSUKUBA, []() { return AKAZE::create(); }, 0.5f, 0.71f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE_DESCRIPTOR_KAZE, DetectorRotationInvariance,
|
||||
Value(IMAGE_TSUKUBA, AKAZE::create(AKAZE::DESCRIPTOR_KAZE), 0.5f, 0.71f));
|
||||
Value(IMAGE_TSUKUBA, []() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); }, 0.5f, 0.71f));
|
||||
|
||||
/*
|
||||
* Detector's scale invariance check
|
||||
*/
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SIFT, DetectorScaleInvariance,
|
||||
Value(IMAGE_BIKES, SIFT::create(0, 3, 0.09), 0.60f, 0.98f));
|
||||
Value(IMAGE_BIKES, []() { return SIFT::create(0, 3, 0.09); }, 0.60f, 0.98f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BRISK, DetectorScaleInvariance,
|
||||
Value(IMAGE_BIKES, BRISK::create(), 0.08f, 0.49f));
|
||||
Value(IMAGE_BIKES, []() { return BRISK::create(); }, 0.08f, 0.49f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ORB, DetectorScaleInvariance,
|
||||
Value(IMAGE_BIKES, ORB::create(), 0.08f, 0.49f));
|
||||
Value(IMAGE_BIKES, []() { return ORB::create(); }, 0.08f, 0.49f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(KAZE, DetectorScaleInvariance,
|
||||
Value(IMAGE_BIKES, KAZE::create(), 0.08f, 0.49f));
|
||||
Value(IMAGE_BIKES, []() { return KAZE::create(); }, 0.08f, 0.49f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE, DetectorScaleInvariance,
|
||||
Value(IMAGE_BIKES, AKAZE::create(), 0.08f, 0.49f));
|
||||
Value(IMAGE_BIKES, []() { return AKAZE::create(); }, 0.08f, 0.49f));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE_DESCRIPTOR_KAZE, DetectorScaleInvariance,
|
||||
Value(IMAGE_BIKES, AKAZE::create(AKAZE::DESCRIPTOR_KAZE), 0.08f, 0.49f));
|
||||
Value(IMAGE_BIKES, []() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); }, 0.08f, 0.49f));
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
|
||||
#include "test_invariance_utils.hpp"
|
||||
#include <functional>
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
#define SHOW_DEBUG_LOG 1
|
||||
|
||||
typedef tuple<std::string, Ptr<FeatureDetector>, float, float> String_FeatureDetector_Float_Float_t;
|
||||
// NOTE: using factory function (function<Ptr<Type>()>) instead of object instance (Ptr<Type>) as a
|
||||
// test parameter, because parameters exist during whole test program run and consume a lot of memory
|
||||
typedef std::function<cv::Ptr<cv::FeatureDetector>()> DetectorFactory;
|
||||
typedef tuple<std::string, DetectorFactory, float, float> String_FeatureDetector_Float_Float_t;
|
||||
|
||||
|
||||
static
|
||||
@@ -56,7 +60,7 @@ protected:
|
||||
image0 = imread(filename);
|
||||
ASSERT_FALSE(image0.empty()) << "couldn't read input image";
|
||||
|
||||
featureDetector = get<1>(GetParam());
|
||||
featureDetector = get<1>(GetParam())();
|
||||
minKeyPointMatchesRatio = get<2>(GetParam());
|
||||
minInliersRatio = get<3>(GetParam());
|
||||
}
|
||||
|
||||
@@ -285,6 +285,15 @@ The function destroyAllWindows destroys all of the opened HighGUI windows.
|
||||
*/
|
||||
CV_EXPORTS_W void destroyAllWindows();
|
||||
|
||||
|
||||
/** @brief HighGUI backend used.
|
||||
|
||||
The function returns HighGUI backend name used: could be COCOA, GTK2/3, QT, WAYLAND or WIN32.
|
||||
Returns empty string if there is no available UI backend.
|
||||
*/
|
||||
CV_EXPORTS_W const std::string currentUIFramework();
|
||||
|
||||
|
||||
CV_EXPORTS_W int startWindowThread();
|
||||
|
||||
/** @brief Similar to #waitKey, but returns full key code.
|
||||
|
||||
@@ -106,6 +106,7 @@ public:
|
||||
|
||||
virtual int waitKeyEx(int delay /*= 0*/) = 0;
|
||||
virtual int pollKey() = 0;
|
||||
virtual const std::string getName() const = 0;
|
||||
};
|
||||
|
||||
std::shared_ptr<UIBackend>& getCurrentUIBackend();
|
||||
|
||||
@@ -1082,6 +1082,33 @@ void cv::imshow(const String& winname, const ogl::Texture2D& _tex)
|
||||
#endif
|
||||
}
|
||||
|
||||
const std::string cv::currentUIFramework()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
// plugin and backend-compatible implementations
|
||||
auto backend = getCurrentUIBackend();
|
||||
if (backend)
|
||||
{
|
||||
return backend->getName();
|
||||
}
|
||||
|
||||
// builtin backends
|
||||
#if defined(HAVE_WIN32UI)
|
||||
CV_Assert(false); // backend-compatible
|
||||
#elif defined (HAVE_GTK)
|
||||
CV_Assert(false); // backend-compatible
|
||||
#elif defined (HAVE_QT)
|
||||
return std::string("QT");
|
||||
#elif defined (HAVE_COCOA)
|
||||
return std::string("COCOA");
|
||||
#elif defined (HAVE_WAYLAND)
|
||||
return std::string("WAYLAND");
|
||||
#else
|
||||
return std::string();
|
||||
#endif
|
||||
}
|
||||
|
||||
//========================= OpenGL fallback =========================
|
||||
|
||||
#ifndef HAVE_OPENGL
|
||||
|
||||
@@ -2238,6 +2238,19 @@ public:
|
||||
{
|
||||
return waitKeyImpl(1); // TODO
|
||||
}
|
||||
|
||||
const std::string getName() const CV_OVERRIDE
|
||||
{
|
||||
#if GTK_MAJOR_VERSION == 2
|
||||
return "GTK2";
|
||||
#elif GTK_MAJOR_VERSION == 3
|
||||
return "GTK3";
|
||||
#elif GTK_MAJOR_VERSION == 4
|
||||
return "GTK4";
|
||||
#else
|
||||
#error "Unsupported GTK version"
|
||||
#endif
|
||||
}
|
||||
}; // GTKBackendUI
|
||||
|
||||
static
|
||||
|
||||
@@ -2937,6 +2937,11 @@ public:
|
||||
{
|
||||
return pollKey_W32();
|
||||
}
|
||||
|
||||
const std::string getName() const CV_OVERRIDE
|
||||
{
|
||||
return "WIN32";
|
||||
}
|
||||
}; // Win32BackendUI
|
||||
|
||||
static
|
||||
|
||||
@@ -205,4 +205,23 @@ TEST(Highgui_GUI, trackbar)
|
||||
EXPECT_NO_THROW(destroyAllWindows());
|
||||
}
|
||||
|
||||
|
||||
TEST(Highgui_GUI, currentUIFramework)
|
||||
{
|
||||
auto framework = currentUIFramework();
|
||||
std::cout << "UI framework: \"" << framework << "\"" << std::endl;
|
||||
#if (!defined(ENABLE_PLUGINS) \
|
||||
&& !defined HAVE_GTK \
|
||||
&& !defined HAVE_QT \
|
||||
&& !defined HAVE_WIN32UI \
|
||||
&& !defined HAVE_COCOA \
|
||||
&& !defined HAVE_WAYLAND \
|
||||
)
|
||||
EXPECT_TRUE(framework.empty());
|
||||
#elif !defined(ENABLE_PLUGINS)
|
||||
EXPECT_GT(framework.size(), 0); // builtin backends
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -53,22 +53,8 @@
|
||||
#include "grfmt_tiff.hpp"
|
||||
#include <limits>
|
||||
|
||||
// TODO FIXIT Conflict declarations for common types like int64/uint64
|
||||
namespace tiff_dummy_namespace {
|
||||
#include "tiff.h"
|
||||
#include "tiffio.h"
|
||||
}
|
||||
using namespace tiff_dummy_namespace;
|
||||
|
||||
#ifndef _MSC_VER
|
||||
namespace numeric_types = tiff_dummy_namespace;
|
||||
#else
|
||||
#include <cstdint>
|
||||
namespace numeric_types {
|
||||
using uint16 = std::uint16_t;
|
||||
using uint32 = std::uint32_t;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace cv
|
||||
{
|
||||
@@ -274,8 +260,8 @@ bool TiffDecoder::readHeader()
|
||||
|
||||
if (tif)
|
||||
{
|
||||
numeric_types::uint32 wdth = 0, hght = 0;
|
||||
numeric_types::uint16 photometric = 0;
|
||||
uint32_t wdth = 0, hght = 0;
|
||||
uint16_t photometric = 0;
|
||||
|
||||
CV_TIFF_CHECK_CALL(TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &wdth));
|
||||
CV_TIFF_CHECK_CALL(TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &hght));
|
||||
@@ -283,7 +269,7 @@ bool TiffDecoder::readHeader()
|
||||
|
||||
{
|
||||
bool isGrayScale = photometric == PHOTOMETRIC_MINISWHITE || photometric == PHOTOMETRIC_MINISBLACK;
|
||||
numeric_types::uint16 bpp = 8, ncn = isGrayScale ? 1 : 3;
|
||||
uint16_t bpp = 8, ncn = isGrayScale ? 1 : 3;
|
||||
if (0 == TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bpp))
|
||||
{
|
||||
// TIFF bi-level images don't require TIFFTAG_BITSPERSAMPLE tag
|
||||
@@ -306,7 +292,7 @@ bool TiffDecoder::readHeader()
|
||||
(ncn != 1 && ncn != 3 && ncn != 4)))
|
||||
bpp = 8;
|
||||
|
||||
numeric_types::uint16 sample_format = SAMPLEFORMAT_UINT;
|
||||
uint16_t sample_format = SAMPLEFORMAT_UINT;
|
||||
TIFFGetField(tif, TIFFTAG_SAMPLEFORMAT, &sample_format);
|
||||
int wanted_channels = normalizeChannelsNumber(ncn);
|
||||
switch (bpp)
|
||||
@@ -388,7 +374,7 @@ bool TiffDecoder::nextPage()
|
||||
readHeader();
|
||||
}
|
||||
|
||||
static void fixOrientationPartial(Mat &img, numeric_types::uint16 orientation)
|
||||
static void fixOrientationPartial(Mat &img, uint16_t orientation)
|
||||
{
|
||||
switch(orientation) {
|
||||
case ORIENTATION_RIGHTTOP:
|
||||
@@ -444,7 +430,7 @@ static void fixOrientationFull(Mat &img, int orientation)
|
||||
* For 8 bit some corrections are done by TIFFReadRGBAStrip/Tile already.
|
||||
* Not so for 16/32/64 bit.
|
||||
*/
|
||||
static void fixOrientation(Mat &img, numeric_types::uint16 orientation, bool isOrientationFull)
|
||||
static void fixOrientation(Mat &img, uint16_t orientation, bool isOrientationFull)
|
||||
{
|
||||
if( isOrientationFull )
|
||||
{
|
||||
@@ -605,7 +591,7 @@ bool TiffDecoder::readData( Mat& img )
|
||||
CV_Assert(!m_tif.empty());
|
||||
TIFF* tif = (TIFF*)m_tif.get();
|
||||
|
||||
numeric_types::uint16 photometric = (numeric_types::uint16)-1;
|
||||
uint16_t photometric = (uint16_t)-1;
|
||||
CV_TIFF_CHECK_CALL(TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric));
|
||||
|
||||
if (m_hdr && depth >= CV_32F)
|
||||
@@ -621,14 +607,14 @@ bool TiffDecoder::readData( Mat& img )
|
||||
{
|
||||
int is_tiled = TIFFIsTiled(tif) != 0;
|
||||
bool isGrayScale = photometric == PHOTOMETRIC_MINISWHITE || photometric == PHOTOMETRIC_MINISBLACK;
|
||||
numeric_types::uint16 bpp = 8, ncn = isGrayScale ? 1 : 3;
|
||||
uint16_t bpp = 8, ncn = isGrayScale ? 1 : 3;
|
||||
if (0 == TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bpp))
|
||||
{
|
||||
// TIFF bi-level images don't require TIFFTAG_BITSPERSAMPLE tag
|
||||
bpp = 1;
|
||||
}
|
||||
CV_TIFF_CHECK_CALL_DEBUG(TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &ncn));
|
||||
numeric_types::uint16 img_orientation = ORIENTATION_TOPLEFT;
|
||||
uint16_t img_orientation = ORIENTATION_TOPLEFT;
|
||||
CV_TIFF_CHECK_CALL_DEBUG(TIFFGetField(tif, TIFFTAG_ORIENTATION, &img_orientation));
|
||||
constexpr const int bitsPerByte = 8;
|
||||
int dst_bpp = (int)(img.elemSize1() * bitsPerByte);
|
||||
@@ -638,7 +624,7 @@ bool TiffDecoder::readData( Mat& img )
|
||||
int wanted_channels = normalizeChannelsNumber(img.channels());
|
||||
bool doReadScanline = false;
|
||||
|
||||
numeric_types::uint32 tile_width0 = m_width, tile_height0 = 0;
|
||||
uint32_t tile_width0 = m_width, tile_height0 = 0;
|
||||
|
||||
if (is_tiled)
|
||||
{
|
||||
@@ -656,7 +642,7 @@ bool TiffDecoder::readData( Mat& img )
|
||||
tile_width0 = m_width;
|
||||
|
||||
if (tile_height0 == 0 ||
|
||||
(!is_tiled && tile_height0 == std::numeric_limits<numeric_types::uint32>::max()) )
|
||||
(!is_tiled && tile_height0 == std::numeric_limits<uint32_t>::max()) )
|
||||
tile_height0 = m_height;
|
||||
|
||||
const int TILE_MAX_WIDTH = (1 << 24);
|
||||
@@ -681,7 +667,7 @@ bool TiffDecoder::readData( Mat& img )
|
||||
( (uint64_t) MAX_TILE_SIZE * 95 / 100)
|
||||
)
|
||||
{
|
||||
uint16_t planerConfig = (numeric_types::uint16)-1;
|
||||
uint16_t planerConfig = (uint16_t)-1;
|
||||
CV_TIFF_CHECK_CALL(TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &planerConfig));
|
||||
|
||||
doReadScanline = (!is_tiled) // no tile
|
||||
@@ -737,7 +723,7 @@ bool TiffDecoder::readData( Mat& img )
|
||||
MAX_TILE_SIZE * 95 / 100
|
||||
)
|
||||
{
|
||||
uint16_t planerConfig = (numeric_types::uint16)-1;
|
||||
uint16_t planerConfig = (uint16_t)-1;
|
||||
CV_TIFF_CHECK_CALL(TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &planerConfig));
|
||||
|
||||
doReadScanline = (!is_tiled) // no tile
|
||||
@@ -821,7 +807,7 @@ bool TiffDecoder::readData( Mat& img )
|
||||
uchar* bstart = src_buffer;
|
||||
if (doReadScanline)
|
||||
{
|
||||
CV_TIFF_CHECK_CALL((int)TIFFReadScanline(tif, (numeric_types::uint32*)src_buffer, y) >= 0);
|
||||
CV_TIFF_CHECK_CALL((int)TIFFReadScanline(tif, (uint32_t*)src_buffer, y) >= 0);
|
||||
|
||||
if ( isNeedConvert16to8 )
|
||||
{
|
||||
@@ -843,11 +829,11 @@ bool TiffDecoder::readData( Mat& img )
|
||||
}
|
||||
else if (!is_tiled)
|
||||
{
|
||||
CV_TIFF_CHECK_CALL(TIFFReadRGBAStrip(tif, y, (numeric_types::uint32*)src_buffer));
|
||||
CV_TIFF_CHECK_CALL(TIFFReadRGBAStrip(tif, y, (uint32_t*)src_buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_TIFF_CHECK_CALL(TIFFReadRGBATile(tif, x, y, (numeric_types::uint32*)src_buffer));
|
||||
CV_TIFF_CHECK_CALL(TIFFReadRGBATile(tif, x, y, (uint32_t*)src_buffer));
|
||||
// Tiles fill the buffer from the bottom up
|
||||
bstart += (tile_height0 - tile_height) * tile_width0 * 4;
|
||||
}
|
||||
@@ -941,15 +927,15 @@ bool TiffDecoder::readData( Mat& img )
|
||||
{
|
||||
if (doReadScanline)
|
||||
{
|
||||
CV_TIFF_CHECK_CALL((int)TIFFReadScanline(tif, (numeric_types::uint32*)src_buffer, y) >= 0);
|
||||
CV_TIFF_CHECK_CALL((int)TIFFReadScanline(tif, (uint32_t*)src_buffer, y) >= 0);
|
||||
}
|
||||
else if (!is_tiled)
|
||||
{
|
||||
CV_TIFF_CHECK_CALL((int)TIFFReadEncodedStrip(tif, tileidx, (numeric_types::uint32*)src_buffer, src_buffer_size) >= 0);
|
||||
CV_TIFF_CHECK_CALL((int)TIFFReadEncodedStrip(tif, tileidx, (uint32_t*)src_buffer, src_buffer_size) >= 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_TIFF_CHECK_CALL((int)TIFFReadEncodedTile(tif, tileidx, (numeric_types::uint32*)src_buffer, src_buffer_size) >= 0);
|
||||
CV_TIFF_CHECK_CALL((int)TIFFReadEncodedTile(tif, tileidx, (uint32_t*)src_buffer, src_buffer_size) >= 0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < tile_height; i++)
|
||||
@@ -1266,7 +1252,7 @@ bool TiffEncoder::writeLibTiff( const std::vector<Mat>& img_vec, const std::vect
|
||||
int page_compression = compression;
|
||||
|
||||
int bitsPerChannel = -1;
|
||||
numeric_types::uint16 sample_format = SAMPLEFORMAT_INT;
|
||||
uint16_t sample_format = SAMPLEFORMAT_INT;
|
||||
switch (depth)
|
||||
{
|
||||
case CV_8U:
|
||||
|
||||
@@ -298,6 +298,36 @@ inline int hal_ni_warpPerspective(int src_type, const uchar *src_data, size_t sr
|
||||
#define cv_hal_warpPerspective hal_ni_warpPerspective
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
@brief hal_remap with floating point maps
|
||||
@param src_type source and destination image type
|
||||
@param src_data source image data
|
||||
@param src_step source image step
|
||||
@param src_width source image width
|
||||
@param src_height source image height
|
||||
@param dst_data destination image data
|
||||
@param dst_step destination image step
|
||||
@param dst_width destination image width
|
||||
@param dst_height destination image height
|
||||
@param mapx map for x values
|
||||
@param mapx_step mapx matrix step
|
||||
@param mapy map for y values
|
||||
@param mapy_step mapy matrix step
|
||||
@param interpolation interpolation mode (CV_HAL_INTER_NEAREST, ...)
|
||||
@param border_type border processing mode (CV_HAL_BORDER_REFLECT, ...)
|
||||
@param border_value values to use for CV_HAL_BORDER_CONSTANT mode
|
||||
@sa cv::remap
|
||||
*/
|
||||
inline int hal_ni_remap32f(int src_type, const uchar *src_data, size_t src_step, int src_width, int src_height,
|
||||
uchar *dst_data, size_t dst_step, int dst_width, int dst_height,
|
||||
float* mapx, size_t mapx_step, float* mapy, size_t mapy_step,
|
||||
int interpolation, int border_type, const double border_value[4])
|
||||
{ return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
//! @cond IGNORED
|
||||
#define cv_hal_remap32f hal_ni_remap32f
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
@brief hal_cvtBGRtoBGR
|
||||
@param src_data source image data
|
||||
@@ -855,7 +885,7 @@ inline int hal_ni_boxFilter(const uchar* src_data, size_t src_step, uchar* dst_d
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
@brief Blurs an image using a Gaussian filter.
|
||||
@brief Blurs an image using a generic Gaussian filter.
|
||||
@param src_data Source image data
|
||||
@param src_step Source image step
|
||||
@param dst_data Destination image data
|
||||
@@ -880,6 +910,29 @@ inline int hal_ni_gaussianBlur(const uchar* src_data, size_t src_step, uchar* ds
|
||||
#define cv_hal_gaussianBlur hal_ni_gaussianBlur
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
@brief Blurs an image using a symmetric Gaussian filter with square kernel and sigma=0.
|
||||
@param src_data Source image data
|
||||
@param src_step Source image step
|
||||
@param dst_data Destination image data
|
||||
@param dst_step Destination image step
|
||||
@param width Source image width
|
||||
@param height Source image height
|
||||
@param depth Depth of source and destination image
|
||||
@param cn Number of channels
|
||||
@param margin_left Left margins for source image
|
||||
@param margin_top Top margins for source image
|
||||
@param margin_right Right margins for source image
|
||||
@param margin_bottom Bottom margins for source image
|
||||
@param ksize Width of kernel
|
||||
@param border_type Border type
|
||||
*/
|
||||
inline int hal_ni_gaussianBlurBinomial(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int depth, int cn, size_t margin_left, size_t margin_top, size_t margin_right, size_t margin_bottom, size_t ksize, int border_type) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
//! @cond IGNORED
|
||||
#define cv_hal_gaussianBlurBinomial hal_ni_gaussianBlurBinomial
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
@brief Computes Sobel derivatives
|
||||
@param src_depth Depth of source image
|
||||
|
||||
@@ -1716,6 +1716,12 @@ void cv::remap( InputArray _src, OutputArray _dst,
|
||||
if( dst.data == src.data )
|
||||
src = src.clone();
|
||||
|
||||
if ((map1.type() == CV_32FC1) && (map2.type() == CV_32FC1))
|
||||
{
|
||||
CALL_HAL(remap32f, cv_hal_remap32f, src.type(), src.data, src.step, src.cols, src.rows, dst.data, dst.step, dst.cols, dst.rows,
|
||||
map1.ptr<float>(), map1.step, map2.ptr<float>(), map2.step, interpolation, borderType, borderValue.val);
|
||||
}
|
||||
|
||||
interpolation &= ~cv::WARP_RELATIVE_MAP;
|
||||
if( interpolation == INTER_AREA )
|
||||
interpolation = INTER_LINEAR;
|
||||
|
||||
@@ -599,8 +599,22 @@ void GaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
|
||||
|
||||
if (src.data == dst.data)
|
||||
src = src.clone();
|
||||
|
||||
if ((sigma1 == 0.0) && (sigma2 == 0.0) && (ksize.height == ksize.width))
|
||||
{
|
||||
Point ofs;
|
||||
Size wsz(src.cols, src.rows);
|
||||
Mat src2 = src;
|
||||
if(!(borderType & BORDER_ISOLATED))
|
||||
src2.locateROI( wsz, ofs );
|
||||
|
||||
CALL_HAL(gaussianBlurBinomial, cv_hal_gaussianBlurBinomial, src2.ptr(), src2.step, dst.ptr(), dst.step, src2.cols, src2.rows, sdepth, cn,
|
||||
ofs.x, ofs.y, wsz.width - src2.cols - ofs.x, wsz.height - src2.rows - ofs.y, ksize.width, borderType&~BORDER_ISOLATED);
|
||||
}
|
||||
|
||||
CV_CPU_DISPATCH(GaussianBlurFixedPoint, (src, dst, (const uint16_t*)&fkx[0], (int)fkx.size(), (const uint16_t*)&fky[0], (int)fky.size(), borderType),
|
||||
CV_CPU_DISPATCH_MODES_ALL);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -636,8 +650,22 @@ void GaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
|
||||
|
||||
if (src.data == dst.data)
|
||||
src = src.clone();
|
||||
|
||||
if ((sigma1 == 0.0) && (sigma2 == 0.0) && (ksize.height == ksize.width))
|
||||
{
|
||||
Point ofs;
|
||||
Size wsz(src.cols, src.rows);
|
||||
Mat src2 = src;
|
||||
if(!(borderType & BORDER_ISOLATED))
|
||||
src2.locateROI( wsz, ofs );
|
||||
|
||||
CALL_HAL(gaussianBlurBinomial, cv_hal_gaussianBlurBinomial, src2.ptr(), src2.step, dst.ptr(), dst.step, src2.cols, src2.rows, sdepth, cn,
|
||||
ofs.x, ofs.y, wsz.width - src2.cols - ofs.x, wsz.height - src2.rows - ofs.y, ksize.width, borderType&~BORDER_ISOLATED);
|
||||
}
|
||||
|
||||
CV_CPU_DISPATCH(GaussianBlurFixedPoint, (src, dst, (const uint32_t*)&fkx[0], (int)fkx.size(), (const uint32_t*)&fky[0], (int)fky.size(), borderType),
|
||||
CV_CPU_DISPATCH_MODES_ALL);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ icvTeleaInpaintFMM(const CvMat *f, CvMat *t, CvMat *out, int range, CvPriorityQu
|
||||
gradI.y=0;
|
||||
}
|
||||
}
|
||||
Ia[color] += (float)w * (float)(CV_MAT_3COLOR_ELEM(*out,uchar,km,lm,color));
|
||||
Ia[color] += (float)w * (float)(CV_MAT_3COLOR_ELEM(*out,uchar,k-1,l-1,color));
|
||||
Jx[color] -= (float)w * (float)(gradI.x*r.x);
|
||||
Jy[color] -= (float)w * (float)(gradI.y*r.y);
|
||||
s[color] += w;
|
||||
@@ -452,7 +452,7 @@ icvTeleaInpaintFMM(const CvMat *f, CvMat *t, CvMat *out, int range, CvPriorityQu
|
||||
gradI.y=0;
|
||||
}
|
||||
}
|
||||
Ia += (float)w * (float)(CV_MAT_ELEM(*out,data_type,km,lm));
|
||||
Ia += (float)w * (float)(CV_MAT_ELEM(*out,data_type,k-1,l-1));
|
||||
Jx -= (float)w * (float)(gradI.x*r.x);
|
||||
Jy -= (float)w * (float)(gradI.y*r.y);
|
||||
s += w;
|
||||
@@ -555,7 +555,7 @@ icvNSInpaintFMM(const CvMat *f, CvMat *t, CvMat *out, int range, CvPriorityQueue
|
||||
dir = (float)fabs(VectorScalMult(r,gradI)/sqrt(VectorLength(r)*VectorLength(gradI)));
|
||||
}
|
||||
w = dst*dir;
|
||||
Ia[color] += (float)w * (float)(CV_MAT_3COLOR_ELEM(*out,uchar,km,lm,color));
|
||||
Ia[color] += (float)w * (float)(CV_MAT_3COLOR_ELEM(*out,uchar,k-1,l-1,color));
|
||||
s[color] += w;
|
||||
}
|
||||
}
|
||||
@@ -645,7 +645,7 @@ icvNSInpaintFMM(const CvMat *f, CvMat *t, CvMat *out, int range, CvPriorityQueue
|
||||
dir = (float)fabs(VectorScalMult(r,gradI)/sqrt(VectorLength(r)*VectorLength(gradI)));
|
||||
}
|
||||
w = dst*dir;
|
||||
Ia += (float)w * (float)(CV_MAT_ELEM(*out,data_type,km,lm));
|
||||
Ia += (float)w * (float)(CV_MAT_ELEM(*out,data_type,k-1,l-1));
|
||||
s += w;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,4 +157,30 @@ TEST(Photo_InpaintBorders, regression)
|
||||
ASSERT_TRUE(countNonZero(diff) == 0);
|
||||
}
|
||||
|
||||
typedef testing::TestWithParam<tuple<perf::MatType>> Photo_InpaintSmallBorders;
|
||||
|
||||
TEST_P(Photo_InpaintSmallBorders, regression)
|
||||
{
|
||||
int type = get<0>(GetParam());
|
||||
Mat img(5, 5, type, Scalar::all(128));
|
||||
Mat expected = img.clone();
|
||||
|
||||
Mat mask = Mat::zeros(5, 5, CV_8U);
|
||||
mask(Rect(1, 1, 3, 3)) = 255;
|
||||
|
||||
img.setTo(Scalar::all(0), mask);
|
||||
|
||||
Mat inpainted, diff;
|
||||
|
||||
inpaint(img, mask, inpainted, 1, INPAINT_TELEA);
|
||||
cv::absdiff(inpainted, expected, diff);
|
||||
ASSERT_EQ(countNonZero(diff.reshape(1)), 0);
|
||||
|
||||
inpaint(img, mask, inpainted, 1, INPAINT_NS);
|
||||
cv::absdiff(inpainted, expected, diff);
|
||||
ASSERT_EQ(countNonZero(diff.reshape(1)), 0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(/*nothing*/, Photo_InpaintSmallBorders, Values(CV_8UC1, CV_8UC3));
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -927,7 +927,6 @@ public:
|
||||
if(!threadSafe)
|
||||
lock.lock();
|
||||
static InternalFFMpegRegister instance;
|
||||
initLogger_(); // update logger setup unconditionally (GStreamer's libav plugin may override these settings)
|
||||
}
|
||||
static void initLogger_()
|
||||
{
|
||||
@@ -965,6 +964,7 @@ public:
|
||||
/* register a callback function for synchronization */
|
||||
av_lockmgr_register(&LockCallBack);
|
||||
#endif
|
||||
initLogger_();
|
||||
}
|
||||
~InternalFFMpegRegister()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user