 |
NumCpp
2.1.0
A C++ implementation of the Python Numpy library
|
Go to the documentation of this file.
62 template<
typename dtype>
76 const uint32 boundarySize = inSize / 2;
77 const uint32 endPointRow = boundarySize + inShape.
rows;
78 const uint32 endPointCol = boundarySize + inShape.
cols;
80 for (
uint32 row = boundarySize; row < endPointRow; ++row)
82 for (
uint32 col = boundarySize; col < endPointCol; ++col)
84 NdArray<dtype> window = arrayWithBoundary(
Slice(row - boundarySize, row + boundarySize + 1),
85 Slice(col - boundarySize, col + boundarySize + 1)).
flatten();
87 output(row - boundarySize, col - boundarySize) =
dot(window, weightsFlat).
item();
value_type item() const
Definition: NdArrayCore.hpp:2958
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4312
NdArray< dtype > dot(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2)
Definition: dot.hpp:48
std::uint32_t uint32
Definition: Types.hpp:41
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
NdArray< dtype > convolve(const NdArray< dtype > &inImageArray, uint32 inSize, const NdArray< dtype > &inWeights, Boundary inBoundaryType=Boundary::REFLECT, dtype inConstantValue=0)
Definition: convolve.hpp:63
size_type size() const noexcept
Definition: NdArrayCore.hpp:4326
uint32 cols
Definition: Core/Shape.hpp:46
NdArray< dtype > addBoundary2d(const NdArray< dtype > &inImage, Boundary inBoundaryType, uint32 inKernalSize, dtype inConstantValue=0)
Definition: addBoundary2d.hpp:62
NdArray< dtype > flatten() const
Definition: NdArrayCore.hpp:2775
Definition: Coordinate.hpp:45
uint32 rows
Definition: Core/Shape.hpp:45
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:37
Boundary
Boundary condition to apply to the image filter.
Definition: Boundary.hpp:38
constexpr dtype sqr(dtype inValue) noexcept
Definition: sqr.hpp:45
NdArray< dtype > rot90(const NdArray< dtype > &inArray, uint8 inK=1)
Definition: rot90.hpp:52
A Class for slicing into NdArrays.
Definition: Slice.hpp:44