mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 14:13:15 +08:00
read/write vec2i from/to filestorage
This commit is contained in:
parent
b34272f8a2
commit
313f54bc39
@ -740,3 +740,28 @@ TEST(Core_InputOutput, filestorage_xml_base64)
|
|||||||
{
|
{
|
||||||
CV_Base64IOTest test("base64_test_tmp_file.xml"); test.safe_run();
|
CV_Base64IOTest test("base64_test_tmp_file.xml"); test.safe_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Core_InputOutput, filestorage_yml_vec2i)
|
||||||
|
{
|
||||||
|
const std::string file_name = "vec2i.yml";
|
||||||
|
cv::Vec2i vec(2, 1), ovec;
|
||||||
|
|
||||||
|
/* write */
|
||||||
|
{
|
||||||
|
cv::FileStorage fs(file_name, cv::FileStorage::WRITE);
|
||||||
|
fs << "prms0" << "{" << "vec0" << vec << "}";
|
||||||
|
fs.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* read */
|
||||||
|
{
|
||||||
|
cv::FileStorage fs(file_name, cv::FileStorage::READ);
|
||||||
|
fs["prms0"]["vec0"] >> ovec;
|
||||||
|
fs.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPECT_EQ(vec(0), ovec(0));
|
||||||
|
EXPECT_EQ(vec(1), ovec(1));
|
||||||
|
|
||||||
|
remove(file_name.c_str());
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user