Skip to content

Commit

Permalink
fix resize
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangwei221 committed Jul 23, 2021
1 parent 73854c7 commit 2b2b66a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions COTR/cameras/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,23 +275,22 @@ def depth_map(self):
if self.rotation != 0:
_depth = rotate_image(_depth, self.rotation, interpolation=cv2.INTER_NEAREST)
if _depth.shape != self.pinhole_cam_before.shape:
exec(debug_utils.embed_breakpoint())
_depth = misc.imresize(_depth, self.pinhole_cam_before.shape, interp='nearest', mode='F')
_depth = np.array(PIL.Image.fromarray(_depth).resize(self.pinhole_cam_before.shape[::-1], resample=PIL.Image.NEAREST))
assert _depth.shape[:2] == self.pinhole_cam_before.shape
if self.crop_cam == 'no_crop':
pass
elif self.crop_cam == 'crop_center':
_depth = crop_center_max(_depth)
elif self.crop_cam == 'crop_center_and_resize':
_depth = crop_center_max(_depth)
exec(debug_utils.embed_breakpoint())
_depth = misc.imresize(_depth, (MAX_SIZE, MAX_SIZE), interp='nearest', mode='F')
_depth = np.array(PIL.Image.fromarray(_depth).resize((MAX_SIZE, MAX_SIZE), resample=PIL.Image.NEAREST))
elif isinstance(self.crop_cam, CropCamConfig):
assert _depth.shape[0] == self.crop_cam.orig_h
assert _depth.shape[1] == self.crop_cam.orig_w
_depth = _depth[self.crop_cam.y:self.crop_cam.y + self.crop_cam.h,
self.crop_cam.x:self.crop_cam.x + self.crop_cam.w, ]
exec(debug_utils.embed_breakpoint())
_depth = misc.imresize(_depth, (self.crop_cam.out_h, self.crop_cam.out_w), interp='nearest', mode='F')
_depth = np.array(PIL.Image.fromarray(_depth).resize((self.crop_cam.out_w, self.crop_cam.out_h), resample=PIL.Image.NEAREST))
assert _depth.shape[:2] == (self.crop_cam.out_h, self.crop_cam.out_w)
else:
raise ValueError()
assert (_depth >= 0).all()
Expand Down

0 comments on commit 2b2b66a

Please sign in to comment.