mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
Added a test for matrix-to-vector copy and convert.
This commit is contained in:
parent
4e4a7d0353
commit
5f8d8c0069
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user