def _make_screenshot_and_save(self): w, h = 2048, int(2048 * self._camera.aspect) logger.info('Making screenshot... ({}x{})'.format(w, h)) renderer = ImageRenderer(self._gl_executor) color, depth = yield from renderer.render(self.scene, self._camera, (w, h)) filename = 'screenshot' next_id = 2 while Path(filename).exists(): filename = 'screenshot{}'.format(next_id) next_id += 1 color_name, depth_name = filename + '.png', filename + '_depth.png' logger.info('Saving screenshot to {}, {}...'.format( color_name, depth_name)) yield from self._io_async_executor.map(cv2.imwrite, color_name, np.uint8(color)) yield from self._io_async_executor.map( cv2.imwrite, depth_name, np.uint8(255 * (depth - depth.min()) / (depth.max() - depth.min()))) yield from renderer.release()
def _make_screenshot_and_save(self): w, h = 2048, int(2048 * self._camera.aspect) logger.info('Making screenshot... ({}x{})'.format(w, h)) renderer = ImageRenderer(self._gl_executor) color, depth = yield from renderer.render(self.scene, self._camera, (w, h)) filename = 'screenshot' next_id = 2 while Path(filename).exists(): filename = 'screenshot{}'.format(next_id) next_id += 1 color_name, depth_name = filename + '.png', filename + '_depth.png' logger.info('Saving screenshot to {}, {}...'.format(color_name, depth_name)) yield from self._io_async_executor.map(support.save_image, color_name, np.uint8(color)) yield from self._io_async_executor.map(support.save_image, depth_name, support.array_to_grayscale(depth)) yield from renderer.release()
def render(): renderer = ImageRenderer(self.get_gl_executor()) color, depth = yield from renderer.render(scene, camera, viewport) yield from renderer.release() return color, depth