Module for computing the Histogram of gradient in EOPatch

class eolearn.features.hog.HOGTask(feature, orientations=9, pixels_per_cell=(8, 8), cells_per_block=(3, 3), visualize=True, hog_feature_vector=False, block_norm='L2-Hys', visualize_feature_name='')[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 visualize is True, it also outputs the images representing the gradients for each orientation.

  • 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 computation of HoG features on input eopatch


eopatch (eolearn.core.EOPatch) – Input eopatch


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

Return type