fix(tracker): restore source mirror - real Kinect data (UTKinect/MSR) shows right hand is +x rel shoulder-center; our un-mirrored build had it -x (flipped), pinning the menu cursor
This commit is contained in:
1 parent
9bf156ccb8
commit
91c4e82ea6
1 file changed
+15
-16
@@ -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<uint32_t*>(bgra.data()) +
|
||||
static_cast<size_t>(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<size_t>(w) * h * 3);
|
||||
for (size_t i = 0; i < static_cast<size_t>(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<size_t>(y) * w + (w - 1 - x)) * 4;
|
||||
const size_t dst = (static_cast<size_t>(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)
|
||||
|
||||
Reference in new issue
Block a user