56 #pragma omp parallel for 58 for(uint32_t i = 0; i < num_elements; ++i)
61 const int x = coord.
x();
62 const int y = coord.
y();
64 std::array<T, 9> neighbours = { { 0 } };
65 for(
int row = y - 1, j = 0; row <= y + 1; ++row)
67 for(
int col = x - 1; col <= x + 1; ++col, ++j)
71 neighbours[j] =
tensor_elem_at(src, coord, border_mode, constant_border_value);
75 dst[i] = *std::min_element(neighbours.cbegin(), neighbours.cend());
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.
T tensor_elem_at(const SimpleTensor< T > &src, Coordinates coord, BorderMode border_mode, T constant_border_value)
DataType data_type() const override
Data type of the tensor.
TensorShape shape() const override
Shape of the tensor.
SimpleTensor< T > erode(const SimpleTensor< T > &src, BorderMode border_mode, T constant_border_value)
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
T x() const
Alias to access the size of the first dimension.
Coordinates index2coord(const TensorShape &shape, int index)
Convert a linear index into n-dimensional coordinates.
Simple tensor object that stores elements in a consecutive chunk of memory.
int num_elements() const override
Number of elements of the tensor.
T y() const
Alias to access the size of the second dimension.