def once(): global depth, rgb if not FOR_REAL: dataset.advance() depth = dataset.depth rgb = dataset.rgb else: opennpy.sync_update() depth,_ = opennpy.sync_get_depth() rgb,_ = opennpy.sync_get_video() main.update_frame(depth, rgb) blockdraw.clear() if 'RGB' in stencil.__dict__: blockdraw.show_grid('occ', grid.occ, color=grid.color) else: blockdraw.show_grid('occ', grid.occ, color=np.array([1,0.6,0.6,1])) window.clearcolor=[0,0,0,0] window.flag_drawgrid = True if 'R_correct' in main.__dict__: window.modelmat = main.R_display g = blockcraft.translated_rotated(main.R_correct, grid.occ) talk_to_minecraft(g) window.Refresh() pylab.waitforbuttonpress(0.005) import sys sys.stdout.flush()
def once(): global depth, rgb if not FOR_REAL: dataset.advance() depth = dataset.depth rgb = dataset.rgb else: opennpy.sync_update() depth, _ = opennpy.sync_get_depth() rgb, _ = opennpy.sync_get_video() main.update_frame(depth, rgb) blockdraw.clear() if 'RGB' in stencil.__dict__: blockdraw.show_grid('occ', grid.occ, color=grid.color) else: blockdraw.show_grid('occ', grid.occ, color=np.array([1, 0.6, 0.6, 1])) window.clearcolor = [0, 0, 0, 0] window.flag_drawgrid = True if 'R_correct' in main.__dict__: window.modelmat = main.R_display g = blockcraft.translated_rotated(main.R_correct, grid.occ) talk_to_minecraft(g) window.Refresh() pylab.waitforbuttonpress(0.005) import sys sys.stdout.flush()
def show_rotated(): g = main.grid.occ #g = blockcraft.centered_rotated(main.R_correct, g) g = blockcraft.translated_rotated(main.R_correct, g) marginal = g.sum(1).astype('u1')*255 cv.NamedWindow('scale_test', 0) cv.ShowImage('scale_test', marginal) cv.ResizeWindow('scale_test', 300, 300)
def show_rotated(): g = main.grid.occ #g = blockcraft.centered_rotated(main.R_correct, g) g = blockcraft.translated_rotated(main.R_correct, g) marginal = g.sum(1).astype('u1') * 255 cv.NamedWindow('scale_test', 0) cv.ShowImage('scale_test', cv.fromarray(marginal)) cv.ResizeWindow('scale_test', 300, 300)
def block_once(self): """Process the next blockplayer frame""" opennpy.sync_update() depth,_ = opennpy.sync_get_depth() rgb,_ = opennpy.sync_get_video() main.update_frame(depth, rgb) # Update the blocks in the playing area if self.state < Game.STATE_CHECKWALL and self.update_blocks: self.blocks = main.grid.occ if hasattr(main, 'R_correct'): self.blocks = blockcraft.translated_rotated(main.R_correct, self.blocks) self.blocks = self.block_slice(self.blocks) self.board.update_blocks(self.blocks, remove=self.board.wall_abs-Board.BOARD_BORDER > Board.PLAY_WIDTH)