OpenCV 2.1: where is ostream operator<< for cv::Mat?

c++, opencv

Solution

Update to OpenCV 2.2 (or higher) and `#include <opencv2/opencv.hpp>`

It's defined at `modules/core/include/opencv2/core/operations.hpp`

Problem

Following this question, I am attempting to print out the contents of a `cv::Mat` to standard output: ``` #include <iostream> #include <opencv/cv.h> #include <opencv/cv.hpp> #include <opencv/cxcore.h> #include <opencv/cxcore.hpp> int main() { cv::Mat m = cv::Mat::ones(10, 10, CV_32S); std::cout << m << "\n"; } ``` This results in the error ``` error: no match for ‘operator<<’ in ‘std::cout << m’ ``` I am using gcc 4.6.1 on Ubuntu 11.10, and installed opencv, excluding the examples, following these instructions. My question is, is the operator available in 2.1 and if so, how do I get it?

Original source

Related problems