The values of int fmt in format()

379 views Asked by At

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?

1

There are 1 answers

0
Lukáš Lalinský On BEST ANSWER

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.