Currently using OpenCV3, but in OpenCV2, there was a way to format matrix outputs. It is used in a tutorial here.
The format function seems to have changed from format(mat, str) in OpenCV2 to format(mat, int) OpenCV3. Making this call:
cout << "4x4: " << endl << format(fourByFour, "python") << endl;
yields the following error:
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)
I can plug in ints to get random printing formats, but I assume that in OpenCV3, the int fmt is meant to be some sort of "CV_" macro, but I can't seem to find that in any documentation, nor in operations.hpp.
Would anyone happen to know the proper values for fmt?
Just looked at the code on GitHub, and it seems that the constant you are looking for is
cv::Formatter::FMT_PYTHON
. You can see the code here.