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