NumCpp  2.14.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
generateCentroids.hpp
Go to the documentation of this file.
1
28
29#pragma once
30
31#include <string>
32#include <vector>
33
36#include "NumCpp/Core/Types.hpp"
42#include "NumCpp/NdArray.hpp"
43
44namespace nc::imageProcessing
45{
46 //============================================================================
47 // Method Description:
57 template<typename dtype>
58 std::vector<Centroid<dtype>> generateCentroids(const NdArray<dtype>& inImageArray,
59 double inRate,
60 const std::string& inWindowType,
62 {
64
67 if (inWindowType == "pre")
68 {
70 }
71 else if (inWindowType == "post")
72 {
74 }
75 else
76 {
77 THROW_INVALID_ARGUMENT_ERROR("input window type options are ['pre', 'post']");
78 }
79
80 // generate the threshold
82
83 // apply the threshold to get xcds
85
86 // window around the xcds
87 if (borderWidthPre > 0)
88 {
90 }
91
92 // cluster the exceedances
93 std::vector<Cluster<dtype>> clusters = clusterPixels(inImageArray, xcds, borderWidthPost);
94
95 // centroid the clusters
97 }
98} // namespace nc::imageProcessing
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition StaticAsserts.hpp:39
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
Definition applyThreshold.hpp:34
dtype generateThreshold(const NdArray< dtype > &inImageArray, double inRate)
Definition generateThreshold.hpp:54
NdArray< bool > windowExceedances(const NdArray< bool > &inExceedances, uint8 inBorderWidth) noexcept
Definition windowExceedances.hpp:47
std::vector< Centroid< dtype > > generateCentroids(const NdArray< dtype > &inImageArray, double inRate, const std::string &inWindowType, uint8 inBorderWidth=0)
Definition generateCentroids.hpp:58
NdArray< bool > applyThreshold(const NdArray< dtype > &inImageArray, dtype inThreshold)
Definition applyThreshold.hpp:44
std::vector< Cluster< dtype > > clusterPixels(const NdArray< dtype > &inImageArray, const NdArray< bool > &inExceedances, uint8 inBorderWidth=0)
Definition clusterPixels.hpp:52
std::vector< Centroid< dtype > > centroidClusters(const std::vector< Cluster< dtype > > &inClusters)
Definition centroidClusters.hpp:49
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59
std::uint8_t uint8
Definition Types.hpp:42