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

Merge pull request #9818 from tz70s:issue#9570

This commit is contained in:
Alexander Alekhin
2017-10-11 15:19:17 +00:00
2 changed files with 48 additions and 0 deletions
+20
View File
@@ -1804,4 +1804,24 @@ TEST(Mat_, from_initializer_list)
ASSERT_DOUBLE_EQ(norm(A, B, NORM_INF), 0.);
}
TEST(Mat, template_based_ptr)
{
Mat mat = (Mat_<float>(2, 2) << 11.0f, 22.0f, 33.0f, 44.0f);
int idx[2] = {1, 0};
ASSERT_FLOAT_EQ(33.0f, *(mat.ptr<float>(idx)));
idx[0] = 1;
idx[1] = 1;
ASSERT_FLOAT_EQ(44.0f, *(mat.ptr<float>(idx)));
}
TEST(Mat_, template_based_ptr)
{
int dim[4] = {2, 2, 1, 2};
Mat_<float> mat = (Mat_<float>(4, dim) << 11.0f, 22.0f, 33.0f, 44.0f,
55.0f, 66.0f, 77.0f, 88.0f);
int idx[4] = {1, 0, 0, 1};
ASSERT_FLOAT_EQ(66.0f, *(mat.ptr<float>(idx)));
}
#endif