public static Vec2 JointPostoDepthPos(Vec3 JointPos, DepthInfo depthInfo) { if (depthInfo.EnableCoordinate == false) { return(new Vec2(0, 0)); } double depthX = (JointPos.x / JointPos.z - depthInfo.JointDepthXFix) * depthInfo.JointDepthXMult; double depthY = (JointPos.y / JointPos.z - depthInfo.JointDepthYFix) * depthInfo.JointDepthYMult; if (depthX > 1) { depthX = 1; } else if (depthX < -1) { depthX = -1; } if (depthY > 1) { depthY = 1; } else if (depthY < -1) { depthY = -1; } depthX += 1; depthY += 1; return(new Vec2((int)(depthX * depthInfo.Width / 2), (int)(depthInfo.Height - (depthY * depthInfo.Width / 2)))); }
internal NuiSensor(NUIApp nuiApp, string name, string company, int id, SensorState state, int colorFrameWidth, int colorFrameHeight, int colorbpp, int depthFrameWidth, int depthFrameHeight, int depthbpp, int maxTrackingbody) { this.nuiApp = nuiApp; this.name = name; this.company = company; this.id = id; this._state = state; bool EnableCoordinate = false; double JointDepthXMult = 0; double JointDepthXFix = 0; double JointDepthYMult = 0; double JointDepthYFix = 0; double DepthToJointZMult = 0; //나중엔 uID 로 처리하던가 해야함. switch (name) { case "Kinect": EnableCoordinate = true; JointDepthXMult = 1.85; JointDepthXFix = 0; JointDepthYMult = 1.9; JointDepthYFix = 0.13; DepthToJointZMult = 0.00123; break; case "Kinect2": EnableCoordinate = true; JointDepthXMult = 1.5; JointDepthXFix = 0; JointDepthYMult = 1.45; JointDepthYFix = 0.085; DepthToJointZMult = 0.00107; break; } ColorInfo = new ColorInfo(colorFrameWidth, colorFrameHeight, colorbpp); if (EnableCoordinate) { DepthInfo = new DepthInfo(depthFrameWidth, depthFrameHeight, short.MinValue, short.MaxValue, depthbpp, EnableCoordinate, JointDepthXMult, JointDepthXFix, JointDepthYMult, JointDepthYFix, DepthToJointZMult); } else { DepthInfo = new DepthInfo(depthFrameWidth, depthFrameHeight, short.MinValue, short.MaxValue, depthbpp); } BodyInfo = new BodyInfo(maxTrackingbody); }
internal DepthData(ushort[] data, DepthInfo info) { this.FrameData = data; this.Description = info; }