NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
centroidClusters.hpp
Go to the documentation of this file.
1
28
29#pragma once
30
31#include <vector>
32
37
38namespace nc::imageProcessing
39{
40 //============================================================================
41 // Method Description:
47 template<typename dtype>
48 std::vector<Centroid<dtype>> centroidClusters(const std::vector<Cluster<dtype>>& inClusters)
49 {
51
52 std::vector<Centroid<dtype>> centroids(inClusters.size());
53 stl_algorithms::transform(inClusters.begin(),
54 inClusters.end(),
55 centroids.begin(),
56 [](const auto& cluster) -> Centroid<dtype> { return Centroid<dtype>(cluster); });
57 return centroids;
58 }
59} // namespace nc::imageProcessing
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition StaticAsserts.hpp:39
holds the information for a centroid
Definition Centroid.hpp:51
Holds the information for a cluster of pixels.
Definition Cluster.hpp:52
Definition applyThreshold.hpp:34
std::vector< Centroid< dtype > > centroidClusters(const std::vector< Cluster< dtype > > &inClusters)
Definition centroidClusters.hpp:48
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition StlAlgorithms.hpp:776