MCPcopy
hub / github.com/magicleap/SuperGluePretrainedNetwork / load_image

Method load_image

models/utils.py:159–173  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 1

next_frameMethod · 0.95

Calls 1

process_resizeFunction · 0.85

Tested by

no test coverage detected