Read image as grayscale and resize to img_size. Inputs impath: Path to input image. Returns grayim: uint8 numpy array sized H x W.
(self, impath)
| 157 | raise IOError('Could not read camera') |
| 158 | |
| 159 | def load_image(self, impath): |
| 160 | """ Read image as grayscale and resize to img_size. |
| 161 | Inputs |
| 162 | impath: Path to input image. |
| 163 | Returns |
| 164 | grayim: uint8 numpy array sized H x W. |
| 165 | """ |
| 166 | grayim = cv2.imread(impath, 0) |
| 167 | if grayim is None: |
| 168 | raise Exception('Error reading image %s' % impath) |
| 169 | w, h = grayim.shape[1], grayim.shape[0] |
| 170 | w_new, h_new = process_resize(w, h, self.resize) |
| 171 | grayim = cv2.resize( |
| 172 | grayim, (w_new, h_new), interpolation=self.interp) |
| 173 | return grayim |
| 174 | |
| 175 | def next_frame(self): |
| 176 | """ Return the next frame, and increment internal counter. |
no test coverage detected