mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Merge branch 4.x
This commit is contained in:
@@ -1037,6 +1037,14 @@ static void flip(const Mat& src, Mat& dst, int flipcode)
|
||||
}
|
||||
}
|
||||
|
||||
static void flip_inplace(Mat& dst, int flipcode)
|
||||
{
|
||||
Mat m;
|
||||
m.create(dst.size(), dst.type());
|
||||
reference::flip(dst, m, flipcode);
|
||||
memcpy(dst.ptr<uchar>(), m.ptr<uchar>(), dst.total() * dst.elemSize());
|
||||
}
|
||||
|
||||
static void rotate(const Mat& src, Mat& dst, int rotateMode)
|
||||
{
|
||||
Mat tmp;
|
||||
@@ -1103,6 +1111,36 @@ struct FlipOp : public BaseElemWiseOp
|
||||
int flipcode;
|
||||
};
|
||||
|
||||
struct FlipInplaceOp : public BaseElemWiseOp
|
||||
{
|
||||
FlipInplaceOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) { flipcode = 0; }
|
||||
void getRandomSize(RNG& rng, vector<int>& size)
|
||||
{
|
||||
cvtest::randomSize(rng, 2, 2, ARITHM_MAX_SIZE_LOG, size);
|
||||
}
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat&)
|
||||
{
|
||||
dst.create(src[0].size(), src[0].type());
|
||||
memcpy(dst.ptr<uchar>(), src[0].ptr<uchar>(), src[0].total() * src[0].elemSize());
|
||||
cv::flip(dst, dst, flipcode);
|
||||
}
|
||||
void refop(const vector<Mat>& src, Mat& dst, const Mat&)
|
||||
{
|
||||
dst.create(src[0].size(), src[0].type());
|
||||
memcpy(dst.ptr<uchar>(), src[0].ptr<uchar>(), src[0].total() * src[0].elemSize());
|
||||
reference::flip_inplace(dst, flipcode);
|
||||
}
|
||||
void generateScalars(int, RNG& rng)
|
||||
{
|
||||
flipcode = rng.uniform(0, 3) - 1;
|
||||
}
|
||||
double getMaxErr(int)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int flipcode;
|
||||
};
|
||||
|
||||
struct RotateOp : public BaseElemWiseOp
|
||||
{
|
||||
RotateOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) { rotatecode = 0; }
|
||||
@@ -1789,6 +1827,7 @@ INSTANTIATE_TEST_CASE_P(Core_InRange, ElemWiseTest, ::testing::Values(ElemWiseOp
|
||||
INSTANTIATE_TEST_CASE_P(Core_FiniteMask, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new FiniteMaskOp)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Core_Flip, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new FlipOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_FlipInplace, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new FlipInplaceOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Rotate, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new RotateOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Transpose, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new TransposeOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_SetIdentity, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new SetIdentityOp)));
|
||||
|
||||
Reference in New Issue
Block a user