![]() ![]() Void serializeMat(const string& filename, Mat& mat) įwrite(/*buffer*/ sizeImg, /*howmanyelements*/ 4, /* size of each element */ sizeof(int), /*file*/ FP) įwrite(mat.data, mat.cols * mat. Use the equivalent text_xarchive instead if you require multi-platform-compatibility of the saved files. This can be done easily in OpenCV by creating a cv::Mat object from the array and displaying that: include // Assume arr has 1-channel 2D uchar data int width int height unsigned char arr // Create Mat object from array. The Mat function takes four parameters namely rows, columns, data type and.![]() Note that, by default (using binary_xarchive), the files are not platform-independant. To check the contents of the array, it is sometimes useful to display it as if it were a 2D image. serializeMat() saves to a binary file and deserializeMat() loads from the same file. There's a great/easy answer on stackoverflow, which I make use of in the below snippet. I know this is an old question, but I had to do this recently. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |