eolearn.features.hog

Module for computing the Histogram of gradient in EOPatch

class eolearn.features.hog.HOGTask(*args, **kwargs)[source]

Bases: eolearn.core.eotask.EOTask

Task to compute the histogram of gradient

Divide the image into small connected regions called cells, and for each cell compute a histogram of gradient directions or edge orientations for the pixels within the cell.

The algorithm stores the result in images where each band is the value of the histogram for a specific angular bin. If the visualize is True, it also output the images representing the gradients for each orientation.

Parameters
  • feature ((FeatureType, str) or (FeatureType, str, str)) –

    A feature that will be used and a new feature name where data will be saved. If new name is not specified it will be saved with name ‘<feature_name>_HOG’

    Example: (FeatureType.DATA, ‘bands’) or (FeatureType.DATA, ‘bands’, ‘hog’)

  • orientations (int) – Number of direction to use for the oriented gradient

  • pixels_per_cell ((int, int)) – Number of pixels in a cell

  • cells_per_block ((int, int)) – Number of cells in a block

  • visualize (bool) – Produce a visualization for the HOG in an image

  • visualize_feature_name (str) – Name of the visualization feature to be added to the eopatch (if empty and visualize is True, the become “new_name”_VIZU

execute(eopatch)[source]

Execute computation of HoG features on input eopatch

Parameters

eopatch (eolearn.core.EOPatch) – Input eopatch

Returns

EOPatch instance with new keys holding the HoG features and HoG image for visualisation.

Return type

eolearn.core.EOPatch