目前使用 OpenCV3,但在 OpenCV2 中,有一种格式化矩阵输出的方法。它在教程中使用 here .
format函数好像从OpenCV2的format(mat, str)变成了OpenCV3的format(mat, int)。进行此调用:
cout << "4x4: " << endl << format(fourByFour, "python") << endl;
产生以下错误:
error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive]
/usr/local/include/opencv2/core/operations.hpp:371:16: note: initializing argument 2 of ‘cv::Ptr<cv::Formatted>cv::format(cv::InputArray, int)Ptr<Formatted> format(InputArray mtx, int fmt)
我可以插入整数以获得随机打印格式,但我假设在 OpenCV3 中,int fmt 是某种“CV_”宏,但我似乎无法在任何文档中找到它,也没有在 operations.hpp .
有人会碰巧知道 fmt 的正确值吗?
最佳答案
刚看了GitHub上的代码,看来你要找的常量是cv::Formatter::FMT_PYTHON
。可以看到代码here .
关于c++ - format() 中 int fmt 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30923051/