Added a test for matrix-to-vector copy and convert.

This commit is contained in:
Roman Donchenko 2014-01-17 14:18:31 +04:00
parent 4e4a7d0353
commit 5f8d8c0069

View File

@ -897,3 +897,24 @@ TEST(Core_Mat, reshape_1942)
);
ASSERT_EQ(1, cn);
}
TEST(Core_Mat, copyNx1ToVector)
{
cv::Mat_<uchar> src(5, 1);
cv::Mat_<uchar> ref_dst8;
cv::Mat_<ushort> ref_dst16;
std::vector<uchar> dst8;
std::vector<ushort> dst16;
src << 1, 2, 3, 4, 5;
src.copyTo(ref_dst8);
src.copyTo(dst8);
ASSERT_PRED_FORMAT2(cvtest::MatComparator(0, 0), ref_dst8, cv::Mat_<uchar>(dst8));
src.convertTo(ref_dst16, CV_16U);
src.convertTo(dst16, CV_16U);
ASSERT_PRED_FORMAT2(cvtest::MatComparator(0, 0), ref_dst16, cv::Mat_<ushort>(dst16));
}