Experimental

Also known as not supported.

Methods discussed and provided here have no guarantee to work or provide any meaningful results. These are somehow abandoned projects and unfortunately mid-way through. They aren’t completely discarded simply because of hope that maybe someday someone will come and help fix them. We all know that the best motivation to do something is to be annoyed by the current state. Seriously though, mode decomposition in 2D and multi-dim is an interesting topic. Please?

BEMD

Warning

Important This is an experimental module. Please use it with care as no guarantee can be given for obtaining reasonable results, or that they will be computed index the most computation optimal way.

Info

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

EMD2D

Warning

Important This is an experimental module. Please use it with care as no guarantee can be given for obtaining reasonable results, or that they will be computed index the most computation optimal way.

Info

EMD performed on images. This version uses for envelopes 2D splines, which are span on extrema defined through maximum filter.

Class

class PyEMD.EMD2d.EMD2D(**config)[source]

Empirical Mode Decomposition on images.

Important This is an experimental module. Experiments performed using this module didn’t provide acceptable results, either in actual output nor in computation performance. The author is not an expert in image processing so it’s very likely that the code could have been improved. Take your best shot.

Method decomposes images into 2D representations of loose Intrinsic Mode Functions (IMFs).

The current version of the algorithm detects local extrema, separately minima and maxima, and then connects them to create envelopes. These are then used to create a mean trend and subtracted from the input.

Threshold values that control goodness of the decomposition:
  • mse_thr — proto-IMF check whether small mean square error.
  • mean_thr — proto-IMF chekc whether small mean value.
__call__(image, max_imf=-1)[source]

Call self as a function.

__init__(**config)[source]

Initialize self. See help(type(self)) for accurate signature.

__weakref__

list of weak references to the object (if defined)

check_proto_imf(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.

Parameters:
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.

Returns:
boolean

Whether current proto IMF is actual IMF.

emd(image, max_imf=-1)[source]

Performs EMD on input image with specified parameters.

Parameters:
image : numpy 2D array,

Image which will be decomposed.

max_imf : int, (default: -1)

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

Returns:
IMFs : numpy 3D array

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

classmethod end_condition(image, IMFs)[source]

Determins whether decomposition should be stopped.

Parameters:
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(image)[source]

Calculates top and bottom envelopes for image.

Parameters:
image : numpy 2D array
Returns:
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(image)[source]

Finds extrema, both mininma and maxima, based on local maximum filter. Returns extrema in form of two rows, where the first and second are positions of x and y, respectively.

Parameters:
image : numpy 2D array

Monochromatic image or any 2D array.

Returns:
min_peaks : numpy array

Minima positions.

max_peaks : numpy array

Maxima positions.

classmethod prepare_image(image)[source]

Prepares image for edge extrapolation. Method bloats image by mirroring it along all axes. This turns extrapolation on edges into interpolation within bigger image.

Parameters:
image : numpy 2D array

Image for which interpolation is required,

Returns:
image : numpy 2D array

Big image based on the input. Grid 3x3 where the center block is input and neighbouring panels are respective mirror images.

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

Interpolates for given set of points