 |
NumCpp
2.1.0
A C++ implementation of the Python Numpy library
|
Go to the documentation of this file.
43 namespace imageProcessing
48 template<
typename dtype>
52 STATIC_ASSERT_ARITHMETIC(dtype);
71 centerOfMass(inCluster);
81 double row() const noexcept
93 double col() const noexcept
117 double eod() const noexcept
159 return row_ == rhs.row_ && col_ == rhs.col_ && intensity_ == rhs.intensity_ && eod_ == rhs.eod_;
174 return !(*
this == rhs);
192 return intensity_ < rhs.intensity_ ? false :
true;
206 inStream << inCentriod.
str();
214 dtype intensity_{ 0 };
226 void centerOfMass(
const Cluster<dtype>& inCluster)
228 const Shape clusterShape(inCluster.height(), inCluster.width());
229 NdArray<dtype> clusterArray(clusterShape);
230 clusterArray.zeros();
232 const uint32 rowMin = inCluster.rowMin();
233 const uint32 colMin = inCluster.colMin();
235 for (
auto& pixel : inCluster)
237 clusterArray(pixel.row - rowMin, pixel.col - colMin) = pixel.intensity;
241 row_ = rowCol.front() + rowMin;
242 col_ = rowCol.back() + colMin;
bool operator!=(const Centroid< dtype > &rhs) const noexcept
Definition: Centroid.hpp:172
dtype intensity() const noexcept
Definition: Centroid.hpp:105
std::string num2str(dtype inNumber)
Definition: num2str.hpp:47
std::string str() const
Definition: Centroid.hpp:129
Centroid(const Cluster< dtype > &inCluster)
Definition: Centroid.hpp:67
bool operator==(const Centroid< dtype > &rhs) const noexcept
Definition: Centroid.hpp:157
std::uint32_t uint32
Definition: Types.hpp:41
double eod() const noexcept
Definition: Centroid.hpp:117
bool operator<(const Centroid< dtype > &rhs) const noexcept
Definition: Centroid.hpp:190
double col() const noexcept
Definition: Centroid.hpp:93
double row() const noexcept
Definition: Centroid.hpp:81
friend std::ostream & operator<<(std::ostream &inStream, const Centroid< dtype > &inCentriod)
Definition: Centroid.hpp:204
Definition: Coordinate.hpp:45
void print() const
Definition: Centroid.hpp:142
holds the information for a centroid
Definition: Centroid.hpp:49
Holds the information for a cluster of pixels.
Definition: Cluster.hpp:54
NdArray< double > centerOfMass(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: centerOfMass.hpp:48