示例#1
0

"""
Load reference image.
"""

img = util.ExampleImages().image('monarch.png', scaled=True,
                                 idxexp=np.s_[:,160:672], gray=True)


"""
Construct test image corrupted by 20% salt & pepper noise.
"""

np.random.seed(12345)
imgn = signal.spnoise(img, 0.2)


"""
Set regularization parameter and options for ℓ1-TV deconvolution solver. The regularization parameter used here has been manually selected for good performance.
"""

lmbda = 8e-1
opt = tvl1.TVL1Deconv.Options({'Verbose': True, 'MaxMainIter': 200,
                               'RelStopTol': 5e-3, 'gEvalY': False,
                               'AutoRho': {'Enabled': True}})


"""
Create solver object and solve, returning the the denoised image ``imgr``.
"""
示例#2
0
 def test_01(self):
     img = np.random.randn(64, 64)
     imgn = signal.spnoise(img, 0.5)
     assert imgn.shape == img.shape