# Path: blockplayer/calibkinect.py
# def recip_depth_openni(depth):
# def projection():
# def convertOpenNI2Real_weave(depth, u=None, v=None,
#                        mat=np.ascontiguousarray(
#                                 np.linalg.inv(projection()))):
# def convertOpenNI2Real_numpy(depth, u=None, v=None,
#                        mat=np.linalg.inv(projection())):
# def convertReal2OpenNI(X, Y, Z, mat=projection()):
#     N = np.prod(depth.shape)
#     X,Y = u,v
#     N = np.prod(depth.shape)
#     X,Y,Z = u,v, recip_depth_openni(depth)
# 
# Path: blockplayer/config.py
# def load(dir_path):
# def save(dir_path):
# LH = 0.0192
# LW = 0.016
# GRIDRAD = 18
# 
# Path: blockplayer/preprocess.py
# def threshold_and_mask(depth,bg):
#     def m_():
#     def m2_():
#     def m3_():


import numpy as np
import pylab
import opennpy
from blockplayer import calibkinect
from blockplayer import config
from blockplayer import preprocess
from blockplayer.visuals.pointwindow import PointWindow
        rgb_ = rgb.reshape(-1,3)

    #x = x[depth>0]
    #y = y[depth>0]
    #z = z[depth>0]
    xyz_ = np.ascontiguousarray(np.dstack((x,y,z)).reshape(-1,3))
    #xyz_ = xyz - xyz.mean(0)
    #xyz_ /= np.std(xyz_)

    rgba = np.empty((xyz_.shape[0],4),'f')
    rgba[:,3] = 1
    rgba[:,:3] = rgb_.astype('f')/256.0

    window.lookat = np.array([0,0,0])
    window.update_points(xyz_,rgba)
    window.clearcolor = [0,0,0,0]
    window.Refresh()
    pylab.waitforbuttonpress(0.005)


def go():
    config.load('data/newest_calibration')
    try:
        while 1:
            once()
    except KeyboardInterrupt:
        pass


if 'window' in globals():

# Path: blockplayer/calibkinect.py
# def recip_depth_openni(depth):
# def projection():
# def convertOpenNI2Real_weave(depth, u=None, v=None,
#                        mat=np.ascontiguousarray(
#                                 np.linalg.inv(projection()))):
# def convertOpenNI2Real_numpy(depth, u=None, v=None,
#                        mat=np.linalg.inv(projection())):
# def convertReal2OpenNI(X, Y, Z, mat=projection()):
#     N = np.prod(depth.shape)
#     X,Y = u,v
#     N = np.prod(depth.shape)
#     X,Y,Z = u,v, recip_depth_openni(depth)
# 
# Path: blockplayer/config.py
# def load(dir_path):
# def save(dir_path):
# LH = 0.0192
# LW = 0.016
# GRIDRAD = 18
# 
# Path: blockplayer/preprocess.py
# def threshold_and_mask(depth,bg):
#     def m_():
#     def m2_():
#     def m3_():


# Path: demos/demo_calib.py
import numpy as np
import pylab
import opennpy
from blockplayer import calibkinect
from blockplayer import config
from blockplayer import preprocess
from blockplayer.visuals.pointwindow import PointWindow

        rgb_ = rgb.reshape(-1,3)

    #x = x[depth>0]
    #y = y[depth>0]
    #z = z[depth>0]
    xyz_ = np.ascontiguousarray(np.dstack((x,y,z)).reshape(-1,3))
    #xyz_ = xyz - xyz.mean(0)
    #xyz_ /= np.std(xyz_)

    rgba = np.empty((xyz_.shape[0],4),'f')
    rgba[:,3] = 1
    rgba[:,:3] = rgb_.astype('f')/256.0

    window.lookat = np.array([0,0,0])
    window.update_points(xyz_,rgba)
    window.clearcolor = [0,0,0,0]
    window.Refresh()
    pylab.waitforbuttonpress(0.005)


def go():
    config.load('data/newest_calibration')
    try:
        while 1:
            once()
    except KeyboardInterrupt:
        pass


if 'window' in globals():

    window.Refresh()