mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-19 12:40:22 +08:00
Inline crandn function.
This commit is contained in:
@@ -332,17 +332,6 @@ def image_quad_norm(inarray):
|
||||
return np.sum(np.sum(np.abs(inarray)**2, axis=-1), axis=-1)
|
||||
|
||||
|
||||
def crandn(shape):
|
||||
"""white complex gaussian noise
|
||||
|
||||
Generate directly the unitary Fourier transform of white gaussian
|
||||
noise noise field (with given shape) of zero mean and variance
|
||||
unity (ie N(0,1)).
|
||||
"""
|
||||
return np.sqrt(0.5) * (np.random.standard_normal(shape) +
|
||||
1j * np.random.standard_normal(shape))
|
||||
|
||||
|
||||
def ir2tf(imp_resp, shape, dim=None, real=True):
|
||||
"""Compute the transfer function of IR
|
||||
|
||||
|
||||
@@ -266,7 +266,9 @@ def unsupervised_wiener(data, psf, reg=None, user_params=None):
|
||||
|
||||
# weighing (correlation in direct space)
|
||||
precision = gn_chain[-1] * atf2 + gx_chain[-1] * areg2 # Eq. 29
|
||||
excursion = uft.crandn(data.shape) / np.sqrt(precision)
|
||||
excursion = np.sqrt(0.5) / np.sqrt(precision) * (
|
||||
np.random.standard_normal(data.shape) +
|
||||
1j * np.random.standard_normal(data.shape))
|
||||
|
||||
# mean Eq. 30 (RLS for fixed gn, gamma0 and gamma1 ...)
|
||||
wiener_filter = gn_chain[-1] * np.conj(trans_fct) / precision
|
||||
|
||||
Reference in New Issue
Block a user