tuw_geometry.cpp
Go to the documentation of this file.
1 
3 #include <iomanip>
4 
5 using namespace tuw;
6 
7 std::map<DistributionType, std::string> DistributionTypeName =
8  {{NORMAL_DISTRIBUTION, "normal distribution"},
9  {UNIFORM_DISTRIBUTION, "uniform distribution"},
10  {GRID_DISTRIBUTION, "grid distribution"}};
11 
12 
13 std::string format(const cv::Mat_<int8_t> &m){
14  std::stringstream ss;
15  for (int r = 0; r < m.rows; r++) {
16  ss << (r==0?"[":" ");
17  for (int c = 0; c < m.cols; c++) {
18  ss << (c==0?"":", ") << std::setw(6) << m(r,c);
19  }
20  ss << (r<m.cols-1?";":"]") << std::endl;
21  }
22  return ss.str();
23 }
24 std::string format(const cv::Mat_<int> &m){
25  std::stringstream ss;
26  for (int r = 0; r < m.rows; r++) {
27  ss << (r==0?"[":" ");
28  for (int c = 0; c < m.cols; c++) {
29  ss << (c==0?"":", ") << std::setw(12) << m(r,c);
30  }
31  ss << (r<m.cols-1?";":"]") << std::endl;
32  }
33  return ss.str();
34 }
35 std::string format(const cv::Mat_<float> &m){
36  std::stringstream ss;
37  for (int r = 0; r < m.rows; r++) {
38  ss << std::setprecision(std::numeric_limits<float>::digits10 + 1);
39  ss << (r==0?"[":" ");
40  for (int c = 0; c < m.cols; c++) {
41  ss << (c==0?"":", ") << std::setw(12) << m(r,c);
42  }
43  ss << (r<m.cols-1?";":"]") << std::endl;
44  }
45  return ss.str();
46 }
47 std::string format(const cv::Mat_<double> &m){
48  std::stringstream ss;
49  for (int r = 0; r < m.rows; r++) {
50  ss << std::setprecision(std::numeric_limits<double>::digits10 + 1);
51  ss << (r==0?"[":" ");
52  for (int c = 0; c < m.cols; c++) {
53  ss << (c==0?"":", ") << std::setw(24) << m(r,c);
54  }
55  ss << (r<m.cols-1?";":"]") << std::endl;
56  }
57  return ss.str();
58 }
static std::map< DistributionType, std::string > DistributionTypeName
Definition: tuw_geometry.h:21
Definition: command.h:8
std::string format(const cv::Mat_< int8_t > &m)
Definition: utils.cpp:11


tuw_geometry
Author(s): Markus Bader
autogenerated on Mon Jun 10 2019 15:33:09