1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2024-09-10 10:15:22 +03:00
26 changed files with 237 additions and 204 deletions
+41
View File
@@ -1049,6 +1049,13 @@ void cv::add( InputArray src1, InputArray src2, OutputArray dst,
{
CV_INSTRUMENT_REGION();
CV_Assert(src1.empty() == src2.empty());
if (src1.empty() && src2.empty())
{
dst.release();
return;
}
arithm_op(src1, src2, dst, mask, dtype, getAddTab(), false, 0, OCL_OP_ADD );
}
@@ -1057,6 +1064,13 @@ void cv::subtract( InputArray _src1, InputArray _src2, OutputArray _dst,
{
CV_INSTRUMENT_REGION();
CV_Assert(_src1.empty() == _src2.empty());
if (_src1.empty() && _src2.empty())
{
_dst.release();
return;
}
ExtendedTypeFunc subExtFunc = getSubExtFunc(_src1.depth(), _src2.depth(), dtype < 0 ? _dst.depth() : dtype);
arithm_op(_src1, _src2, _dst, mask, dtype, getSubTab(), false, 0, OCL_OP_SUB,
/* extendedFunc */ subExtFunc);
@@ -1066,6 +1080,13 @@ void cv::absdiff( InputArray src1, InputArray src2, OutputArray dst )
{
CV_INSTRUMENT_REGION();
CV_Assert(src1.empty() == src2.empty());
if (src1.empty() && src2.empty())
{
dst.release();
return;
}
arithm_op(src1, src2, dst, noArray(), -1, getAbsDiffTab(), false, 0, OCL_OP_ABSDIFF);
}
@@ -1186,6 +1207,13 @@ void divide(InputArray src1, InputArray src2,
{
CV_INSTRUMENT_REGION();
CV_Assert(src1.empty() == src2.empty());
if (src1.empty() && src2.empty())
{
dst.release();
return;
}
arithm_op(src1, src2, dst, noArray(), dtype, getDivTab(), true, &scale, OCL_OP_DIV_SCALE);
}
@@ -1194,6 +1222,12 @@ void divide(double scale, InputArray src2,
{
CV_INSTRUMENT_REGION();
if (src2.empty())
{
dst.release();
return;
}
arithm_op(src2, src2, dst, noArray(), dtype, getRecipTab(), true, &scale, OCL_OP_RECIP_SCALE);
}
@@ -1236,6 +1270,13 @@ void cv::addWeighted( InputArray src1, double alpha, InputArray src2,
{
CV_INSTRUMENT_REGION();
CV_Assert(src1.empty() == src2.empty());
if (src1.empty() && src2.empty())
{
dst.release();
return;
}
double scalars[] = {alpha, beta, gamma};
arithm_op(src1, src2, dst, noArray(), dtype, getAddWeightedTab(), true, scalars, OCL_OP_ADDW);
}
+4 -2
View File
@@ -21,6 +21,8 @@ static MinMaxIdxFunc getMinMaxIdxFunc(int depth)
CV_CPU_DISPATCH_MODES_ALL);
}
// The function expects 1-based indexing for ofs
// Zero is treated as invalid offset (not found)
static void ofs2idx(const Mat& a, size_t ofs, int* idx)
{
int i, d = a.dims;
@@ -324,9 +326,9 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
{
// minIdx[0] and minIdx[0] are always 0 for "flatten" version
if (minIdx)
ofs2idx(src, minIdx[1], minIdx);
ofs2idx(src, minIdx[1]+1, minIdx);
if (maxIdx)
ofs2idx(src, maxIdx[1], maxIdx);
ofs2idx(src, maxIdx[1]+1, maxIdx);
return;
}
else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED)