繁体   English   中英

我需要什么样的参数才能发送此功能才能正常工作

[英]what kind of parameters do i need to send this function for it to work

我需要发送什么样的参数才能使其正常工作我有点菜鸟

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

某种数组? 它会是什么样子?

似乎您需要将一个对象传递给该函数。 然后,该对象具有一个称为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中指定的vPoint.vector.x访问x值。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM