1

I'm trying to use libfreenect2 in python 3.6 for getting the depth matrix of the Kinectv2. But there's an error. Take a look at the code.

import freenect2
import cv2

import numpy as np

"""
Grabs a depth map from the Kinect sensor and creates an image from it.
"""


def getDepthMap():

      depth, timestamp = freenect2.get_depth()

      np.clip(depth, 0, 2**10 - 1, depth)
      depth >>= 2
      depth = depth.astype(np.uint8)

      return depth

while True:
      depth = getDepthMap()

      blur = cv2.GaussianBlur(depth, (5, 5), 0)

      cv2.imshow('image', blur)
      cv2.waitKey(10)

Error - module 'freenect2' has no attribute 'get_depth'

Warlord
  • 33
  • 1
  • 6
  • Does output of `import freenect2` and then `dir(freenect2)` print on your Python shell include `get_depth`? – Ulas Keles Dec 26 '17 at 18:26
  • Yeah, I got this - `>>> dir(freenect2) ['__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__'] ` – Warlord Dec 27 '17 at 05:13

0 Answers0