简体   繁体   English

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

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

what kind of parameters do i need to send this function for it to work i'm a bit of a noob 我需要发送什么样的参数才能使其正常工作我有点菜鸟

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

some kind of an array? 某种数组? what would it look like? 它会是什么样子?

It seems like you need to pass an object to the function. 似乎您需要将一个对象传递给该函数。 The object then has a data attribute called vector (which is another object) which has data attributes x , y and z 然后,该对象具有一个称为vector的数据属性(这是另一个对象),其数据属性为xyz

The pseudocode below might make it more clear: 下面的伪代码可能使它更清晰:

    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

This way, for instance, you can access the x value using vPoint.vector.x as specified in your code. 例如,通过这种方式,您可以使用vPoint.vector.x中指定的vPoint.vector.x访问x值。

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

相关问题 我需要测试功能的哪些方面? - What aspects of a function do I need to test? 我需要在这里使用什么功能? - What function do I need to use here? 我需要哪种对象才能使用fix_multiple_files的options参数? - What kind of object do I need to use the options parameter of fix_multiple_files? 我应该使用什么样的参数来查找和裁剪图像中的对象? - What kind of parameters should I use to find and crop objects in an image? Python:我如何找到/检查 function 接受哪种 arguments? - Python: How do I find / inspect what kind of arguments a function accepts? 我需要对 views.py 中的函数做什么? - What do I need to do to a function in views.py works? 我需要什么样的算法来计算一个等于数字的名字? - What kind of algorithm would I need to compute a name that equals a number? 我需要哪种设置(IDE等)才能运行C#.NET开发的程序集的IronPython单元测试? - What kind of setup (IDE et al) do I need to run IronPython unit tests of C#.NET developed assemblies? 我将哪些参数传递给 Scala 中的“过滤器”function - What parameters do I pass to 'filter' function in Scala 我们如何将文件从 django 发送到 reactjs 我不需要 RESTFRame 工作? - how do we send file from django to reactjs where i dont need RESTFRame work?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM