I have printed a cv::Mat
object to a file using std::ofstream
simply by writing ofs << mat;
. When I try to do the same with std::ifstream
, I get the following error:
binary '>>': no operator found which takes a left-hand operand of type 'std::ifstream' (or there is no acceptable conversion)
I know that overloading operators are possible and useful in many cases, like printing std::vector
.
How can I overload operator >>
such that it reads cv::Mat
from an std::ifstream
object like ifs >> mat
?
Example result from std::cout << mat
:
[253, 104;
287, 222;
282, 225;
283, 225]