46 template<
typename dtype>
58 double rowCenter = 0.;
59 double colCenter = 0.;
65 const auto pixelValue =
static_cast<double>(inArray(row, col));
68 rowCenter += pixelValue *
static_cast<double>(row);
69 colCenter += pixelValue *
static_cast<double>(col);
76 return { rowCenter, colCenter };
89 returnArray(0, colIdx) +=
90 static_cast<double>(inArray(rowIdx, colIdx)) *
static_cast<double>(rowIdx);
93 returnArray(0, colIdx) /= inten[colIdx];
109 returnArray(0, rowIdx) +=
110 static_cast<double>(inArray(rowIdx, colIdx)) *
static_cast<double>(colIdx);
113 returnArray(0, rowIdx) /= inten[rowIdx];
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:39
self_type & zeros() noexcept
Definition: NdArrayCore.hpp:4900
const Shape & shape() const noexcept
Definition: NdArrayCore.hpp:4511
self_type sum(Axis inAxis=Axis::NONE) const
Definition: NdArrayCore.hpp:4618
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
uint32 rows
Definition: Core/Shape.hpp:44
uint32 cols
Definition: Core/Shape.hpp:45
Definition: Cartesian.hpp:40
Axis
Enum To describe an axis.
Definition: Enums.hpp:36
NdArray< double > centerOfMass(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: centerOfMass.hpp:47
Shape shape(const NdArray< dtype > &inArray) noexcept
Definition: Functions/Shape.hpp:42
std::uint32_t uint32
Definition: Types.hpp:40