42 T constant_border_value)
47 const int width = in.
shape().x();
48 const int height = in.
shape().y();
49 const uint32_t num_elements = out.num_elements();
50 for(uint32_t idx = 0; idx < num_elements; idx++)
55 src_idx.
set(0, static_cast<int>(std::floor(map_x[idx])));
56 src_idx.
set(1, static_cast<int>(std::floor(map_y[idx])));
57 if((0 <= map_y[idx]) && (map_y[idx] < height) && (0 <= map_x[idx]) && (map_x[idx] < width))
63 out[idx] =
tensor_elem_at(in, src_idx, border_mode, constant_border_value);
69 out[idx] =
bilinear_policy(in, src_idx, map_x[idx], map_y[idx], border_mode, constant_border_value) :
90 out[idx] = constant_border_value;
93 out[idx] =
bilinear_policy(in, src_idx, map_x[idx], map_y[idx], border_mode, constant_border_value);
108 uint8_t constant_border_value);
BorderMode
Methods available to handle borders.
void set(size_t dimension, T value, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
InterpolationPolicy
Interpolation method.
T tensor_elem_at(const SimpleTensor< T > &src, Coordinates coord, BorderMode border_mode, T constant_border_value)
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
SimpleTensor< T > remap(const SimpleTensor< T > &in, SimpleTensor< float > &map_x, SimpleTensor< float > &map_y, SimpleTensor< T > &valid_mask, InterpolationPolicy policy, BorderMode border_mode, T constant_border_value)
DataType data_type() const override
Data type of the tensor.
Output values are defined by bilinear interpolation between the pixels.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
TensorShape shape() const override
Shape of the tensor.
Output values are defined to match the source pixel whose center is nearest to the sample position...
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
T bilinear_policy(const SimpleTensor< T > &in, Coordinates id, float xn, float yn, BorderMode border_mode, T constant_border_value)
Coordinates index2coord(const TensorShape &shape, int index)
Convert a linear index into n-dimensional coordinates.
Output values are determined by averaging the source pixels whose areas fall under the area of the de...
Simple tensor object that stores elements in a consecutive chunk of memory.
Borders are left undefined.
Pixels outside the image are assumed to have the same value as the closest image pixel.
int num_elements() const override
Number of elements of the tensor.
bool valid_bilinear_policy(float xn, float yn, int width, int height, BorderMode border_mode)