MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / flipHorizontal

Function flipHorizontal

src/cpu_depth_packet_processor.cpp:240–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238 */
239template<typename ScalarT>
240void 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
261namespace libfreenect2
262{

Callers 1

Calls 4

copyToMethod · 0.80
sizeInBytesMethod · 0.80
heightMethod · 0.80
bufferMethod · 0.80

Tested by

no test coverage detected