bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / filters / _fft_based / butterworth
function
skimage.filters._fft_based:butterworth
source: /dev/scikit-image/src/skimage/filters/_fft_based.py :57
Signature
def butterworth ( image , cutoff_frequency_ratio = 0.005 , high_pass = True , order = 2.0 , channel_axis = None , * , squared_butterworth = True , npad = 0 ) Summary
Apply a Butterworth filter to enhance high or low frequency features.
Extended Summary
This filter is defined in the Fourier domain.
Parameters
image: (M[, N[, ..., P]][, C]) ndarrayInput image.
cutoff_frequency_ratio: float, optionalDetermines the position of the cut-off relative to the shape of the FFT. Receives a value between [0, 0.5].
high_pass: bool, optionalWhether to perform a high pass filter. If False, a low pass filter is performed.
order: float, optionalOrder of the filter which affects the slope near the cut-off. Higher order means steeper slope in frequency space.
channel_axis: int, optionalIf there is a channel dimension, provide the index here. If None (default) then all axes are assumed to be spatial dimensions.
squared_butterworth: bool, optionalWhen True, the square of a Butterworth filter is used. See notes below for more details.
npad: int, optionalPad each edge of the image by
npadpixels using numpy.pad'smode='edge'extension.
Returns
result: ndarrayThe Butterworth-filtered image.
Notes
A band-pass filter can be achieved by combining a high-pass and low-pass filter. The user can increase npad if boundary artifacts are apparent.
The "Butterworth filter" used in image processing textbooks (e.g. [1], [2]) is often the square of the traditional Butterworth filters as described by [3], [4]. The squared version will be used here if squared_butterworth is set to True. The lowpass, squared Butterworth filter is given by the following expression for the lowpass case:
with the highpass case given by
where is the absolute value of the spatial frequency, is the sampling frequency, the cutoff_frequency_ratio, and is the filter order [1]. When squared_butterworth=False, the square root of the above expressions are used instead.
Note that cutoff_frequency_ratio is defined in terms of the sampling frequency, . The FFT spectrum covers the Nyquist range () so cutoff_frequency_ratio should have a value between 0 and 0.5. The frequency response (gain) at the cutoff is 0.5 when squared_butterworth is true and when it is false.
Examples
Apply a high-pass and low-pass Butterworth filter to a grayscale and color image respectively:from skimage.data import camera, astronaut from skimage.filters import butterworth high_pass = butterworth(camera(), 0.07, True, 8) low_pass = butterworth(astronaut(), 0.01, False, 4, channel_axis=-1)✓
Aliases
-
skimage.filters.butterworth