xpad — xtensor documentation (original) (raw)
Defined in xtensor/misc/xpad.hpp
enum class xt::pad_mode
Defines different algorithms to be used in [xt::pad](#namespacext%5F1a0006ff814bef7534b9fa5187b1863feb):
constant: Pads with a constant value.symmetric: Pads with the reflection of the vector mirrored along the edge of the array.reflect: Pads with the reflection of the vector mirrored on the first and last values of the vector along each axis.wrap: Pads with the wrap of the vector along the axis. The first values are used to pad the end and the end values are used to pad the beginning.periodic:== wrap(pads with periodic repetitions of the vector).
OpenCV to xtensor:
BORDER_CONSTANT == constantBORDER_REFLECT == symmetricBORDER_REFLECT_101 == reflectBORDER_WRAP == wrap
Values:
enumerator constant
enumerator symmetric
enumerator reflect
enumerator wrap
enumerator periodic
enumerator edge
template<class E, class S = typename std::decay_t<E>::size_type, class V = typename std::decay_t<E>::value_type>
inline auto xt::pad(E &&e, const std::vector<std::vector<S>> &pad_width, pad_mode mode = pad_mode::constant, V constant_value = 0)
Pad an array.
Parameters:
- e – The array.
- pad_width – Number of values padded to the edges of each axis:
{{before_1, after_1}, ..., {before_N, after_N}}. - mode – The type of algorithm to use. [default:
xt::pad_mode::constant]. - constant_value – The value to set the padded values for each axis (used in
xt::pad_mode::constant).
Returns:
The padded array.
template<class E, class S = typename std::decay_t<E>::size_type, class V = typename std::decay_t<E>::value_type>
inline auto xt::pad(E &&e, const std::vector<S> &pad_width, pad_mode mode = pad_mode::constant, V constant_value = 0)
Pad an array.
Parameters:
- e – The array.
- pad_width – Number of values padded to the edges of each axis:
{before, after}. - mode – The type of algorithm to use. [default:
xt::pad_mode::constant]. - constant_value – The value to set the padded values for each axis (used in
xt::pad_mode::constant).
Returns:
The padded array.
template<class E, class S = typename std::decay_t<E>::size_type, class V = typename std::decay_t<E>::value_type>
inline auto xt::pad(E &&e, S pad_width, pad_mode mode = pad_mode::constant, V constant_value = 0)
Pad an array.
Parameters:
- e – The array.
- pad_width – Number of values padded to the edges of each axis.
- mode – The type of algorithm to use. [default:
xt::pad_mode::constant]. - constant_value – The value to set the padded values for each axis (used in
xt::pad_mode::constant).
Returns:
The padded array.
template<class E, class S = typename std::decay_t<E>::size_type>
inline auto xt::tile(E &&e, std::initializer_list<S> reps)
Tile an array.
Parameters:
- e – The array.
- reps – The number of repetitions of A along each axis.
Returns:
The tiled array.
template<class E, class S = typename std::decay_t<E>::size_type, xtl::check_concept<xtl::is_integral<S>> = 0>
inline auto xt::tile(E &&e, S reps)
Tile an array.
Parameters:
- e – The array.
- reps – The number of repetitions of A along the first axis.
Returns:
The tiled array.