1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2025-02-05 09:28:27 +03:00
180 changed files with 11419 additions and 1819 deletions
+29 -12
View File
@@ -9,7 +9,12 @@
#include <opencv2/core/utils/filesystem.hpp>
#include <opencv2/core/utils/filesystem.private.hpp>
namespace cv { namespace utils {
namespace cv {
static inline std::ostream& operator<<(std::ostream& os, const Rect& rect)
{
return os << "[x=" << rect.x << ", y=" << rect.y << ", w=" << rect.width << ", h=" << rect.height << ']';
}
namespace utils {
String dumpInputArray(InputArray argument)
{
@@ -51,9 +56,13 @@ String dumpInputArray(InputArray argument)
ss << " type(-1)=" << cv::typeToString(argument.type(-1));
} while (0);
}
catch (const std::exception& e)
{
ss << " ERROR: exception occurred: " << e.what();
}
catch (...)
{
ss << " ERROR: exception occurred, dump is non-complete"; // need to properly support different kinds
ss << " ERROR: unknown exception occurred, dump is non-complete";
}
return ss.str();
}
@@ -104,9 +113,13 @@ CV_EXPORTS_W String dumpInputArrayOfArrays(InputArrayOfArrays argument)
}
} while (0);
}
catch (const std::exception& e)
{
ss << " ERROR: exception occurred: " << e.what();
}
catch (...)
{
ss << " ERROR: exception occurred, dump is non-complete"; // need to properly support different kinds
ss << " ERROR: unknown exception occurred, dump is non-complete";
}
return ss.str();
}
@@ -151,9 +164,13 @@ CV_EXPORTS_W String dumpInputOutputArray(InputOutputArray argument)
ss << " type(-1)=" << cv::typeToString(argument.type(-1));
} while (0);
}
catch (const std::exception& e)
{
ss << " ERROR: exception occurred: " << e.what();
}
catch (...)
{
ss << " ERROR: exception occurred, dump is non-complete"; // need to properly support different kinds
ss << " ERROR: unknown exception occurred, dump is non-complete";
}
return ss.str();
}
@@ -204,28 +221,28 @@ CV_EXPORTS_W String dumpInputOutputArrayOfArrays(InputOutputArrayOfArrays argume
}
} while (0);
}
catch (const std::exception& e)
{
ss << " ERROR: exception occurred: " << e.what();
}
catch (...)
{
ss << " ERROR: exception occurred, dump is non-complete"; // need to properly support different kinds
ss << " ERROR: unknown exception occurred, dump is non-complete";
}
return ss.str();
}
static inline std::ostream& operator<<(std::ostream& os, const cv::Rect& rect)
{
return os << "[x=" << rect.x << ", y=" << rect.y << ", w=" << rect.width << ", h=" << rect.height << ']';
}
template <class T, class Formatter>
static inline String dumpVector(const std::vector<T>& vec, Formatter format)
{
std::ostringstream oss("[", std::ios::ate);
if (!vec.empty())
{
oss << format << vec[0];
format(oss) << vec[0];
for (std::size_t i = 1; i < vec.size(); ++i)
{
oss << ", " << format << vec[i];
oss << ", ";
format(oss) << vec[i];
}
}
oss << "]";
+4 -2
View File
@@ -12,7 +12,8 @@ GpuMatND::~GpuMatND() = default;
GpuMatND::GpuMatND(SizeArray _size, int _type, void* _data, StepArray _step) :
flags(0), dims(0), data(static_cast<uchar*>(_data)), offset(0)
{
CV_Assert(_step.empty() || _size.size() == _step.size() + 1);
CV_Assert(_step.empty() || _size.size() == _step.size() + 1 ||
(_size.size() == _step.size() && _step.back() == (size_t)CV_ELEM_SIZE(_type)));
setFields(std::move(_size), _type, std::move(_step));
}
@@ -118,7 +119,8 @@ void GpuMatND::setFields(SizeArray _size, int _type, StepArray _step)
else
{
step = std::move(_step);
step.push_back(elemSize());
if (step.size() < size.size())
step.push_back(elemSize());
flags = cv::updateContinuityFlag(flags, dims, size.data(), step.data());
}
+1 -2
View File
@@ -2536,8 +2536,7 @@ double dotProd_16s(const short* src1, const short* src2, int len)
double dotProd_32s(const int* src1, const int* src2, int len)
{
#if CV_SIMD_64F // TODO: enable for CV_SIMD_SCALABLE_64F
// Test failed on RVV(QEMU): Too big difference (=1.20209e-08 > 1.11022e-12)
#if CV_SIMD_64F || CV_SIMD_SCALABLE_64F
double r = .0;
int i = 0;
const int step = VTraits<v_int32>::vlanes();
+7
View File
@@ -170,7 +170,14 @@ void SparseMat::Hdr::clear()
hashtab.clear();
hashtab.resize(HASH_SIZE0);
pool.clear();
#if defined(__GNUC__) && (__GNUC__ == 13) && !defined(__clang__) && (__cplusplus >= 202002L)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
pool.resize(nodeSize);
#if defined(__GNUC__) && (__GNUC__ == 13) && !defined(__clang__) && (__cplusplus >= 202002L)
#pragma GCC diagnostic pop
#endif
nodeCount = freeList = 0;
}
+14 -4
View File
@@ -48,12 +48,16 @@ int normHamming(const uchar* a, int n)
# if defined CV_POPCNT_U64
for(; i <= n - 8; i += 8)
{
result += (int)CV_POPCNT_U64(*(uint64*)(a + i));
uint64_t val;
std::memcpy(&val, a + i, sizeof(val));
result += (int)CV_POPCNT_U64(val);
}
# endif
for(; i <= n - 4; i += 4)
{
result += CV_POPCNT_U32(*(uint*)(a + i));
uint32_t val;
std::memcpy(&val, a + i, sizeof(val));
result += CV_POPCNT_U32(val);
}
}
#endif
@@ -92,12 +96,18 @@ int normHamming(const uchar* a, const uchar* b, int n)
# if defined CV_POPCNT_U64
for(; i <= n - 8; i += 8)
{
result += (int)CV_POPCNT_U64(*(uint64*)(a + i) ^ *(uint64*)(b + i));
uint64_t val_a, val_b;
std::memcpy(&val_a, a + i, sizeof(val_a));
std::memcpy(&val_b, b + i, sizeof(val_b));
result += (int)CV_POPCNT_U64(val_a ^ val_b);
}
# endif
for(; i <= n - 4; i += 4)
{
result += CV_POPCNT_U32(*(uint*)(a + i) ^ *(uint*)(b + i));
uint32_t val_a, val_b;
std::memcpy(&val_a, a + i, sizeof(val_a));
std::memcpy(&val_b, b + i, sizeof(val_b));
result += (int)CV_POPCNT_U32(val_a ^ val_b);
}
}
#endif