Cluster

template<typename T, uint8_t ClusterSizeX, uint8_t ClusterSizeY, typename CoordType = uint16_t>
struct Cluster

Cluster struct.

Public Types

using value_type = T
using coord_type = CoordType

Public Functions

inline T sum() const

Sum of all elements in the cluster.

inline Sum_index_pair<T, corner> max_sum_2x2() const

Find the highest-sum center-adjacent 2x2 subcluster.

Returns:

Sum and corner index of the selected 2x2 subcluster relative to the cluster center

Public Members

CoordType x

Cluster center x coordinate (in pixel coordinates).

CoordType y

Cluster center y coordinate (in pixel coordinates).

std::array<T, ClusterSizeX * ClusterSizeY> data

Cluster data stored in row-major order starting from top-left.

Public Static Attributes

static constexpr uint8_t cluster_size_x = ClusterSizeX
static constexpr uint8_t cluster_size_y = ClusterSizeY

Free Functions:

template<typename T, uint8_t ClusterSizeX, uint8_t ClusterSizeY, typename CoordType = int16_t>
Cluster<T, 3, 3, CoordType> aare::reduce_to_3x3(const Cluster<T, ClusterSizeX, ClusterSizeY, CoordType> &c)

Reduce a cluster to the 3x3 block around its center index.

Parameters:

c – Cluster to reduce

Pre:

ClusterSizeX and ClusterSizeY must both be at least 3, and at least one must be greater than 3.

Returns:

Reduced cluster with the input coordinates are preserved.

template<typename T, uint8_t ClusterSizeX, uint8_t ClusterSizeY, typename CoordType = uint16_t>
Cluster<T, 2, 2, CoordType> aare::reduce_to_2x2(const Cluster<T, ClusterSizeX, ClusterSizeY, CoordType> &c)

Reduce a cluster to its highest-sum center-adjacent 2x2 block.

Note

The cluster is filled using row major ordering starting at the top-left

Parameters:

c – Cluster to reduce

Returns:

Reduced cluster with the input coordinates