tf.keras.ops.image.map_coordinates
Stay organized with collections
Save and categorize content based on your preferences.
Map the input array to new coordinates by interpolation.
tf.keras.ops.image.map_coordinates(
inputs, coordinates, order, fill_mode='constant', fill_value=0
)
Note that interpolation near boundaries differs from the scipy function,
because we fixed an outstanding bug
scipy/issues/2640.
Args |
inputs
|
The input array.
|
coordinates
|
The coordinates at which inputs is evaluated.
|
order
|
The order of the spline interpolation. The order must be 0 or
1. 0 indicates the nearest neighbor and 1 indicates the linear
interpolation.
|
fill_mode
|
Points outside the boundaries of the inputs are filled
according to the given mode. Available methods are "constant",
"nearest", "wrap" and "mirror" and "reflect". Defaults to
"constant".
"constant": (k k k k | a b c d | k k k k)
The inputs is extended by filling all values beyond
the edge with the same constant value k specified by
fill_value.
"nearest": (a a a a | a b c d | d d d d)
The inputs is extended by the nearest pixel.
"wrap": (a b c d | a b c d | a b c d)
The inputs is extended by wrapping around to the opposite edge.
"mirror": (c d c b | a b c d | c b a b)
The inputs is extended by mirroring about the edge.
"reflect": (d c b a | a b c d | d c b a)
The inputs is extended by reflecting about the edge of the last
pixel.
|
fill_value
|
Value used for points outside the boundaries of the inputs
if fill_mode="constant". Defaults to 0.
|
Returns |
|
Output input or batch of inputs.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2026-11-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-11-04 UTC."],[],[]]