NumCpp
2.4.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
centroidClusters.hpp
Go to the documentation of this file.
1
29
#pragma once
30
31
#include "
NumCpp/Core/Internal/StaticAsserts.hpp
"
32
#include "
NumCpp/ImageProcessing/Centroid.hpp
"
33
#include "
NumCpp/ImageProcessing/Cluster.hpp
"
34
35
#include <utility>
36
#include <vector>
37
38
namespace
nc
39
{
40
namespace
imageProcessing
41
{
42
//============================================================================
43
// Method Description:
50
template
<
typename
dtype>
51
std::vector<Centroid<dtype> >
centroidClusters
(
const
std::vector<
Cluster<dtype>
>& inClusters)
52
{
53
STATIC_ASSERT_ARITHMETIC
(dtype);
54
55
std::vector<Centroid<dtype>> centroids;
56
57
centroids.reserve(inClusters.size());
58
for
(
auto
& cluster : inClusters)
59
{
60
centroids.emplace_back(cluster);
61
}
62
63
return
centroids;
64
}
65
}
// namespace imageProcessing
66
}
// namespace nc
StaticAsserts.hpp
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition:
StaticAsserts.hpp:37
Centroid.hpp
nc::imageProcessing::centroidClusters
std::vector< Centroid< dtype > > centroidClusters(const std::vector< Cluster< dtype > > &inClusters)
Definition:
centroidClusters.hpp:51
nc
Definition:
Coordinate.hpp:44
Cluster.hpp
nc::imageProcessing::Cluster
Holds the information for a cluster of pixels.
Definition:
Cluster.hpp:53
include
NumCpp
ImageProcessing
centroidClusters.hpp
Generated by
1.8.17