or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

color.mddata.mddrawing.mdexposure.mdfeatures.mdfiltering.mdindex.mdio.mdmeasurement.mdmorphology.mdrestoration.mdsegmentation.mdtransform.mdutilities.md

restoration.mddocs/

0

# Restoration

1

2

Image restoration algorithms for recovering images from various types of degradation including noise, blur, and missing data. Includes denoising, deconvolution, and inpainting methods.

3

4

## Capabilities

5

6

### Denoising Methods

7

8

```python { .api }

9

def denoise_tv_chambolle(image, weight=0.1, eps=2e-4, max_num_iter=200, multichannel=False, channel_axis=None):

10

"""

11

Apply total variation denoising using Chambolle algorithm.

12

13

Parameters:

14

image : array_like

15

Input noisy image

16

weight : float, optional

17

Denoising weight parameter

18

eps : float, optional

19

Convergence tolerance

20

max_num_iter : int, optional

21

Maximum iterations

22

multichannel : bool, optional

23

Whether last axis is channels (deprecated)

24

channel_axis : int, optional

25

Axis for color channels

26

27

Returns:

28

ndarray

29

Denoised image

30

"""

31

32

def denoise_bilateral(image, win_size=None, sigma_color=None, sigma_spatial=1, bins=10000, mode='constant', cval=0, multichannel=False, channel_axis=None):

33

"""

34

Apply bilateral filtering for edge-preserving denoising.

35

36

Parameters:

37

image : array_like

38

Input noisy image

39

win_size : int, optional

40

Window size for filtering

41

sigma_color : float, optional

42

Color similarity standard deviation

43

sigma_spatial : float, optional

44

Spatial standard deviation

45

bins : int, optional

46

Number of bins for color quantization

47

mode : str, optional

48

Boundary condition mode

49

cval : float, optional

50

Constant value for boundaries

51

multichannel : bool, optional

52

Whether last axis is channels (deprecated)

53

channel_axis : int, optional

54

Axis for color channels

55

56

Returns:

57

ndarray

58

Denoised image

59

"""

60

61

def denoise_wavelet(image, method='BayesShrink', mode='soft', wavelet_levels=None, wavelet='db1', sigma=None, multichannel=False, convert2ycbcr=False, channel_axis=None, rescale_sigma=True):

62

"""

63

Perform wavelet denoising.

64

65

Parameters:

66

image : array_like

67

Input noisy image

68

method : str, optional

69

Denoising method ('BayesShrink', 'VisuShrink')

70

mode : str, optional

71

Thresholding mode ('soft' or 'hard')

72

wavelet_levels : int, optional

73

Number of wavelet decomposition levels

74

wavelet : str, optional

75

Wavelet to use

76

sigma : float, optional

77

Noise standard deviation

78

multichannel : bool, optional

79

Whether last axis is channels (deprecated)

80

convert2ycbcr : bool, optional

81

Convert to YCbCr color space

82

channel_axis : int, optional

83

Axis for color channels

84

rescale_sigma : bool, optional

85

Rescale sigma for multichannel

86

87

Returns:

88

ndarray

89

Denoised image

90

"""

91

92

def denoise_nl_means(image, patch_size=7, patch_distance=11, h=0.1, multichannel=False, fast_mode=True, sigma=0.0, preserve_range=False, channel_axis=None):

93

"""

94

Apply non-local means denoising.

95

96

Parameters:

97

image : array_like

98

Input noisy image

99

patch_size : int, optional

100

Size of patches for comparison

101

patch_distance : int, optional

102

Maximum distance for patch search

103

h : float, optional

104

Cut-off distance for patch comparison

105

multichannel : bool, optional

106

Whether last axis is channels (deprecated)

107

fast_mode : bool, optional

108

Use fast approximation

109

sigma : float, optional

110

Noise standard deviation

111

preserve_range : bool, optional

112

Keep original data range

113

channel_axis : int, optional

114

Axis for color channels

115

116

Returns:

117

ndarray

118

Denoised image

119

"""

120

```

121

122

### Deconvolution Methods

123

124

```python { .api }

125

def wiener(image, psf, balance, reg=None, is_real=True, clip=True):

126

"""

127

Apply Wiener deconvolution filter.

128

129

Parameters:

130

image : array_like

131

Input degraded image

132

psf : array_like

133

Point spread function

134

balance : float

135

Regularization parameter

136

reg : array_like, optional

137

Regularization operator

138

is_real : bool, optional

139

Whether to enforce real output

140

clip : bool, optional

141

Clip output to input range

142

143

Returns:

144

ndarray

145

Deconvolved image

146

"""

147

148

def richardson_lucy(image, psf, num_iter=50, clip=True, filter_epsilon=None):

149

"""

150

Apply Richardson-Lucy deconvolution.

151

152

Parameters:

153

image : array_like

154

Input degraded image

155

psf : array_like

156

Point spread function

157

num_iter : int, optional

158

Number of iterations

159

clip : bool, optional

160

Clip output to input range

161

filter_epsilon : float, optional

162

Regularization parameter

163

164

Returns:

165

ndarray

166

Deconvolved image

167

"""

168

169

def unsupervised_wiener(image, psf, reg=None, user_params=None, is_real=True, clip=True):

170

"""

171

Apply unsupervised Wiener deconvolution.

172

173

Parameters:

174

image : array_like

175

Input degraded image

176

psf : array_like

177

Point spread function

178

reg : array_like, optional

179

Regularization operator

180

user_params : dict, optional

181

User-defined parameters

182

is_real : bool, optional

183

Whether to enforce real output

184

clip : bool, optional

185

Clip output to input range

186

187

Returns:

188

ndarray

189

Deconvolved image

190

"""

191

```

192

193

### Inpainting

194

195

```python { .api }

196

def inpaint_biharmonic(image, mask, multichannel=False, channel_axis=None):

197

"""

198

Inpaint missing regions using biharmonic equation.

199

200

Parameters:

201

image : array_like

202

Input image with missing regions

203

mask : array_like

204

Binary mask of missing regions

205

multichannel : bool, optional

206

Whether last axis is channels (deprecated)

207

channel_axis : int, optional

208

Axis for color channels

209

210

Returns:

211

ndarray

212

Inpainted image

213

"""

214

```

215

216

### Noise Estimation

217

218

```python { .api }

219

def estimate_sigma(image, average_sigmas=False, multichannel=False, channel_axis=None):

220

"""

221

Estimate noise standard deviation from image.

222

223

Parameters:

224

image : array_like

225

Input image

226

average_sigmas : bool, optional

227

Return average sigma across channels

228

multichannel : bool, optional

229

Whether last axis is channels (deprecated)

230

channel_axis : int, optional

231

Axis for color channels

232

233

Returns:

234

float or ndarray

235

Estimated noise standard deviation

236

"""

237

```

238

239

## Types

240

241

```python { .api }

242

from typing import Optional, Union

243

from numpy.typing import NDArray

244

import numpy as np

245

246

# Restoration parameters

247

PSF = NDArray[np.floating]

248

NoiseVariance = Union[float, NDArray[np.floating]]

249

RegularizationParam = float

250

InpaintingMask = NDArray[np.bool_]

251

252

# Restoration results

253

DenoisedImage = NDArray[np.floating]

254

DeconvolvedImage = NDArray[np.floating]

255

InpaintedImage = NDArray[np.floating]

256

```