An example demonstrating the serial out capabilities of cv::Mat
#include <iostream>
using namespace std;
using namespace cv;
static void help()
{
cout
<< "\n------------------------------------------------------------------\n"
<< " This program shows the serial out capabilities of cv::Mat\n"
<< "That is, cv::Mat M(...); cout << M; Now works.\n"
<< "Output can be formated to OpenCV, matlab, python, numpy, csv and \n"
<< "C styles Usage:\n"
<< "./cvout_sample\n"
<< "------------------------------------------------------------------\n\n"
<< endl;
}
{
help();
cout << "I = \n" << I << ";" << endl << endl;
randu(r, Scalar::all(0), Scalar::all(255));
cout << "r (default) = \n" << r << ";" << endl << endl;
cout <<
"r (matlab) = \n" <<
format(r, Formatter::FMT_MATLAB) <<
";" << endl << endl;
cout <<
"r (python) = \n" <<
format(r, Formatter::FMT_PYTHON) <<
";" << endl << endl;
cout <<
"r (numpy) = \n" <<
format(r, Formatter::FMT_NUMPY) <<
";" << endl << endl;
cout <<
"r (csv) = \n" <<
format(r, Formatter::FMT_CSV) <<
";" << endl << endl;
cout <<
"r (c) = \n" <<
format(r, Formatter::FMT_C) <<
";" << endl << endl;
cout << "p = " << p << ";" << endl;
cout << "p3f = " << p3f << ";" << endl;
vector<float> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
cout <<
"shortvec = " <<
Mat(v) << endl;
vector<Point2f> points(20);
for (
size_t i = 0;
i < points.size(); ++
i)
points[
i] =
Point2f((
float)(
i * 5), (
float)(
i % 7));
cout << "points = " << points << ";" << endl;
return 0;
}