Skip to content

nabu.misc.binning

source module nabu.misc.binning

Functions

  • binning Bin an image by a factor of "bin_factor".

  • binning_n_alt Alternate, "clever" but slower implementation

source binning(img, bin_factor, out_dtype=np.float32)

Bin an image by a factor of "bin_factor".

Parameters

  • bin_factor : tuple of int Binning factor in each axis.

  • out_dtype : dtype, optional Output data type. Default is float32.

Notes

If the image original size is not a multiple of the binning factor, the last items (in the considered axis) will be dropped. The resulting shape is (img.shape[0] // bin_factor[0], img.shape[1] // bin_factor[1])

source binning_n_alt(img, bin_factor, out_dtype=np.float32)

Alternate, "clever" but slower implementation