- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I've got a problem with my slightly modified HandsViewer example. I want to get the X, Y, and Z data of the hands center point. I could successfully get the X and Y data but the Z data just returns zero. Regardless of weather I use positionWorld or positionImage. On top of that I also cannot get speed, localRotation or globalOrientation. Not that I need the information, I was just trying to figure what is wrong. Am I missing an initialization somewhere?
Thanks in advance.
public void DisplayJoints(PXCMHandData.JointData[][] nodes, int numOfHands) { if (bitmap == null) return; if (nodes == null) return; if (Joints.Checked || Skeleton.Checked) { lock (this) { int scaleFactor = 1; Graphics g = Graphics.FromImage(bitmap); using (Pen boneColor = new Pen(Color.DodgerBlue, 3.0f)) { for (int i = 0; i < numOfHands; i++) { if (nodes[0] == null) continue; int baseX = (int) nodes[0].positionImage.x/scaleFactor; int baseY = (int) nodes[0].positionImage.y/scaleFactor; int wristX = (int) nodes[0].positionImage.x/scaleFactor; int wristY = (int) nodes[0].positionImage.y/scaleFactor; if (Skeleton.Checked) { for (int j = 1; j < 22; j++) { if (nodes== null) continue; int x = (int) nodes .positionImage.x/scaleFactor; int y = (int) nodes .positionImage.y/scaleFactor; if (nodes .confidence <= 0) continue; if (j == 2 || j == 6 || j == 10 || j == 14 || j == 18) { baseX = wristX; baseY = wristY; } g.DrawLine(boneColor, new Point(baseX, baseY), new Point(x, y)); baseX = x; baseY = y; } } if (Joints.Checked) { using ( Pen red = new Pen(Color.Red, 3.0f), black = new Pen(Color.Black, 3.0f), green = new Pen(Color.Green, 3.0f), blue = new Pen(Color.Blue, 3.0f), cyan = new Pen(Color.Cyan, 3.0f), yellow = new Pen(Color.Yellow, 3.0f), orange = new Pen(Color.Orange, 3.0f)) { Pen currnetPen = black; for (int j = 0; j < PXCMHandData.NUMBER_OF_JOINTS; j++) { float sz = 4; int x = (int) nodes .positionImage.x/scaleFactor; int y = (int) nodes .positionImage.y/scaleFactor; int testz = (int)nodes .positionWorld.z; if (nodes .confidence <= 0) continue; //Wrist if (j == 0) { currnetPen = black; } //Center if (j == 1) { currnetPen = red; sz += 5; UpdateInfo("X Pos: " + x.ToString() + ", Y Pos: " + y.ToString() + ", Depth: " + testz.ToString() + Environment.NewLine, System.Drawing.Color.Black); // Here is where I print the data } //Thumb if (j == 2 || j == 3 || j == 4 || j == 5) { currnetPen = green; } //Index Finger if (j == 6 || j == 7 || j == 8 || j == 9) { currnetPen = blue; } //Finger if (j == 10 || j == 11 || j == 12 || j == 13) { currnetPen = yellow; } //Ring Finger if (j == 14 || j == 15 || j == 16 || j == 17) { currnetPen = cyan; } //Pinkey if (j == 18 || j == 19 || j == 20 || j == 21) { currnetPen = orange; } if (j == 5 || j == 9 || j == 13 || j == 17 || j == 21) { sz += 4; //currnetPen.Width = 1; } g.DrawEllipse(currnetPen, x - sz/2, y - sz/2, sz, sz); } } } } } g.Dispose(); } } }
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you have the image location in pixels, you should be able to get XYZ by using the projection methods of the API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you can get positionWorld, speed, localRotation, globalOrientation if you use typedata float. about value positionImage.z always zero. because image not have depth. so return value always zero.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page