Kinect Depth Map rendering in Blender


Well, as we open the gateways to blender from MRL, it seemed like a pretty obvious leap to start trying to render point cloud data from the kinect via OpenNI in blender.  I had the kinect write out to a text file all the x,y,z points.  In a small python script in blender, I loaded that text file and rendered small circles for each point.  

Here's a very rough scan of my office with an InMoov on the desk.  The scan is pretty rough, but you can definitely see the depth data is there.  

Right now, it's super slow to render the cloud.  I down sample the data so it actually finishes rendering.  I'm sure there are other ways to render this data from python in blender.  


Here's the current blender script.  the "point_cloud.pcd" is a text file where each line represents an x y z point.  



import bpy
f = open("c:/dev/workspace.kmw/myrobotlab/point_cloud.pcd", "r")
sample = 100
for line in f:
  if (count % sample != 0):
  line = line.strip()
  line = line.split(" ")
  xScale = 0.1
  yScale = 0.1
  zScale = 0.01
  x = int(line[0]) * xScale
  y = int(line[1]) * yScale
  z = int(line[2]) * zScale
  if z > 1:
    # now create a new object at that point
    print( str(x) + " " + str(y) + " " + str(z) )
    circ = bpy.ops.mesh.primitive_circle_add(location=(x,y,z), radius=0.2)




Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
GroG's picture

Very Cool Kwatters ! Some

Very Cool Kwatters !

Some ideas :

  • Use the MRL Blender service to setup a TCP/IP connection to deliver this data.  Already binary serial data is moved, there's no reason why we cant ship binary object over these pipes.
  • Send the vertexes of the mesh only - depending on your reduction could be a very small amount of data.
  • Multiple frames + register vertex + movement of camera = SLAM
  • This was one of the more impressive SLAM algorithms for kinect
    Its seems pretty small footprint - possibly a relatively easy port of cpp


  • Saw this one recently - SURF SIFT usually important in key point registers.  Saw this very cool video too