Skip to content

Feature Extractors

2D point feature extraction.

ConvexHullFeatureExtractor

Bases: FeatureExtractor

Convex hull feature extractor. Computes the 2D centroid and area of the bounding polygon (convex hull).

FeatureExtractor

Bases: ABC

Feature extractor abstract base class. Subclasses must implement the call method.

__call__(points) abstractmethod

Extract the feature values from the provided points.

Parameters:

Name Type Description Default
points ndarray

A numpy array of shape (n_points, 2) containing the image points.

required

Returns:

Type Description
ndarray

A numpy array of shape (n_values, m) containing the \(m\) feature values.

Source code in src/compas_camcal/clustering/extractors.py
17
18
19
20
21
22
23
24
25
26
27
28
@abstractmethod
def __call__(self, points: np.ndarray) -> np.ndarray:
    """
    Extract the feature values from the provided points.

    Args:
        points: A numpy array of shape (n_points, 2) containing the image points.

    Returns:
        A numpy array of shape (n_values, m) containing the $m$ feature values.
    """
    pass

FeatureExtractorGroup(*feature_extractors)

Bases: FeatureExtractor

Feature extractor group class. Composes multiple feature extractors into a single feature extractor.

Initialize the feature extractor group.

Parameters:

Name Type Description Default
feature_extractors Tuple[FeatureExtractor]

FeatureExtractor objects.

()
Source code in src/compas_camcal/clustering/extractors.py
36
37
38
39
40
41
42
43
def __init__(self, *feature_extractors: Tuple[FeatureExtractor]) -> None:
    """
    Initialize the feature extractor group.

    Args:
        feature_extractors: FeatureExtractor objects.
    """
    self._feature_extractors = list(feature_extractors)

PlanarHomographyFeatureExtractor(reference)

Bases: FeatureExtractor

Planar homography feature extractor. Computes the homography between the points and a planar reference.

Source code in src/compas_camcal/clustering/extractors.py
78
79
80
81
def __init__(self, reference: np.ndarray) -> None:
    super().__init__()

    self._reference = reference