Example #1
0
def cubecalib_opencl():
    """Run the cube calibration, but then look at the points
    after running normals2_opencl"""
    table_calibration.finish_cube_calib('L')
    cXYZL = np.array(lattice.cXYZ)
    table_calibration.finish_cube_calib('R')
    cXYZR = np.array(lattice.cXYZ)
    cXYZ = np.hstack((cXYZL.reshape(3, -1), cXYZR.reshape(3, -1)))

    opencl.setup_kernel((config.bgL['KK'], config.bgL['Ktable']),
                        (config.bgR['KK'], config.bgR['Ktable']))

    opencl.compute_normals('LEFT')
    opencl.compute_normals('RIGHT')

    global modelmat
    modelmat = np.eye(4, dtype='f')
    modelmat[:3, :3] = flatrot.flatrot_opencl()
    modelmat = lattice.lattice2_opencl(modelmat)

    Xo, Yo, Zo, _ = np.rollaxis(opencl.get_xyz(), 1)
    cx, cy, cz = cXYZ

    cany = (cx > 0) | (cz > 0)
    R, G, B = cx[cany], cy[cany], cz[cany]
    update(Xo[cany], Yo[cany], Zo[cany], COLOR=(R, G, B, R + G + B))
    window.mode = 'ortho'
    window.clearcolor = [1, 1, 1, 0]
    window.Refresh()
Example #2
0
def cubecalib_opencl():
    """Run the cube calibration, but then look at the points
    after running normals2_opencl"""
    table_calibration.finish_cube_calib('L')
    cXYZL = np.array(lattice.cXYZ)
    table_calibration.finish_cube_calib('R')
    cXYZR = np.array(lattice.cXYZ)
    cXYZ = np.hstack((cXYZL.reshape(3,-1), cXYZR.reshape(3,-1)))

    opencl.setup_kernel((config.bgL['KK'],config.bgL['Ktable']),
                        (config.bgR['KK'],config.bgR['Ktable']))

    opencl.compute_normals('LEFT')
    opencl.compute_normals('RIGHT')

    global modelmat
    modelmat = np.eye(4,dtype='f')
    modelmat[:3,:3] = flatrot.flatrot_opencl()
    modelmat = lattice.lattice2_opencl(modelmat)

    Xo,Yo,Zo,_ = np.rollaxis(opencl.get_xyz(),1)
    cx,cy,cz = cXYZ

    cany = (cx>0)|(cz>0)
    R,G,B = cx[cany],cy[cany],cz[cany]
    update(Xo[cany],Yo[cany],Zo[cany],COLOR=(R,G,B,R+G+B))
    window.mode = 'ortho'
    window.clearcolor = [1,1,1,0]
    window.Refresh()
Example #3
0
def cubecalib():
    table_calibration.finish_cube_calib('L')
    XYZL = np.array(lattice.XYZ)
    cXYZL = np.array(lattice.cXYZ)

    table_calibration.finish_cube_calib('R')
    XYZR = np.array(lattice.XYZ)
    cXYZR = np.array(lattice.cXYZ)

    XYZ = np.hstack((XYZL.reshape(3, -1), XYZR.reshape(3, -1)))
    cXYZ = np.hstack((cXYZL.reshape(3, -1), cXYZR.reshape(3, -1)))

    Xo, Yo, Zo = XYZ
    cx, cy, cz = cXYZ

    cany = (cx > 0) | (cz > 0)
    R, G, B = cx[cany], cy[cany], cz[cany]
    update(Xo[cany], Yo[cany], Zo[cany], COLOR=(R, G, B, R + G + B))
    window.mode = 'ortho'
    window.clearcolor = [1, 1, 1, 0]
    window.Refresh()
Example #4
0
def cubecalib():
    table_calibration.finish_cube_calib('L')
    XYZL = np.array(lattice.XYZ)
    cXYZL = np.array(lattice.cXYZ)

    table_calibration.finish_cube_calib('R')
    XYZR = np.array(lattice.XYZ)
    cXYZR = np.array(lattice.cXYZ)

    XYZ = np.hstack((XYZL.reshape(3,-1), XYZR.reshape(3,-1)))
    cXYZ = np.hstack((cXYZL.reshape(3,-1), cXYZR.reshape(3,-1)))

    Xo,Yo,Zo = XYZ
    cx,cy,cz = cXYZ

    cany = (cx>0)|(cz>0)
    R,G,B = cx[cany],cy[cany],cz[cany]
    update(Xo[cany],Yo[cany],Zo[cany],COLOR=(R,G,B,R+G+B))
    window.mode = 'ortho'
    window.clearcolor = [1,1,1,0]
    window.Refresh()
Example #5
0
def run_calib():
    global ds
    ds = []

    try:
        shutil.rmtree(out_path)
    except:
        pass
    os.mkdir(out_path)

    for i in range(1):
        dataset.load_random_dataset()
        table_calibration.newest_folder = dataset.current_path

        name = 'dataset_%s' % str(i)
        d = dict(name=name)
        folder = os.path.join(out_path, name)
        os.mkdir(folder)

        dt = timeit.timeit(lambda: table_calibration.finish_cube_calib(),
                           number=1)
        d['dt'] = dt

        depthL, depthR = table_calibration.depthL, table_calibration.depthR
        bgL, bgR = config.bgL, config.bgR
        for depth, side, bg in (depthL, 'left', bgL), (depthR, 'right', bgR):
            pylab.figure(0)
            pylab.clf()
            pylab.imshow(depth)
            pylab.savefig(os.path.join(folder, 'depth_%s.jpg' % side))

            pylab.clf()
            pylab.imshow(bg['bgHi'])
            pylab.savefig(os.path.join(folder, 'bghi_%s.jpg' % side))

            pylab.imshow(bg['bgLo'])
            pylab.savefig(os.path.join(folder, 'bglo_%s.jpg' % side))

        ds.append(d)
Example #6
0
def run_calib():
    global ds
    ds = []

    try:
        shutil.rmtree(out_path)
    except:
        pass
    os.mkdir(out_path)

    for i in range(1):
        dataset.load_random_dataset()
        table_calibration.newest_folder = dataset.current_path

        name = "dataset_%s" % str(i)
        d = dict(name=name)
        folder = os.path.join(out_path, name)
        os.mkdir(folder)

        dt = timeit.timeit(lambda: table_calibration.finish_cube_calib(), number=1)
        d["dt"] = dt

        depthL, depthR = table_calibration.depthL, table_calibration.depthR
        bgL, bgR = config.bgL, config.bgR
        for depth, side, bg in (depthL, "left", bgL), (depthR, "right", bgR):
            pylab.figure(0)
            pylab.clf()
            pylab.imshow(depth)
            pylab.savefig(os.path.join(folder, "depth_%s.jpg" % side))

            pylab.clf()
            pylab.imshow(bg["bgHi"])
            pylab.savefig(os.path.join(folder, "bghi_%s.jpg" % side))

            pylab.imshow(bg["bgLo"])
            pylab.savefig(os.path.join(folder, "bglo_%s.jpg" % side))

        ds.append(d)