1 | initial version |
@tomriddle, first, people that store Mat into string usually don't need md5 hashing and other stuff, they just want to convert Mat string and thats all. Second, mat2str will contain wrong information if your image is not continuous, i.e. it is part of bigger image. And third, posting here names of your own functions (str2md5) is not helping anyone (no one knows what is inside).
As for creating string from Mat you should use iterators:
string matAsString (src.begin<unsigned char>(), src.end<unsigned char>());
This way you will get all the relevant content of src even if it is not continuous.
Also I would recommend reading "Effective STL" by Scott Meyers. It will give you great understanding of what STL is, so the questions like "what is the correct way to fill string" will not even arise.
2 | No.2 Revision |
@tomriddle, first, people that store Mat into string usually don't need md5 hashing and other stuff, they just want to convert Mat string and thats all. Second, mat2str will contain wrong information if your image is not continuous, i.e. it is part of bigger image. And third, posting here names of your own functions (str2md5) is not helping anyone (no one knows what is inside).
As for For creating string from Mat you should use iterators:
string matAsString (src.begin<unsigned char>(), src.end<unsigned char>());
This way you will get all the relevant content of src even if it is not continuous.
Also I would recommend reading "Effective STL" by Scott Meyers. It will give you great understanding of what STL is, so the questions like "what is the correct way to fill string" will not even arise.