mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-11 11:25:30 +08:00
Refactor image warps
* Fix cval bug in interpolation which was ignored * Remove fast_homography as standalone function and automatically include functionality in warp * Fix bug in warp_coords for graylevel images * move warp functions to warp file
This commit is contained in:
@@ -18,8 +18,8 @@ cdef inline double nearest_neighbour(double* image, int rows, int cols,
|
||||
Shape of image.
|
||||
r, c : int
|
||||
Position at which to interpolate.
|
||||
mode : {'C', 'W', 'M'}
|
||||
Wrapping mode. Constant, Wrap or Mirror.
|
||||
mode : {'C', 'W', 'R'}
|
||||
Wrapping mode. Constant, Wrap or Reflect.
|
||||
cval : double
|
||||
Constant value to use for constant mode.
|
||||
|
||||
@@ -42,8 +42,8 @@ cdef inline double bilinear_interpolation(double* image, int rows, int cols,
|
||||
Shape of image.
|
||||
r, c : int
|
||||
Position at which to interpolate.
|
||||
mode : {'C', 'W', 'M'}
|
||||
Wrapping mode. Constant, Wrap or Mirror.
|
||||
mode : {'C', 'W', 'R'}
|
||||
Wrapping mode. Constant, Wrap or Reflect.
|
||||
cval : double
|
||||
Constant value to use for constant mode.
|
||||
|
||||
@@ -76,8 +76,8 @@ cdef inline double get_pixel(double* image, int rows, int cols, int r, int c,
|
||||
Shape of image.
|
||||
r, c : int
|
||||
Position at which to get the pixel.
|
||||
mode : {'C', 'W', 'M'}
|
||||
Wrapping mode. Constant, Wrap or Mirror.
|
||||
mode : {'C', 'W', 'R'}
|
||||
Wrapping mode. Constant, Wrap or Reflect.
|
||||
cval : double
|
||||
Constant value to use for constant mode.
|
||||
|
||||
@@ -101,13 +101,13 @@ cdef inline int coord_map(int dim, int coord, char mode):
|
||||
Maximum coordinate.
|
||||
coord : int
|
||||
Coord provided by user. May be < 0 or > dim.
|
||||
mode : {'W', 'M'}
|
||||
Whether to wrap or mirror the coordinate if it
|
||||
mode : {'W', 'R'}
|
||||
Whether to wrap or reflect the coordinate if it
|
||||
falls outside [0, dim).
|
||||
|
||||
"""
|
||||
dim = dim - 1
|
||||
if mode == 'M': # mirror
|
||||
if mode == 'R': # reflect
|
||||
if (coord < 0):
|
||||
# How many times times does the coordinate wrap?
|
||||
if (<int>(-coord / dim) % 2 != 0):
|
||||
|
||||
Reference in New Issue
Block a user