diff --git a/tracker-native/src/win_main.cpp b/tracker-native/src/win_main.cpp index cd7bb6b..145af47 100644 --- a/tracker-native/src/win_main.cpp +++ b/tracker-native/src/win_main.cpp @@ -291,23 +291,22 @@ void WorkerLoop(bool image_mode, std::wstring symlink, int req_w, int req_h) { } last_seq = s; } - // Mirror horizontally at the source so the preview and the published - // depth/color/skeleton all read like a mirror (the mapper's own mirror is - // off; everything downstream sees mirror-space pixels). - for (int y = 0; y < h; ++y) { - uint32_t* row = reinterpret_cast(bgra.data()) + - static_cast(y) * w; - for (int xl = 0, xr = w - 1; xl < xr; ++xl, --xr) { - const uint32_t t = row[xl]; - row[xl] = row[xr]; - row[xr] = t; - } - } + // Mirror horizontally. Verified against real Kinect v1 recordings (UTKinect + // waveHands + MSR arm-waves): on a real Kinect the right hand reads as + // POSITIVE x relative to SHOULDER_CENTER (x in [-0.35,+0.86]). Running pose + // on the raw (un-mirrored) camera put our right hand at NEGATIVE x (our live + // log: [-0.5,0]) - the opposite handedness - which pinned the menu cursor. + // Mirroring the source makes the player's right hand land on the image right + // -> +x, matching real hardware, and also gives the natural selfie preview. rgb.resize(static_cast(w) * h * 3); - for (size_t i = 0; i < static_cast(w) * h; ++i) { - rgb[i * 3 + 0] = bgra[i * 4 + 2]; - rgb[i * 3 + 1] = bgra[i * 4 + 1]; - rgb[i * 3 + 2] = bgra[i * 4 + 0]; + for (int y = 0; y < h; ++y) { + for (int x = 0; x < w; ++x) { + const size_t src = (static_cast(y) * w + (w - 1 - x)) * 4; + const size_t dst = (static_cast(y) * w + x) * 3; + rgb[dst + 0] = bgra[src + 2]; + rgb[dst + 1] = bgra[src + 1]; + rgb[dst + 2] = bgra[src + 0]; + } } PoseResult pose = have_lock ? estimator.run(rgb.data(), w, h, roi)