pyBIA.image_moments
Functions
|
Compute a full set of image moments and return as an Astropy Table. |
|
Compute raw spatial moments up to 3rd order. |
|
Compute central moments up to 3rd order. |
Compute raw polynomial moments centered on the geometric center of the image grid. |
|
|
Compute Hu moments using classical eta-normalization. |
|
Compute 2D Legendre moments L_nm for n + m ≤ max_order using orthonormal basis. |
|
Compute the Zernike radial polynomial R_n^m(r). |
|
Compute the magnitudes of Zernike moments up to a given order. |
Module Contents
- pyBIA.image_moments.make_moments_table(image: numpy.ndarray) astropy.table.Table[source]
Compute a full set of image moments and return as an Astropy Table.
This function computes raw moments, central moments, Hu moments, geometrically centered polynomial moments, and Legendre moments. It is the main feature-generation function used in pyBIA to build morphology catalogs.
- Parameters:
image (ndarray) – 2D array representing a greyscale image.
- Returns:
A table with 47 features including raw, central, geometrically centered, Hu, and Legendre moments.
- Return type:
astropy.table.Table
- pyBIA.image_moments.calculate_moments(image: numpy.ndarray, x: numpy.ndarray = None, y: numpy.ndarray = None, m00: float = None) list[source]
Compute raw spatial moments up to 3rd order.
- pyBIA.image_moments.calculate_central_moments(image: numpy.ndarray, x: numpy.ndarray = None, y: numpy.ndarray = None, m00: float = None) list[source]
Compute central moments up to 3rd order.
- pyBIA.image_moments.calculate_geometrically_centered_moments(image: numpy.ndarray, max_order: int = 3, x: numpy.ndarray = None, y: numpy.ndarray = None) list[source]
Compute raw polynomial moments centered on the geometric center of the image grid.
- Parameters:
image (ndarray) – 2D array representing a greyscale image.
max_order (int, optional) – Maximum total order of the moments (default is 3).
- Returns:
Polynomial moments of the form sum(x^p * y^q * image(x,y)) for p+q ≤ max_order, where (x, y) are pixel coordinates shifted so that (0,0) is the geometric center of the image.
- Return type:
- pyBIA.image_moments.calculate_hu_moments(image: numpy.ndarray, central_moments=None) list[source]
Compute Hu moments using classical eta-normalization.
- Parameters:
- Returns:
Classical Hu moments [hu1, …, hu7] using eta(p,q) invariants.
- Return type:
- pyBIA.image_moments.calculate_legendre_moments(image: numpy.ndarray, max_order: int = 3) list[float][source]
Compute 2D Legendre moments L_nm for n + m ≤ max_order using orthonormal basis.
- pyBIA.image_moments.zernike_radial_polynomial(n: int, m: int, r: numpy.ndarray) numpy.ndarray[source]
Compute the Zernike radial polynomial R_n^m(r).
- pyBIA.image_moments.calculate_zernike_moments(image: numpy.ndarray, max_order: int = 3, x: numpy.ndarray = None, y: numpy.ndarray = None) list[source]
Compute the magnitudes of Zernike moments up to a given order. Zernike moments are evaluated on a unit disk and their magnitudes are rotationally invariant.
- Parameters:
image (ndarray) – 2D array representing a greyscale image.
max_order (int, optional) – Maximum radial order (n) of the moments (default is 3).
x (ndarray, optional) – Precomputed coordinate grids.
y (ndarray, optional) – Precomputed coordinate grids.
- Returns:
Magnitudes of Zernike moments |Z_nm| for valid (n, m) pairs where n <= max_order.
- Return type: