| 238 | */ |
| 239 | template<typename ScalarT> |
| 240 | void flipHorizontal(const Mat<ScalarT> &in, Mat<ScalarT>& out) |
| 241 | { |
| 242 | in.copyTo(out); |
| 243 | |
| 244 | typedef unsigned char type; |
| 245 | |
| 246 | int linestep = out.sizeInBytes() / out.height() / sizeof(type); |
| 247 | |
| 248 | type *first_line = reinterpret_cast<type *>(out.buffer()), *last_line = reinterpret_cast<type *>(out.buffer()) + (out.height() - 1) * linestep; |
| 249 | |
| 250 | |
| 251 | for(int y = 0; y < out.height() / 2; ++y) |
| 252 | { |
| 253 | for(int x = 0; x < linestep; ++x, ++first_line, ++last_line) |
| 254 | { |
| 255 | std::swap(*first_line, *last_line); |
| 256 | } |
| 257 | last_line -= 2 * linestep; |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | namespace libfreenect2 |
| 262 | { |
no test coverage detected