def test_skeleton_frame(self): skel_data = ctypes.ARRAY(SkeletonData, NUI_SKELETON_COUNT)() sd = SkeletonData() sd.user_index = 5 skel_data[0] = sd tests = [('timestamp', 'liTimeStamp', 1), ('frame_number', 'dwFrameNumber', 2), ('quality', 'Quality', SkeletonFrameQuality.camera_motion), ('floor_clip_plane', 'vFloorClipPlane', Vector(2,4,6,8)), ('normal_to_gravity', 'vNormalToGravity', Vector(1,2,3,4)), ('skeleton_data', 'SkeletonData', skel_data), ] self.interop_prop_test(SkeletonFrame(), tests)
def depth_image_to_skeleton(fDepthX, fDepthY, usDepthValue): """returns Vector4""" ## ## Depth is in meters in skeleton space. ## The depth image pixel format has depth in millimeters shifted left by 3. ## fSkeletonZ = (usDepthValue >> 3) / 1000.0 ## ## Center of depth sensor is at (0,0,0) in skeleton space, and ## and (160,120) in depth image coordinates. Note that positive Y ## is up in skeleton space and down in image coordinates. ## fSkeletonX = (fDepthX - 0.5) * (_NUI_CAMERA_DEPTH_IMAGE_TO_SKELETON_MULTIPLIER_320x240 * fSkeletonZ) * 320.0 fSkeletonY = (0.5 - fDepthY) * (_NUI_CAMERA_DEPTH_IMAGE_TO_SKELETON_MULTIPLIER_320x240 * fSkeletonZ) * 240.0 ## ## Return the result as a vector. ## v4 = Vector() v4.x = fSkeletonX v4.y = fSkeletonY v4.z = fSkeletonZ v4.w = 1.0 return v4
def create_vector_midpoint(one, two): mid = Vector() mid.x = (one.x + two.x)/2 mid.y = (one.y + two.y)/2 mid.z = one.z mid.w = one.w return mid
def test_skeleton_data(self): pos_arr = ctypes.ARRAY(Vector, JointId.count.value)() pos_arr[0] = Vector(2,4,6,8) joint_arr = ctypes.ARRAY(JointTrackingState, JointId.count.value)() joint_arr[0] = JointTrackingState.inferred tests = [('tracking_state', 'eTrackingState', SkeletonTrackingState.tracked), ('tracking_id', 'dwTrackingID', 1), ('enrollment_index', 'dwEnrollmentIndex', 1), ('user_index', 'dwUserIndex', 1), ('position', 'Position', Vector(1, 2, 3, 4)), ('skeleton_positions', 'SkeletonPositions', pos_arr), ('skeleton_position_tracking_states', 'eSkeletonPositionTrackingState', joint_arr), ('skeleton_quality', 'Quality', SkeletonQuality.clipped_bottom), ] self.interop_prop_test(SkeletonData(), tests)