我需要什么样的参数来为我发送这个函数

2024-04-27 00:27:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要什么样的参数来发送这个函数才能让它工作我有点傻

def TransformSmoothParameters(vPoint):
  """returns depthX (float), depthY (float), depthValue (int)"""

  if vPoint.vector.z > _FLT_EPSILON:

     # 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.
     #

     pfDepthX = 0.5 + vPoint.vector.x *   _NUI_CAMERA_SKELETON_TO_DEPTH_IMAGE_MULTIPLIER_320x240 / ( vPoint.vector.z * 320.0 )
     pfDepthY = 0.5 - vPoint.vector.y *   _NUI_CAMERA_SKELETON_TO_DEPTH_IMAGE_MULTIPLIER_320x240 / ( vPoint.vector.z * 240.0 )

     #
     #  Depth is in meters in skeleton space.
     #  The depth image pixel format has depth in millimeters shifted left by 3.
     #

     pusDepthValue = int(vPoint.vector.z * 1000) << 3
     return pfDepthX, pfDepthY, pusDepthValue

return 0.0, 0.0, 0

某种数组?会是什么样子?你知道吗


Tags: andinimageisspacefloatcameraskeleton
1条回答
网友
1楼 · 发布于 2024-04-27 00:27:49

似乎需要将对象传递给函数。然后该对象有一个名为vector(这是另一个对象)的数据属性,该数据属性有xyz

下面的伪代码可能更清楚:

    class vPoint:
        def __init__(self, vector):
            self.vector = vector

    class vector:
        def __init__(self, x, y, z):
            self.x = #the x value
            self.y = #the y value
            self.z = #the z value

例如,通过这种方式,可以使用代码中指定的vPoint.vector.x访问x值。你知道吗

相关问题 更多 >