OpenCV 2.1:ostream运算符在哪里?对于cv :: Mat? [英] OpenCV 2.1: where is ostream operator<< for cv::Mat?

查看:102
本文介绍了OpenCV 2.1:ostream运算符在哪里?对于cv :: Mat?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下这个问题 ,我尝试将cv::Mat的内容打印到标准输出:

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";

}

这会导致错误

error: no match for ‘operator<<’ in ‘std::cout << m’

我在Ubuntu 11.10上使用gcc 4.6.1,并在说明.我的问题是,运算符是否在2.1中可用,如果可以,如何获取它?

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?

推荐答案

更新到OpenCV 2.2(或更高版本)和#include <opencv2/opencv.hpp>

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

定义在modules/core/include/opencv2/core/operations.hpp

这篇关于OpenCV 2.1:ostream运算符在哪里?对于cv :: Mat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆