BEMD performed on bidimensional data such as images. This procedure uses morphological operators to detect regional maxima which are then used to span surface envelope with a radial basis function.

class PyEMD.BEMD[source]

Bidimensional Empirical Mode Decomposition

Important: This class intends to be undocumented until it’s actually properly tested and proven to work. An attempt to replicate findings in the paper cited below has failed. This method is only included in the package because someone asked for it, and I’m hoping that one day someone else will come and fix it. Until then, USE AT YOUR OWN RISK.

The guess why the decomosition doesn’t work is that it’s difficult to extrapolate image far away from extrema. Not even mirroring helps in this case.

Method decomposes 2D arrays like gray-scale images into 2D representations of Intrinsic Mode Functions (IMFs).

The algorithm is based on Nunes et. al. [Rab62e46a7d41-Nunes2003] work.

[Rab62e46a7d41-Nunes2003]J.-C. Nunes, Y. Bouaoune, E. Delechelle, O. Niang, P. Bunel.,

“Image analysis by bidimensional empirical mode decomposition. Image and Vision Computing”, Elsevier, 2003, 21 (12), pp.1019-1026.

bemd(self, image, max_imf=-1)[source]

Performs bidimensional EMD (BEMD) on grey-scale image with specified parameters.

image : numpy 2D array,

Grey-scale image.

max_imf : int, (default: -1)

IMF number to which decomposition should be performed. Negative value means all.

IMFs : numpy 3D array

Set of IMFs in form of numpy array where the first dimension relates to IMF’s ordinary number.

check_proto_imf(self, proto_imf, proto_imf_prev, mean_env)[source]

Check whether passed (proto) IMF is actual IMF. Current condition is solely based on checking whether the mean is below threshold.

proto_imf : numpy 2D array

Current iteration of proto IMF.

proto_imf_prev : numpy 2D array

Previous iteration of proto IMF.

mean_env : numpy 2D array

Local mean computed from top and bottom envelopes.


Whether current proto IMF is actual IMF.

classmethod end_condition(cls, image, IMFs)[source]

Determins whether decomposition should be stopped.

image : numpy 2D array

Input image which is decomposed.

IMFs : numpy 3D array

Array for which first dimensions relates to respective IMF, i.e. (numIMFs, imageX, imageY).

extract_max_min_spline(self, image, min_peaks_pos, max_peaks_pos)[source]

Calculates top and bottom envelopes for image.

image : numpy 2D array
min_env : numpy 2D array

Bottom envelope in form of an image.

max_env : numpy 2D array

Top envelope in form of an image.

classmethod find_extrema_positions(cls, image)[source]

Finds extrema, both mininma and maxima, based on morphological reconstruction. Returns extrema where the first and second elements are x and y positions, respectively.

image : numpy 2D array

Monochromatic image or any 2D array.

min_peaks_pos : numpy array

Minima positions.

max_peaks_pos : numpy array

Maxima positions.

classmethod spline_points(cls, X, Y, Z, xi, yi)[source]

Creates a spline for given set of points.

Uses Radial-basis function to extrapolate surfaces. It’s not the best but gives something. Griddata algorithm didn’t work.