Proposal for New Scipy Function: fwind1() for 2D FIR Filter Design Using 1D Window Method
"Sagi Ezri" <[email protected]> Thu, 27 Apr 2023 10:41:12 -0000
| Newsgroups | gmane.comp.python.scientific.devel |
|---|---|
| Message-ID | <[email protected]> |
Dear Scipy Development Community,
I am writing to propose a new function for inclusion in the Scipy library, called `fwind1()`, which implements 2D FIR filter design using the window method.
The `fwind1()` function computes the coefficients of a 2D finite impulse response filter that is separable with linear phase. The filter is designed as a product of two 1D filters with dimensions defined by the `hsize` parameter. The `window` parameter specifies the desired window to use for each 1D filter, and the `fc` parameter specifies the cutoff frequency of the filter.
The `fwind1()` function is inspired by the `fwind1()` function in Matlab's Image Processing Toolbox. However, it is implemented from scratch and provides a Pythonic interface consistent with other Scipy signal processing functions.
Here is an example usage of the `fwind1()` function:
```
import numpy as np
from scipy.signal import get_window
from scipy.signal import fwind1
# Generate a 5x5 low-pass filter with cutoff frequency 0.1.
filter_2d = fwind1((5, 5), (get_window(('kaiser', 5.0)), 'boxcar'), 0.1)
print(filter_2d)
```
Output:
```
array([[0.003, 0.023, 0.052, 0.023, 0.003],
[0.023, 0.173, 0.391, 0.173, 0.023],
[0.052, 0.391, 0.882, 0.391, 0.052],
[0.023, 0.173, 0.391, 0.173, 0.023],
[0.003, 0.023, 0.052, 0.023, 0.003]])
```
As this is a new function, I would appreciate feedback from the Scipy development community on the proposed implementation and whether there is a consensus on adding it to Scipy. I believe this function could be a useful addition to the Scipy library, especially for researchers and practitioners in the field of image processing.
Thank you for your consideration and I look forward to your feedback.
Sincerely,
Sagi Ezri
_______________________________________________
SciPy-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/scipy-dev.python.org/
Member address: [email protected]