:returns: a gray-scale (h, w) uint8 image
(self)
| 110 | return m.reshape((self.height, self.width, 3)) |
| 111 | |
| 112 | def _current_state(self): |
| 113 | """ |
| 114 | :returns: a gray-scale (h, w) uint8 image |
| 115 | """ |
| 116 | ret = self._grab_raw_image() |
| 117 | # max-pooled over the last screen |
| 118 | ret = np.maximum(ret, self.last_raw_screen) |
| 119 | if self.viz: |
| 120 | if isinstance(self.viz, float): |
| 121 | cv2.imshow(self.windowname, ret) |
| 122 | cv2.waitKey(int(self.viz * 1000)) |
| 123 | if self.grayscale: |
| 124 | # 0.299,0.587.0.114. same as rgb2y in torch/image |
| 125 | ret = cv2.cvtColor(ret, cv2.COLOR_RGB2GRAY) |
| 126 | return ret.astype('uint8') # to save some memory |
| 127 | |
| 128 | def _restart_episode(self): |
| 129 | with _ALE_LOCK: |
no test coverage detected