Skip to content

Commit

Permalink
convertMaps
Browse files Browse the repository at this point in the history
  • Loading branch information
dugalh committed Sep 25, 2023
1 parent 14eb43b commit 40708fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions simple_ortho/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ def _get_undistort_maps(self, alpha: float) -> Tuple[Tuple[np.ndarray, np.ndarra
undistort_maps = cv2.initUndistortRectifyMap(
self._K, self._dist_param, np.eye(3), K_undistort, im_size, cv2.CV_16SC2
)
undistort_maps = cv2.convertMaps(*undistort_maps, cv2.CV_16SC2)
return undistort_maps, K_undistort

def _world_to_pixel(self, xyz: np.ndarray) -> np.ndarray:
Expand Down Expand Up @@ -549,6 +550,7 @@ def _get_undistort_maps(self, alpha: float) -> Tuple[Tuple[np.ndarray, np.ndarra
undistort_maps = cv2.fisheye.initUndistortRectifyMap(
self._K, self._dist_param, np.eye(3), K_undistort, im_size, cv2.CV_16SC2
)
undistort_maps = cv2.convertMaps(*undistort_maps, cv2.CV_16SC2)
return undistort_maps, K_undistort

def _world_to_pixel(self, xyz: np.ndarray) -> np.ndarray:
Expand Down
2 changes: 1 addition & 1 deletion simple_ortho/ortho.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def _remap_tile(
# separate tile_ji into (j, i) grids, converting to float32 for compatibility with cv2.remap
tile_jgrid = tile_ji[0, :].reshape(tile_win.height, tile_win.width).astype('float32')
tile_igrid = tile_ji[1, :].reshape(tile_win.height, tile_win.width).astype('float32')
# tile_jgrid, tile_igrid = cv2.convertMaps(tile_jgrid, tile_igrid, cv2.CV_16SC2)
tile_jgrid, tile_igrid = cv2.convertMaps(tile_jgrid, tile_igrid, cv2.CV_16SC2)

# initialise ortho tile array
tile_array = np.full(
Expand Down

0 comments on commit 40708fd

Please sign in to comment.