unfortunately, there's no appropriate operator >> for cv::Mat, that's why reading back your txt-file fails.