简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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