Merge remote-tracking branch 'origin/2.4' into merge-2.4
Conflicts: cmake/OpenCVModule.cmake doc/tutorials/calib3d/camera_calibration/camera_calibration.rst doc/tutorials/features2d/feature_detection/feature_detection.rst doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.rst doc/tutorials/features2d/feature_homography/feature_homography.rst modules/core/include/opencv2/core/operations.hpp modules/core/src/arithm.cpp modules/gpu/perf/perf_video.cpp modules/imgproc/include/opencv2/imgproc/imgproc.hpp modules/java/generator/gen_java.py modules/java/generator/src/cpp/VideoCapture.cpp modules/nonfree/src/opencl/surf.cl modules/ocl/include/opencv2/ocl/ocl.hpp modules/ocl/perf/perf_haar.cpp modules/ocl/perf/perf_precomp.hpp modules/ocl/src/color.cpp modules/ocl/src/filtering.cpp modules/ocl/test/test_color.cpp modules/ocl/test/test_objdetect.cpp modules/python/src2/cv2.cpp samples/gpu/CMakeLists.txt samples/gpu/super_resolution.cpp
This commit is contained in:
@@ -1131,23 +1131,33 @@ static void binary_op(InputArray _src1, InputArray _src2, OutputArray _dst,
|
||||
}
|
||||
}
|
||||
|
||||
static BinaryFunc maxTab[] =
|
||||
static BinaryFunc* getMaxTab()
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(max8u), (BinaryFunc)GET_OPTIMIZED(max8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(max16u), (BinaryFunc)GET_OPTIMIZED(max16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(max32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(max32f), (BinaryFunc)max64f,
|
||||
0
|
||||
};
|
||||
static BinaryFunc maxTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(max8u), (BinaryFunc)GET_OPTIMIZED(max8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(max16u), (BinaryFunc)GET_OPTIMIZED(max16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(max32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(max32f), (BinaryFunc)max64f,
|
||||
0
|
||||
};
|
||||
|
||||
static BinaryFunc minTab[] =
|
||||
return maxTab;
|
||||
}
|
||||
|
||||
static BinaryFunc* getMinTab()
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(min8u), (BinaryFunc)GET_OPTIMIZED(min8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(min16u), (BinaryFunc)GET_OPTIMIZED(min16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(min32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(min32f), (BinaryFunc)min64f,
|
||||
0
|
||||
};
|
||||
static BinaryFunc minTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(min8u), (BinaryFunc)GET_OPTIMIZED(min8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(min16u), (BinaryFunc)GET_OPTIMIZED(min16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(min32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(min32f), (BinaryFunc)min64f,
|
||||
0
|
||||
};
|
||||
|
||||
return minTab;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1177,24 +1187,24 @@ void cv::bitwise_not(InputArray a, OutputArray c, InputArray mask)
|
||||
|
||||
void cv::max( InputArray src1, InputArray src2, OutputArray dst )
|
||||
{
|
||||
binary_op(src1, src2, dst, noArray(), maxTab, false );
|
||||
binary_op(src1, src2, dst, noArray(), getMaxTab(), false );
|
||||
}
|
||||
|
||||
void cv::min( InputArray src1, InputArray src2, OutputArray dst )
|
||||
{
|
||||
binary_op(src1, src2, dst, noArray(), minTab, false );
|
||||
binary_op(src1, src2, dst, noArray(), getMinTab(), false );
|
||||
}
|
||||
|
||||
void cv::max(const Mat& src1, const Mat& src2, Mat& dst)
|
||||
{
|
||||
OutputArray _dst(dst);
|
||||
binary_op(src1, src2, _dst, noArray(), maxTab, false );
|
||||
binary_op(src1, src2, _dst, noArray(), getMaxTab(), false );
|
||||
}
|
||||
|
||||
void cv::min(const Mat& src1, const Mat& src2, Mat& dst)
|
||||
{
|
||||
OutputArray _dst(dst);
|
||||
binary_op(src1, src2, _dst, noArray(), minTab, false );
|
||||
binary_op(src1, src2, _dst, noArray(), getMinTab(), false );
|
||||
}
|
||||
|
||||
|
||||
@@ -1482,39 +1492,54 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
|
||||
}
|
||||
}
|
||||
|
||||
static BinaryFunc addTab[] =
|
||||
static BinaryFunc* getAddTab()
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(add8u), (BinaryFunc)GET_OPTIMIZED(add8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(add16u), (BinaryFunc)GET_OPTIMIZED(add16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(add32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(add32f), (BinaryFunc)add64f,
|
||||
0
|
||||
};
|
||||
static BinaryFunc addTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(add8u), (BinaryFunc)GET_OPTIMIZED(add8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(add16u), (BinaryFunc)GET_OPTIMIZED(add16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(add32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(add32f), (BinaryFunc)add64f,
|
||||
0
|
||||
};
|
||||
|
||||
static BinaryFunc subTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(sub8u), (BinaryFunc)GET_OPTIMIZED(sub8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(sub16u), (BinaryFunc)GET_OPTIMIZED(sub16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(sub32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(sub32f), (BinaryFunc)sub64f,
|
||||
0
|
||||
};
|
||||
return addTab;
|
||||
}
|
||||
|
||||
static BinaryFunc absdiffTab[] =
|
||||
static BinaryFunc* getSubTab()
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff8u), (BinaryFunc)GET_OPTIMIZED(absdiff8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff16u), (BinaryFunc)GET_OPTIMIZED(absdiff16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff32f), (BinaryFunc)absdiff64f,
|
||||
0
|
||||
};
|
||||
static BinaryFunc subTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(sub8u), (BinaryFunc)GET_OPTIMIZED(sub8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(sub16u), (BinaryFunc)GET_OPTIMIZED(sub16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(sub32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(sub32f), (BinaryFunc)sub64f,
|
||||
0
|
||||
};
|
||||
|
||||
return subTab;
|
||||
}
|
||||
|
||||
static BinaryFunc* getAbsDiffTab()
|
||||
{
|
||||
static BinaryFunc absDiffTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff8u), (BinaryFunc)GET_OPTIMIZED(absdiff8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff16u), (BinaryFunc)GET_OPTIMIZED(absdiff16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff32f), (BinaryFunc)absdiff64f,
|
||||
0
|
||||
};
|
||||
|
||||
return absDiffTab;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void cv::add( InputArray src1, InputArray src2, OutputArray dst,
|
||||
InputArray mask, int dtype )
|
||||
{
|
||||
arithm_op(src1, src2, dst, mask, dtype, addTab );
|
||||
arithm_op(src1, src2, dst, mask, dtype, getAddTab() );
|
||||
}
|
||||
|
||||
void cv::subtract( InputArray src1, InputArray src2, OutputArray dst,
|
||||
@@ -1549,12 +1574,12 @@ void cv::subtract( InputArray src1, InputArray src2, OutputArray dst,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
arithm_op(src1, src2, dst, mask, dtype, subTab );
|
||||
arithm_op(src1, src2, dst, mask, dtype, getSubTab() );
|
||||
}
|
||||
|
||||
void cv::absdiff( InputArray src1, InputArray src2, OutputArray dst )
|
||||
{
|
||||
arithm_op(src1, src2, dst, noArray(), -1, absdiffTab);
|
||||
arithm_op(src1, src2, dst, noArray(), -1, getAbsDiffTab());
|
||||
}
|
||||
|
||||
/****************************************************************************************\
|
||||
@@ -1844,46 +1869,60 @@ static void recip64f( const double* src1, size_t step1, const double* src2, size
|
||||
}
|
||||
|
||||
|
||||
static BinaryFunc mulTab[] =
|
||||
static BinaryFunc* getMulTab()
|
||||
{
|
||||
(BinaryFunc)mul8u, (BinaryFunc)mul8s, (BinaryFunc)mul16u,
|
||||
(BinaryFunc)mul16s, (BinaryFunc)mul32s, (BinaryFunc)mul32f,
|
||||
(BinaryFunc)mul64f, 0
|
||||
};
|
||||
static BinaryFunc mulTab[] =
|
||||
{
|
||||
(BinaryFunc)mul8u, (BinaryFunc)mul8s, (BinaryFunc)mul16u,
|
||||
(BinaryFunc)mul16s, (BinaryFunc)mul32s, (BinaryFunc)mul32f,
|
||||
(BinaryFunc)mul64f, 0
|
||||
};
|
||||
|
||||
static BinaryFunc divTab[] =
|
||||
return mulTab;
|
||||
}
|
||||
|
||||
static BinaryFunc* getDivTab()
|
||||
{
|
||||
(BinaryFunc)div8u, (BinaryFunc)div8s, (BinaryFunc)div16u,
|
||||
(BinaryFunc)div16s, (BinaryFunc)div32s, (BinaryFunc)div32f,
|
||||
(BinaryFunc)div64f, 0
|
||||
};
|
||||
static BinaryFunc divTab[] =
|
||||
{
|
||||
(BinaryFunc)div8u, (BinaryFunc)div8s, (BinaryFunc)div16u,
|
||||
(BinaryFunc)div16s, (BinaryFunc)div32s, (BinaryFunc)div32f,
|
||||
(BinaryFunc)div64f, 0
|
||||
};
|
||||
|
||||
static BinaryFunc recipTab[] =
|
||||
return divTab;
|
||||
}
|
||||
|
||||
static BinaryFunc* getRecipTab()
|
||||
{
|
||||
(BinaryFunc)recip8u, (BinaryFunc)recip8s, (BinaryFunc)recip16u,
|
||||
(BinaryFunc)recip16s, (BinaryFunc)recip32s, (BinaryFunc)recip32f,
|
||||
(BinaryFunc)recip64f, 0
|
||||
};
|
||||
static BinaryFunc recipTab[] =
|
||||
{
|
||||
(BinaryFunc)recip8u, (BinaryFunc)recip8s, (BinaryFunc)recip16u,
|
||||
(BinaryFunc)recip16s, (BinaryFunc)recip32s, (BinaryFunc)recip32f,
|
||||
(BinaryFunc)recip64f, 0
|
||||
};
|
||||
|
||||
return recipTab;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void cv::multiply(InputArray src1, InputArray src2,
|
||||
OutputArray dst, double scale, int dtype)
|
||||
{
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, mulTab, true, &scale);
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, getMulTab(), true, &scale);
|
||||
}
|
||||
|
||||
void cv::divide(InputArray src1, InputArray src2,
|
||||
OutputArray dst, double scale, int dtype)
|
||||
{
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, divTab, true, &scale);
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, getDivTab(), true, &scale);
|
||||
}
|
||||
|
||||
void cv::divide(double scale, InputArray src2,
|
||||
OutputArray dst, int dtype)
|
||||
{
|
||||
arithm_op(src2, src2, dst, noArray(), dtype, recipTab, true, &scale);
|
||||
arithm_op(src2, src2, dst, noArray(), dtype, getRecipTab(), true, &scale);
|
||||
}
|
||||
|
||||
/****************************************************************************************\
|
||||
@@ -2026,12 +2065,17 @@ static void addWeighted64f( const double* src1, size_t step1, const double* src2
|
||||
addWeighted_<double, double>(src1, step1, src2, step2, dst, step, sz, scalars);
|
||||
}
|
||||
|
||||
static BinaryFunc addWeightedTab[] =
|
||||
static BinaryFunc* getAddWeightedTab()
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(addWeighted8u), (BinaryFunc)GET_OPTIMIZED(addWeighted8s), (BinaryFunc)GET_OPTIMIZED(addWeighted16u),
|
||||
(BinaryFunc)GET_OPTIMIZED(addWeighted16s), (BinaryFunc)GET_OPTIMIZED(addWeighted32s), (BinaryFunc)addWeighted32f,
|
||||
(BinaryFunc)addWeighted64f, 0
|
||||
};
|
||||
static BinaryFunc addWeightedTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(addWeighted8u), (BinaryFunc)GET_OPTIMIZED(addWeighted8s), (BinaryFunc)GET_OPTIMIZED(addWeighted16u),
|
||||
(BinaryFunc)GET_OPTIMIZED(addWeighted16s), (BinaryFunc)GET_OPTIMIZED(addWeighted32s), (BinaryFunc)addWeighted32f,
|
||||
(BinaryFunc)addWeighted64f, 0
|
||||
};
|
||||
|
||||
return addWeightedTab;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2039,7 +2083,7 @@ void cv::addWeighted( InputArray src1, double alpha, InputArray src2,
|
||||
double beta, double gamma, OutputArray dst, int dtype )
|
||||
{
|
||||
double scalars[] = {alpha, beta, gamma};
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, addWeightedTab, true, scalars);
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, getAddWeightedTab(), true, scalars);
|
||||
}
|
||||
|
||||
|
||||
@@ -2299,15 +2343,19 @@ static void cmp64f(const double* src1, size_t step1, const double* src2, size_t
|
||||
cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
||||
}
|
||||
|
||||
static BinaryFunc cmpTab[] =
|
||||
static BinaryFunc getCmpFunc(int depth)
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp8u), (BinaryFunc)GET_OPTIMIZED(cmp8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp16u), (BinaryFunc)GET_OPTIMIZED(cmp16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp32f), (BinaryFunc)cmp64f,
|
||||
0
|
||||
};
|
||||
static BinaryFunc cmpTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp8u), (BinaryFunc)GET_OPTIMIZED(cmp8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp16u), (BinaryFunc)GET_OPTIMIZED(cmp16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp32f), (BinaryFunc)cmp64f,
|
||||
0
|
||||
};
|
||||
|
||||
return cmpTab[depth];
|
||||
}
|
||||
|
||||
static double getMinVal(int depth)
|
||||
{
|
||||
@@ -2337,7 +2385,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
|
||||
_dst.create(src1.size(), CV_8UC(cn));
|
||||
Mat dst = _dst.getMat();
|
||||
Size sz = getContinuousSize(src1, src2, dst, src1.channels());
|
||||
cmpTab[src1.depth()](src1.data, src1.step, src2.data, src2.step, dst.data, dst.step, sz, &op);
|
||||
getCmpFunc(src1.depth())(src1.data, src1.step, src2.data, src2.step, dst.data, dst.step, sz, &op);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2369,7 +2417,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
|
||||
|
||||
size_t esz = src1.elemSize();
|
||||
size_t blocksize0 = (size_t)(BLOCK_SIZE + esz-1)/esz;
|
||||
BinaryFunc func = cmpTab[depth1];
|
||||
BinaryFunc func = getCmpFunc(depth1);
|
||||
|
||||
if( !haveScalar )
|
||||
{
|
||||
@@ -2546,12 +2594,17 @@ static void inRangeReduce(const uchar* src, uchar* dst, size_t len, int cn)
|
||||
typedef void (*InRangeFunc)( const uchar* src1, size_t step1, const uchar* src2, size_t step2,
|
||||
const uchar* src3, size_t step3, uchar* dst, size_t step, Size sz );
|
||||
|
||||
static InRangeFunc inRangeTab[] =
|
||||
static InRangeFunc getInRangeFunc(int depth)
|
||||
{
|
||||
(InRangeFunc)GET_OPTIMIZED(inRange8u), (InRangeFunc)GET_OPTIMIZED(inRange8s), (InRangeFunc)GET_OPTIMIZED(inRange16u),
|
||||
(InRangeFunc)GET_OPTIMIZED(inRange16s), (InRangeFunc)GET_OPTIMIZED(inRange32s), (InRangeFunc)GET_OPTIMIZED(inRange32f),
|
||||
(InRangeFunc)inRange64f, 0
|
||||
};
|
||||
static InRangeFunc inRangeTab[] =
|
||||
{
|
||||
(InRangeFunc)GET_OPTIMIZED(inRange8u), (InRangeFunc)GET_OPTIMIZED(inRange8s), (InRangeFunc)GET_OPTIMIZED(inRange16u),
|
||||
(InRangeFunc)GET_OPTIMIZED(inRange16s), (InRangeFunc)GET_OPTIMIZED(inRange32s), (InRangeFunc)GET_OPTIMIZED(inRange32f),
|
||||
(InRangeFunc)inRange64f, 0
|
||||
};
|
||||
|
||||
return inRangeTab[depth];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2590,7 +2643,7 @@ void cv::inRange(InputArray _src, InputArray _lowerb,
|
||||
|
||||
_dst.create(src.dims, src.size, CV_8U);
|
||||
Mat dst = _dst.getMat();
|
||||
InRangeFunc func = inRangeTab[depth];
|
||||
InRangeFunc func = getInRangeFunc(depth);
|
||||
|
||||
const Mat* arrays_sc[] = { &src, &dst, 0 };
|
||||
const Mat* arrays_nosc[] = { &src, &dst, &lb, &ub, 0 };
|
||||
|
Reference in New Issue
Block a user