SURFFeature.gridify#

SURFFeature.gridify(nbins: int | tuple[int, int], nfeat: int) → BaseFeature2D[source]#

Sort features into grid

Parameters:
  • nfeat (int) – maximum number of features per grid cell

  • nbins (int) – number of grid cells horizontally and vertically

Returns:

set of gridded features

Return type:

BaseFeature2D instance

Select features such that no more than nfeat features fall into each grid cell. The image is divided into an nbins x nbins grid.

Warning

Takes the first nfeat features in each grid cell, not the nfeat strongest. Sort the features by strength to achieve this.

Changed in version 2.5.0: The result keeps the descriptors and the scale, orientation and strength of the features, and a feature at the right or bottom edge of the image no longer raises IndexError.

See also

sort