mftrees package¶
Submodules¶
mftrees.features module¶
-
mftrees.features.
feature_vector
(sample, bins)¶ Compute a discretized, radially averaged Fourier power spectra for use as a feature vector.
- Parameters
sample (ndarray) – Input image as a 2-D ndarray
bins (ndarray) – ndarray with same dimensions as _sample_, containing the integer bin label for each element in _sample_.
- Returns
float64 1-D ndarray with length np.unique(bins).size
- Return type
ndarray
-
mftrees.features.
fmap
(block_size)¶ Construct a wavelength map for a FFT output with dimensions of block_size
-
mftrees.features.
full_feature_vector
(sample, bins)¶ Compute and concatenate feature vectors across all image bands in (c, h, w) form
- Parameters
sample (ndarray) – Input image as a 2-D ndarray
bins (ndarray) – ndarray with same dimensions as _sample_, containing the integer bin label for each element in _sample_.
-
mftrees.features.
spectrum
(arr)¶ Compute a 2-D Fourier power spectra of an image, based on a unitary forward FFT
- Parameters
arr (ndarray) – Input image as a 2-D ndarray
- Returns
float64 ndarray with same dimensions as _arr_ containing the Fourier power spectra. Low frequency components are shifted to the center of the image.
- Return type
ndarray
mftrees.util module¶
-
mftrees.util.
all_equal
(arg1, arg2)¶ Shortcut function to compute element-wise equality between two iterables
- Parameters
arg1 (iterable) – Any iterable sequence
arg2 (iterable) – Any iterable sequence that has the same length as arg1
- Returns
True if each pair of elements are equal. Otherwise, False
- Return type
bool
-
mftrees.util.
create_histmatcher
(img, ref)¶ Create a function that will histogram match pieces of a source image with a target image, incrementally
- Parameters
img (ndarray) – NumPy array containing the image data to transform
ref (ndarray) – Numpy array containing the reference image data for the transformation
- Returns
A function that takes a 2-D NumPy array to be transformed
- Return type
function
-
mftrees.util.
r2
(y_pred, y, w=1.0)¶ Compute generalized Pearson’s R^2, with optional weights
- Parameters
y_pred (ndarray) – NumPy array of predicted values
y (ndarray) – NumPy array of true values the same length and dimensionality as y_pred
w (float or ndarray, optional) – Weights for each sample (default is 1.0)