mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-11 12:43:04 +08:00
ENH: Implement fast coordinate transformations.
This commit is contained in:
@@ -4,18 +4,12 @@
|
||||
|
||||
import numpy as np
|
||||
from scipy.ndimage import interpolation as ndii
|
||||
from .warp import _stackcopy
|
||||
|
||||
__all__ = ['homography']
|
||||
|
||||
eps = np.finfo(float).eps
|
||||
|
||||
def _stackcopy(a, b):
|
||||
"""a[:,:,0] = a[:,:,1] = ... = b"""
|
||||
if a.ndim == 3:
|
||||
a.transpose().swapaxes(1, 2)[:] = b
|
||||
else:
|
||||
a[:] = b
|
||||
|
||||
def homography(image, H, output_shape=None, order=1,
|
||||
mode='constant', cval=0.):
|
||||
"""Perform a projective transformation (homography) on an image.
|
||||
@@ -106,6 +100,8 @@ def homography(image, H, output_shape=None, order=1,
|
||||
|
||||
coords = np.empty(np.r_[3, output_shape], dtype=float)
|
||||
|
||||
# TODO: Refactor this method to use transform.warp instead.
|
||||
|
||||
# Construct transformed coordinates
|
||||
rows, cols = output_shape[:2]
|
||||
rows, cols = np.mgrid[:rows, :cols]
|
||||
|
||||
Reference in New Issue
Block a user