mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #26590 from Kumataro:fix26589
Support C++20 standard #26590 Close https://github.com/opencv/opencv/issues/26589 Related https://github.com/opencv/opencv_contrib/pull/3842 Related: https://github.com/opencv/opencv/issues/20269 - do not arithmetic enums and ( different enums or floating numeric) - remove unused variable ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -219,7 +219,7 @@ replication border mode.
|
||||
@see cv::warpAffine
|
||||
*/
|
||||
CVAPI(void) cvWarpAffine( const CvArr* src, CvArr* dst, const CvMat* map_matrix,
|
||||
int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
|
||||
int flags CV_DEFAULT(+CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
|
||||
CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
|
||||
|
||||
/** @brief Computes affine transform matrix for mapping src[i] to dst[i] (i=0,1,2)
|
||||
@@ -239,7 +239,7 @@ CVAPI(CvMat*) cv2DRotationMatrix( CvPoint2D32f center, double angle,
|
||||
@see cv::warpPerspective
|
||||
*/
|
||||
CVAPI(void) cvWarpPerspective( const CvArr* src, CvArr* dst, const CvMat* map_matrix,
|
||||
int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
|
||||
int flags CV_DEFAULT(+CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
|
||||
CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
|
||||
|
||||
/** @brief Computes perspective transform matrix for mapping src[i] to dst[i] (i=0,1,2,3)
|
||||
@@ -254,7 +254,7 @@ CVAPI(CvMat*) cvGetPerspectiveTransform( const CvPoint2D32f* src,
|
||||
*/
|
||||
CVAPI(void) cvRemap( const CvArr* src, CvArr* dst,
|
||||
const CvArr* mapx, const CvArr* mapy,
|
||||
int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
|
||||
int flags CV_DEFAULT(+CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
|
||||
CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
|
||||
|
||||
/** @brief Converts mapx & mapy from floating-point to integer formats for cvRemap
|
||||
@@ -268,14 +268,14 @@ CVAPI(void) cvConvertMaps( const CvArr* mapx, const CvArr* mapy,
|
||||
*/
|
||||
CVAPI(void) cvLogPolar( const CvArr* src, CvArr* dst,
|
||||
CvPoint2D32f center, double M,
|
||||
int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
|
||||
int flags CV_DEFAULT(+CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
|
||||
|
||||
/** Performs forward or inverse linear-polar image transform
|
||||
@see cv::warpPolar
|
||||
*/
|
||||
CVAPI(void) cvLinearPolar( const CvArr* src, CvArr* dst,
|
||||
CvPoint2D32f center, double maxRadius,
|
||||
int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
|
||||
int flags CV_DEFAULT(+CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( pop )
|
||||
|
||||
@@ -1982,7 +1982,7 @@ struct RGB2Lab_f
|
||||
clipv(bvec0); clipv(bvec1);
|
||||
#undef clipv
|
||||
/* int iR = R*LAB_BASE, iG = G*LAB_BASE, iB = B*LAB_BASE, iL, ia, ib; */
|
||||
v_float32 basef = vx_setall_f32(LAB_BASE);
|
||||
v_float32 basef = vx_setall_f32(static_cast<float>(LAB_BASE));
|
||||
rvec0 = v_mul(rvec0, basef), gvec0 = v_mul(gvec0, basef), bvec0 = v_mul(bvec0, basef);
|
||||
rvec1 = v_mul(rvec1, basef), gvec1 = v_mul(gvec1, basef), bvec1 = v_mul(bvec1, basef);
|
||||
|
||||
@@ -2013,14 +2013,14 @@ struct RGB2Lab_f
|
||||
b_vec0 = v_cvt_f32(i_bvec0); b_vec1 = v_cvt_f32(i_bvec1);
|
||||
|
||||
/* dst[i] = L*100.0f */
|
||||
v_float32 v100dBase = vx_setall_f32(100.0f/LAB_BASE);
|
||||
v_float32 v100dBase = vx_setall_f32(100.0f / static_cast<float>(LAB_BASE));
|
||||
l_vec0 = v_mul(l_vec0, v100dBase);
|
||||
l_vec1 = v_mul(l_vec1, v100dBase);
|
||||
/*
|
||||
dst[i + 1] = a*256.0f - 128.0f;
|
||||
dst[i + 2] = b*256.0f - 128.0f;
|
||||
*/
|
||||
v_float32 v256dBase = vx_setall_f32(256.0f/LAB_BASE), vm128 = vx_setall_f32(-128.f);
|
||||
v_float32 v256dBase = vx_setall_f32(256.0f / static_cast<float>(LAB_BASE)), vm128 = vx_setall_f32(-128.f);
|
||||
a_vec0 = v_fma(a_vec0, v256dBase, vm128);
|
||||
a_vec1 = v_fma(a_vec1, v256dBase, vm128);
|
||||
b_vec0 = v_fma(b_vec0, v256dBase, vm128);
|
||||
@@ -2038,10 +2038,10 @@ struct RGB2Lab_f
|
||||
float G = clip(src[1]);
|
||||
float B = clip(src[bIdx^2]);
|
||||
|
||||
int iR = cvRound(R*LAB_BASE), iG = cvRound(G*LAB_BASE), iB = cvRound(B*LAB_BASE);
|
||||
int iR = cvRound(R*static_cast<float>(LAB_BASE)), iG = cvRound(G*static_cast<float>(LAB_BASE)), iB = cvRound(B*static_cast<float>(LAB_BASE));
|
||||
int iL, ia, ib;
|
||||
trilinearInterpolate(iR, iG, iB, LABLUVLUTs16.RGB2LabLUT_s16, iL, ia, ib);
|
||||
float L = iL*1.0f/LAB_BASE, a = ia*1.0f/LAB_BASE, b = ib*1.0f/LAB_BASE;
|
||||
float L = iL*1.0f/static_cast<float>(LAB_BASE), a = ia*1.0f/static_cast<float>(LAB_BASE), b = ib*1.0f/static_cast<float>(LAB_BASE);
|
||||
|
||||
dst[i] = L*100.0f;
|
||||
dst[i + 1] = a*256.0f - 128.0f;
|
||||
|
||||
@@ -43,7 +43,6 @@ using namespace cv;
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
enum { XY_SHIFT = 16, XY_ONE = 1 << XY_SHIFT, DRAWING_STORAGE_BLOCK = (1<<12) - 256 };
|
||||
|
||||
static const int MAX_THICKNESS = 32767;
|
||||
@@ -1027,8 +1026,8 @@ EllipseEx( Mat& img, Point2l center, Size2l axes,
|
||||
for (unsigned int i = 0; i < _v.size(); ++i)
|
||||
{
|
||||
Point2l pt;
|
||||
pt.x = (int64)cvRound(_v[i].x / XY_ONE) << XY_SHIFT;
|
||||
pt.y = (int64)cvRound(_v[i].y / XY_ONE) << XY_SHIFT;
|
||||
pt.x = (int64)cvRound(_v[i].x / static_cast<double>(XY_ONE)) << XY_SHIFT;
|
||||
pt.y = (int64)cvRound(_v[i].y / static_cast<double>(XY_ONE)) << XY_SHIFT;
|
||||
pt.x += cvRound(_v[i].x - pt.x);
|
||||
pt.y += cvRound(_v[i].y - pt.y);
|
||||
if (pt != prevPt) {
|
||||
@@ -1645,7 +1644,7 @@ static void
|
||||
ThickLine( Mat& img, Point2l p0, Point2l p1, const void* color,
|
||||
int thickness, int line_type, int flags, int shift )
|
||||
{
|
||||
static const double INV_XY_ONE = 1./XY_ONE;
|
||||
static const double INV_XY_ONE = 1./static_cast<double>(XY_ONE);
|
||||
|
||||
p0.x <<= XY_SHIFT - shift;
|
||||
p0.y <<= XY_SHIFT - shift;
|
||||
@@ -1981,8 +1980,8 @@ void ellipse(InputOutputArray _img, const RotatedRect& box, const Scalar& color,
|
||||
int _angle = cvRound(box.angle);
|
||||
Point2l center(cvRound(box.center.x),
|
||||
cvRound(box.center.y));
|
||||
center.x = (center.x << XY_SHIFT) + cvRound((box.center.x - center.x)*XY_ONE);
|
||||
center.y = (center.y << XY_SHIFT) + cvRound((box.center.y - center.y)*XY_ONE);
|
||||
center.x = (center.x << XY_SHIFT) + cvRound((box.center.x - center.x)*static_cast<float>(XY_ONE));
|
||||
center.y = (center.y << XY_SHIFT) + cvRound((box.center.y - center.y)*static_cast<float>(XY_ONE));
|
||||
Size2l axes(cvRound(box.size.width),
|
||||
cvRound(box.size.height));
|
||||
axes.width = (axes.width << (XY_SHIFT - 1)) + cvRound((box.size.width - axes.width)*(XY_ONE>>1));
|
||||
@@ -2303,7 +2302,7 @@ void putText( InputOutputArray _img, const String& text, Point org,
|
||||
scalarToRawData(color, buf, img.type(), 0);
|
||||
|
||||
int base_line = -(ascii[0] & 15);
|
||||
int hscale = cvRound(fontScale*XY_ONE), vscale = hscale;
|
||||
int hscale = cvRound(fontScale * static_cast<double>(XY_ONE)), vscale = hscale;
|
||||
|
||||
if( line_type == cv::LINE_AA && img.depth() != CV_8U )
|
||||
line_type = 8;
|
||||
|
||||
@@ -692,7 +692,11 @@ namespace
|
||||
getContourPoints(edges, dx, dy, points);
|
||||
|
||||
features.resize(levels_ + 1);
|
||||
std::for_each(features.begin(), features.end(), [=](std::vector<Feature>& e) { e.clear(); e.reserve(maxBufferSize_); });
|
||||
const size_t maxBufferSize = maxBufferSize_;
|
||||
std::for_each(features.begin(), features.end(), [maxBufferSize](std::vector<Feature>& e) {
|
||||
e.clear();
|
||||
e.reserve(maxBufferSize);
|
||||
});
|
||||
|
||||
for (size_t i = 0; i < points.size(); ++i)
|
||||
{
|
||||
|
||||
@@ -1283,7 +1283,7 @@ void cv::calcHist( InputArrayOfArrays images, const std::vector<int>& channels,
|
||||
CV_OCL_RUN(images.total() == 1 && channels.size() == 1 && images.channels(0) == 1 &&
|
||||
channels[0] == 0 && images.isUMatVector() && mask.empty() && !accumulate &&
|
||||
histSize.size() == 1 && histSize[0] == BINS && ranges.size() == 2 &&
|
||||
ranges[0] == 0 && ranges[1] == BINS,
|
||||
ranges[0] == 0 && ranges[1] == static_cast<float>(BINS),
|
||||
ocl_calcHist(images, hist))
|
||||
|
||||
int i, dims = (int)histSize.size(), rsz = (int)ranges.size(), csz = (int)channels.size();
|
||||
|
||||
@@ -1274,8 +1274,8 @@ public:
|
||||
#endif
|
||||
for( ; x1 < bcols; x1++ )
|
||||
{
|
||||
int sx = cvRound(sX[x1]*INTER_TAB_SIZE);
|
||||
int sy = cvRound(sY[x1]*INTER_TAB_SIZE);
|
||||
int sx = cvRound(sX[x1]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int sy = cvRound(sY[x1]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int v = (sy & (INTER_TAB_SIZE-1))*INTER_TAB_SIZE + (sx & (INTER_TAB_SIZE-1));
|
||||
XY[x1*2] = saturate_cast<short>(sx >> INTER_BITS);
|
||||
XY[x1*2+1] = saturate_cast<short>(sy >> INTER_BITS);
|
||||
@@ -1314,8 +1314,8 @@ public:
|
||||
|
||||
for( ; x1 < bcols; x1++ )
|
||||
{
|
||||
int sx = cvRound(sXY[x1*2]*INTER_TAB_SIZE);
|
||||
int sy = cvRound(sXY[x1*2+1]*INTER_TAB_SIZE);
|
||||
int sx = cvRound(sXY[x1*2]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int sy = cvRound(sXY[x1*2+1]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int v = (sy & (INTER_TAB_SIZE-1))*INTER_TAB_SIZE + (sx & (INTER_TAB_SIZE-1));
|
||||
XY[x1*2] = saturate_cast<short>(sx >> INTER_BITS);
|
||||
XY[x1*2+1] = saturate_cast<short>(sy >> INTER_BITS);
|
||||
@@ -1991,7 +1991,7 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
||||
bool useSSE4_1 = CV_CPU_HAS_SUPPORT_SSE4_1;
|
||||
#endif
|
||||
|
||||
const float scale = 1.f/INTER_TAB_SIZE;
|
||||
const float scale = 1.f/static_cast<float>(INTER_TAB_SIZE);
|
||||
int x, y;
|
||||
for( y = 0; y < size.height; y++ )
|
||||
{
|
||||
@@ -2071,8 +2071,8 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
||||
#endif
|
||||
for( ; x < size.width; x++ )
|
||||
{
|
||||
int ix = saturate_cast<int>(src1f[x]*INTER_TAB_SIZE);
|
||||
int iy = saturate_cast<int>(src2f[x]*INTER_TAB_SIZE);
|
||||
int ix = saturate_cast<int>(src1f[x]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int iy = saturate_cast<int>(src2f[x]*static_cast<float>(INTER_TAB_SIZE));
|
||||
dst1[x*2] = saturate_cast<short>(ix >> INTER_BITS);
|
||||
dst1[x*2+1] = saturate_cast<short>(iy >> INTER_BITS);
|
||||
dst2[x] = (ushort)((iy & (INTER_TAB_SIZE-1))*INTER_TAB_SIZE + (ix & (INTER_TAB_SIZE-1)));
|
||||
@@ -2117,8 +2117,8 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
||||
#endif
|
||||
for( ; x < size.width; x++ )
|
||||
{
|
||||
int ix = saturate_cast<int>(src1f[x*2]*INTER_TAB_SIZE);
|
||||
int iy = saturate_cast<int>(src1f[x*2+1]*INTER_TAB_SIZE);
|
||||
int ix = saturate_cast<int>(src1f[x*2]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int iy = saturate_cast<int>(src1f[x*2+1]*static_cast<float>(INTER_TAB_SIZE));
|
||||
dst1[x*2] = saturate_cast<short>(ix >> INTER_BITS);
|
||||
dst1[x*2+1] = saturate_cast<short>(iy >> INTER_BITS);
|
||||
dst2[x] = (ushort)((iy & (INTER_TAB_SIZE-1))*INTER_TAB_SIZE + (ix & (INTER_TAB_SIZE-1)));
|
||||
@@ -3143,7 +3143,7 @@ void WarpPerspectiveLine_Process_CV_SIMD(const double *M, short* xy, short* alph
|
||||
for( ; x1 < bw; x1++ )
|
||||
{
|
||||
double W = W0 + M[6]*x1;
|
||||
W = W ? INTER_TAB_SIZE/W : 0;
|
||||
W = W ? static_cast<double>(INTER_TAB_SIZE)/W : 0;
|
||||
double fX = std::max((double)INT_MIN, std::min((double)INT_MAX, (X0 + M[0]*x1)*W));
|
||||
double fY = std::max((double)INT_MIN, std::min((double)INT_MAX, (Y0 + M[3]*x1)*W));
|
||||
int X = saturate_cast<int>(fX);
|
||||
|
||||
@@ -132,8 +132,8 @@ void convertMaps_32f1c16s_SSE41(const float* src1f, const float* src2f, short* d
|
||||
}
|
||||
for (; x < width; x++)
|
||||
{
|
||||
int ix = saturate_cast<int>(src1f[x] * INTER_TAB_SIZE);
|
||||
int iy = saturate_cast<int>(src2f[x] * INTER_TAB_SIZE);
|
||||
int ix = saturate_cast<int>(src1f[x] * static_cast<float>(INTER_TAB_SIZE));
|
||||
int iy = saturate_cast<int>(src2f[x] * static_cast<float>(INTER_TAB_SIZE));
|
||||
dst1[x * 2] = saturate_cast<short>(ix >> INTER_BITS);
|
||||
dst1[x * 2 + 1] = saturate_cast<short>(iy >> INTER_BITS);
|
||||
dst2[x] = (ushort)((iy & (INTER_TAB_SIZE - 1))*INTER_TAB_SIZE + (ix & (INTER_TAB_SIZE - 1)));
|
||||
@@ -165,8 +165,8 @@ void convertMaps_32f2c16s_SSE41(const float* src1f, short* dst1, ushort* dst2, i
|
||||
}
|
||||
for (; x < width; x++)
|
||||
{
|
||||
int ix = saturate_cast<int>(src1f[x * 2] * INTER_TAB_SIZE);
|
||||
int iy = saturate_cast<int>(src1f[x * 2 + 1] * INTER_TAB_SIZE);
|
||||
int ix = saturate_cast<int>(src1f[x * 2] * static_cast<float>(INTER_TAB_SIZE));
|
||||
int iy = saturate_cast<int>(src1f[x * 2 + 1] * static_cast<float>(INTER_TAB_SIZE));
|
||||
dst1[x * 2] = saturate_cast<short>(ix >> INTER_BITS);
|
||||
dst1[x * 2 + 1] = saturate_cast<short>(iy >> INTER_BITS);
|
||||
dst2[x] = (ushort)((iy & (INTER_TAB_SIZE - 1))*INTER_TAB_SIZE + (ix & (INTER_TAB_SIZE - 1)));
|
||||
@@ -444,7 +444,7 @@ public:
|
||||
for (; x1 < bw; x1++)
|
||||
{
|
||||
double W = W0 + M[6] * x1;
|
||||
W = W ? INTER_TAB_SIZE / W : 0;
|
||||
W = W ? static_cast<double>(INTER_TAB_SIZE) / W : 0;
|
||||
double fX = std::max((double)INT_MIN, std::min((double)INT_MAX, (X0 + M[0] * x1)*W));
|
||||
double fY = std::max((double)INT_MIN, std::min((double)INT_MAX, (Y0 + M[3] * x1)*W));
|
||||
int X = saturate_cast<int>(fX);
|
||||
|
||||
@@ -1056,7 +1056,7 @@ static bool ipp_crossCorr(const Mat& src, const Mat& tpl, Mat& dst, bool normed)
|
||||
if (ippiCrossCorrNorm==0)
|
||||
return false;
|
||||
|
||||
IppEnum funCfg = (IppEnum)(ippAlgAuto | ippiROIValid);
|
||||
IppEnum funCfg = (IppEnum)(+ippAlgAuto | ippiROIValid);
|
||||
if(normed)
|
||||
funCfg |= ippiNorm;
|
||||
else
|
||||
@@ -1093,7 +1093,7 @@ static bool ipp_sqrDistance(const Mat& src, const Mat& tpl, Mat& dst)
|
||||
if (ippiSqrDistanceNorm==0)
|
||||
return false;
|
||||
|
||||
IppEnum funCfg = (IppEnum)(ippAlgAuto | ippiROIValid | ippiNormNone);
|
||||
IppEnum funCfg = (IppEnum)(+ippAlgAuto | ippiROIValid | ippiNormNone);
|
||||
status = ippiSqrDistanceNormGetBufferSize(srcRoiSize, tplRoiSize, funCfg, &bufSize);
|
||||
if ( status < 0 )
|
||||
return false;
|
||||
|
||||
@@ -1865,107 +1865,65 @@ TEST(Imgproc_PreCornerDetect, accuracy) { CV_PreCornerDetectTest test; test.safe
|
||||
TEST(Imgproc_Integral, accuracy) { CV_IntegralTest test; test.safe_run(); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
typedef std::pair<perf::MatDepth, perf::MatDepth> Imgproc_DepthAndDepth;
|
||||
typedef testing::TestWithParam< Imgproc_DepthAndDepth> Imgproc_FilterSupportedFormats;
|
||||
|
||||
class CV_FilterSupportedFormatsTest : public cvtest::BaseTest
|
||||
TEST_P(Imgproc_FilterSupportedFormats, normal)
|
||||
{
|
||||
public:
|
||||
CV_FilterSupportedFormatsTest() {}
|
||||
~CV_FilterSupportedFormatsTest() {}
|
||||
protected:
|
||||
void run(int)
|
||||
{
|
||||
const int depths[][2] =
|
||||
{
|
||||
{CV_8U, CV_8U},
|
||||
{CV_8U, CV_16U},
|
||||
{CV_8U, CV_16S},
|
||||
{CV_8U, CV_32F},
|
||||
{CV_8U, CV_64F},
|
||||
{CV_16U, CV_16U},
|
||||
{CV_16U, CV_32F},
|
||||
{CV_16U, CV_64F},
|
||||
{CV_16S, CV_16S},
|
||||
{CV_16S, CV_32F},
|
||||
{CV_16S, CV_64F},
|
||||
{CV_32F, CV_32F},
|
||||
{CV_64F, CV_64F},
|
||||
{-1, -1}
|
||||
};
|
||||
// use some "odd" size to do yet another smoke
|
||||
// testing of the non-SIMD loop tails
|
||||
Size sz(163, 117);
|
||||
Mat small_kernel(5, 5, CV_32F), big_kernel(21, 21, CV_32F);
|
||||
Mat kernelX(11, 1, CV_32F), kernelY(7, 1, CV_32F);
|
||||
Mat symkernelX(11, 1, CV_32F), symkernelY(7, 1, CV_32F);
|
||||
randu(small_kernel, -10, 10);
|
||||
randu(big_kernel, -1, 1);
|
||||
randu(kernelX, -1, 1);
|
||||
randu(kernelY, -1, 1);
|
||||
flip(kernelX, symkernelX, 0);
|
||||
symkernelX += kernelX;
|
||||
flip(kernelY, symkernelY, 0);
|
||||
symkernelY += kernelY;
|
||||
|
||||
int i = 0;
|
||||
volatile int fidx = -1;
|
||||
try
|
||||
{
|
||||
// use some "odd" size to do yet another smoke
|
||||
// testing of the non-SIMD loop tails
|
||||
Size sz(163, 117);
|
||||
Mat small_kernel(5, 5, CV_32F), big_kernel(21, 21, CV_32F);
|
||||
Mat kernelX(11, 1, CV_32F), kernelY(7, 1, CV_32F);
|
||||
Mat symkernelX(11, 1, CV_32F), symkernelY(7, 1, CV_32F);
|
||||
randu(small_kernel, -10, 10);
|
||||
randu(big_kernel, -1, 1);
|
||||
randu(kernelX, -1, 1);
|
||||
randu(kernelY, -1, 1);
|
||||
flip(kernelX, symkernelX, 0);
|
||||
symkernelX += kernelX;
|
||||
flip(kernelY, symkernelY, 0);
|
||||
symkernelY += kernelY;
|
||||
Mat elem_ellipse = getStructuringElement(MORPH_ELLIPSE, Size(7, 7));
|
||||
Mat elem_rect = getStructuringElement(MORPH_RECT, Size(7, 7));
|
||||
|
||||
Mat elem_ellipse = getStructuringElement(MORPH_ELLIPSE, Size(7, 7));
|
||||
Mat elem_rect = getStructuringElement(MORPH_RECT, Size(7, 7));
|
||||
int sdepth = std::get<0>(GetParam());
|
||||
int ddepth = std::get<1>(GetParam());
|
||||
Mat src(sz, CV_MAKETYPE(sdepth, 5)), dst;
|
||||
randu(src, 0, 100);
|
||||
// non-separable filtering with a small kernel
|
||||
EXPECT_NO_THROW(cv::filter2D(src, dst, ddepth, small_kernel));
|
||||
EXPECT_NO_THROW(cv::filter2D(src, dst, ddepth, big_kernel));
|
||||
EXPECT_NO_THROW(cv::sepFilter2D(src, dst, ddepth, kernelX, kernelY));
|
||||
EXPECT_NO_THROW(cv::sepFilter2D(src, dst, ddepth, symkernelX, symkernelY));
|
||||
EXPECT_NO_THROW(cv::Sobel(src, dst, ddepth, 2, 0, 5));
|
||||
EXPECT_NO_THROW(cv::Scharr(src, dst, ddepth, 0, 1));
|
||||
if( sdepth != ddepth )
|
||||
return;
|
||||
EXPECT_NO_THROW(cv::GaussianBlur(src, dst, Size(5, 5), 1.2, 1.2));
|
||||
EXPECT_NO_THROW(cv::blur(src, dst, Size(11, 11)));
|
||||
EXPECT_NO_THROW(cv::morphologyEx(src, dst, MORPH_GRADIENT, elem_ellipse));
|
||||
EXPECT_NO_THROW(cv::morphologyEx(src, dst, MORPH_GRADIENT, elem_rect));
|
||||
}
|
||||
|
||||
for( i = 0; depths[i][0] >= 0; i++ )
|
||||
{
|
||||
int sdepth = depths[i][0];
|
||||
int ddepth = depths[i][1];
|
||||
Mat src(sz, CV_MAKETYPE(sdepth, 5)), dst;
|
||||
randu(src, 0, 100);
|
||||
// non-separable filtering with a small kernel
|
||||
fidx = 0;
|
||||
cv::filter2D(src, dst, ddepth, small_kernel);
|
||||
fidx++;
|
||||
cv::filter2D(src, dst, ddepth, big_kernel);
|
||||
fidx++;
|
||||
cv::sepFilter2D(src, dst, ddepth, kernelX, kernelY);
|
||||
fidx++;
|
||||
cv::sepFilter2D(src, dst, ddepth, symkernelX, symkernelY);
|
||||
fidx++;
|
||||
cv::Sobel(src, dst, ddepth, 2, 0, 5);
|
||||
fidx++;
|
||||
cv::Scharr(src, dst, ddepth, 0, 1);
|
||||
if( sdepth != ddepth )
|
||||
continue;
|
||||
fidx++;
|
||||
cv::GaussianBlur(src, dst, Size(5, 5), 1.2, 1.2);
|
||||
fidx++;
|
||||
cv::blur(src, dst, Size(11, 11));
|
||||
fidx++;
|
||||
cv::morphologyEx(src, dst, MORPH_GRADIENT, elem_ellipse);
|
||||
fidx++;
|
||||
cv::morphologyEx(src, dst, MORPH_GRADIENT, elem_rect);
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
ts->printf(cvtest::TS::LOG, "Combination of depths %d => %d in %s is not supported (yet it should be)",
|
||||
depths[i][0], depths[i][1],
|
||||
fidx == 0 ? "filter2D (small kernel)" :
|
||||
fidx == 1 ? "filter2D (large kernel)" :
|
||||
fidx == 2 ? "sepFilter2D" :
|
||||
fidx == 3 ? "sepFilter2D (symmetrical/asymmetrical kernel)" :
|
||||
fidx == 4 ? "Sobel" :
|
||||
fidx == 5 ? "Scharr" :
|
||||
fidx == 6 ? "GaussianBlur" :
|
||||
fidx == 7 ? "blur" :
|
||||
fidx == 8 || fidx == 9 ? "morphologyEx" :
|
||||
"unknown???");
|
||||
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST(Imgproc_Filtering, supportedFormats) { CV_FilterSupportedFormatsTest test; test.safe_run(); }
|
||||
INSTANTIATE_TEST_CASE_P(/**/, Imgproc_FilterSupportedFormats,
|
||||
testing::Values(
|
||||
make_pair( CV_8U, CV_8U ),
|
||||
make_pair( CV_8U, CV_16U ),
|
||||
make_pair( CV_8U, CV_16S ),
|
||||
make_pair( CV_8U, CV_32F),
|
||||
make_pair( CV_8U, CV_64F),
|
||||
make_pair( CV_16U, CV_16U),
|
||||
make_pair( CV_16U, CV_32F),
|
||||
make_pair( CV_16U, CV_64F),
|
||||
make_pair( CV_16S, CV_16S),
|
||||
make_pair( CV_16S, CV_32F),
|
||||
make_pair( CV_16S, CV_64F),
|
||||
make_pair( CV_32F, CV_32F),
|
||||
make_pair( CV_64F, CV_64F)
|
||||
)
|
||||
);
|
||||
|
||||
TEST(Imgproc_Blur, borderTypes)
|
||||
{
|
||||
|
||||
@@ -282,7 +282,7 @@ void CV_ResizeTest::prepare_to_validation( int /*test_case_idx*/ )
|
||||
int elem_size = CV_ELEM_SIZE(src->type);
|
||||
int drows = dst->rows, dcols = dst->cols;
|
||||
|
||||
if( interpolation == CV_INTER_NN )
|
||||
if( interpolation == cv::INTER_NEAREST )
|
||||
{
|
||||
for( j = 0; j < dcols; j++ )
|
||||
{
|
||||
@@ -373,7 +373,7 @@ void CV_ResizeExactTest::get_test_array_types_and_sizes(int test_case_idx, vecto
|
||||
/////////////////////////
|
||||
|
||||
static void test_remap( const Mat& src, Mat& dst, const Mat& mapx, const Mat& mapy,
|
||||
Mat* mask=0, int interpolation=CV_INTER_LINEAR )
|
||||
Mat* mask=0, int interpolation=cv::INTER_LINEAR )
|
||||
{
|
||||
int x, y, k;
|
||||
int drows = dst.rows, dcols = dst.cols;
|
||||
@@ -384,7 +384,7 @@ static void test_remap( const Mat& src, Mat& dst, const Mat& mapx, const Mat& ma
|
||||
int step = (int)(src.step / CV_ELEM_SIZE(depth));
|
||||
int delta;
|
||||
|
||||
if( interpolation != CV_INTER_CUBIC )
|
||||
if( interpolation != cv::INTER_CUBIC )
|
||||
{
|
||||
delta = 0;
|
||||
scols -= 1; srows -= 1;
|
||||
@@ -762,7 +762,7 @@ void CV_RemapTest::get_test_array_types_and_sizes( int test_case_idx, vector<vec
|
||||
{
|
||||
CV_ImgWarpBaseTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
|
||||
types[INPUT][1] = types[INPUT][2] = CV_32FC1;
|
||||
interpolation = CV_INTER_LINEAR;
|
||||
interpolation = cv::INTER_LINEAR;
|
||||
}
|
||||
|
||||
|
||||
@@ -917,7 +917,7 @@ void CV_GetRectSubPixTest::get_test_array_types_and_sizes( int test_case_idx, ve
|
||||
|
||||
center.x = (float)(cvtest::randReal(rng)*src_size.width);
|
||||
center.y = (float)(cvtest::randReal(rng)*src_size.height);
|
||||
interpolation = CV_INTER_LINEAR;
|
||||
interpolation = cv::INTER_LINEAR;
|
||||
|
||||
test_cpp = (cvtest::randInt(rng) & 256) == 0;
|
||||
}
|
||||
@@ -1595,7 +1595,7 @@ TEST(Imgproc_Remap, DISABLED_memleak)
|
||||
putchar('.');
|
||||
fflush(stdout);
|
||||
}
|
||||
remap(src, dst, map_x, map_y, CV_INTER_LINEAR);
|
||||
remap(src, dst, map_x, map_y, cv::INTER_LINEAR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1617,11 +1617,11 @@ TEST(Imgproc_linearPolar, identity)
|
||||
{
|
||||
linearPolar(src, dst,
|
||||
Point2f((N-1) * 0.5f, (N-1) * 0.5f), N * 0.5f,
|
||||
cv::WARP_FILL_OUTLIERS | CV_INTER_LINEAR | cv::WARP_INVERSE_MAP);
|
||||
cv::WARP_FILL_OUTLIERS | cv::INTER_LINEAR | cv::WARP_INVERSE_MAP);
|
||||
|
||||
linearPolar(dst, src,
|
||||
Point2f((N-1) * 0.5f, (N-1) * 0.5f), N * 0.5f,
|
||||
cv::WARP_FILL_OUTLIERS | CV_INTER_LINEAR);
|
||||
cv::WARP_FILL_OUTLIERS | cv::INTER_LINEAR);
|
||||
|
||||
double psnr = cvtest::PSNR(in(roi), src(roi));
|
||||
EXPECT_LE(25, psnr) << "iteration=" << i;
|
||||
@@ -1658,11 +1658,11 @@ TEST(Imgproc_logPolar, identity)
|
||||
{
|
||||
logPolar(src, dst,
|
||||
Point2f((N-1) * 0.5f, (N-1) * 0.5f), M,
|
||||
cv::WARP_FILL_OUTLIERS | CV_INTER_LINEAR | cv::WARP_INVERSE_MAP);
|
||||
cv::WARP_FILL_OUTLIERS | cv::INTER_LINEAR | cv::WARP_INVERSE_MAP);
|
||||
|
||||
logPolar(dst, src,
|
||||
Point2f((N-1) * 0.5f, (N-1) * 0.5f), M,
|
||||
cv::WARP_FILL_OUTLIERS | CV_INTER_LINEAR);
|
||||
cv::WARP_FILL_OUTLIERS | cv::INTER_LINEAR);
|
||||
|
||||
double psnr = cvtest::PSNR(in(roi), src(roi));
|
||||
EXPECT_LE(25, psnr) << "iteration=" << i;
|
||||
@@ -1694,7 +1694,7 @@ TEST(Imgproc_warpPolar, identity)
|
||||
Rect roi = Rect(0, 0, in.cols - ((N + 19) / 20), in.rows);
|
||||
Point2f center = Point2f((N - 1) * 0.5f, (N - 1) * 0.5f);
|
||||
double radius = N * 0.5;
|
||||
int flags = cv::WARP_FILL_OUTLIERS | CV_INTER_LINEAR;
|
||||
int flags = cv::WARP_FILL_OUTLIERS | cv::INTER_LINEAR;
|
||||
// test linearPolar
|
||||
for (int ki = 1; ki <= 5; ki++)
|
||||
{
|
||||
|
||||
@@ -1269,7 +1269,7 @@ void CV_WarpPerspective_Test::warpPerspective(const Mat& _src, Mat& _dst)
|
||||
continue;
|
||||
}
|
||||
|
||||
den *= INTER_TAB_SIZE;
|
||||
den *= static_cast<double>(INTER_TAB_SIZE);
|
||||
int v0 = saturate_cast<int>((tM[0] * dx + tM[1] * dy + tM[2]) * den);
|
||||
int v1 = saturate_cast<int>((tM[3] * dx + tM[4] * dy + tM[5]) * den);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user