| 113 | |
| 114 | |
| 115 | static void writeMat(std::ostream& out, const Mat& m, char rowsep, char elembrace, bool singleLine) |
| 116 | { |
| 117 | CV_Assert(m.dims <= 2); |
| 118 | int type = m.type(); |
| 119 | |
| 120 | char crowbrace = getCloseBrace(rowsep); |
| 121 | char orowbrace = crowbrace ? rowsep : '\0'; |
| 122 | |
| 123 | if( orowbrace || isspace(rowsep) ) |
| 124 | rowsep = '\0'; |
| 125 | |
| 126 | for( int i = 0; i < m.rows; i++ ) |
| 127 | { |
| 128 | if(orowbrace) |
| 129 | out << orowbrace; |
| 130 | if( m.data ) |
| 131 | writeElems(out, m.ptr(i), m.cols, type, elembrace); |
| 132 | if(orowbrace) |
| 133 | out << crowbrace << (i+1 < m.rows ? ", " : ""); |
| 134 | if(i+1 < m.rows) |
| 135 | { |
| 136 | if(rowsep) |
| 137 | out << rowsep << (singleLine ? " " : ""); |
| 138 | if(!singleLine) |
| 139 | out << "\n "; |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | class MatlabFormatter : public Formatter |
| 145 | { |
no test coverage detected