当前位置:网站首页>[200 opencv routines] 100 Adaptive local noise reduction filter
[200 opencv routines] 100 Adaptive local noise reduction filter
2022-07-02 12:52:00 【Xiaobai youcans】
『OpenCV routine 100 piece 』 Sent out , Next, continue to send 【OpenCV routine 200 piece 】
【OpenCV routine 200 piece 】100. Adaptive local noise reduction filter
Welcome to your attention 『OpenCV routine 200 piece 100 piece 』 series , Ongoing update
Welcome to your attention 『Python Small white OpenCV Learning lessons 』 series , Ongoing update
3.7 Adaptive local noise reduction filter
The aforementioned filter is directly applied to image processing , The features of the image itself are not considered . Characteristics of adaptive filter m ∗ n m*n m∗n Rectangular neighborhood S x y Sxy Sxy The statistical characteristics of the image in the defined filtering region change . Usually , The performance of adaptive filter is better than that of the above filter , However, the complexity and computation of the filter are also greater .
Mean and variance are the most basic statistics of random variables . In image processing , The mean is the average gray level of the pixel neighborhood , Variance is the image contrast of the pixel neighborhood .
Make S x y Sxy Sxy Indicates that the center is at the point ( x , y ) (x,y) (x,y) 、 The size is m ∗ n m*n m∗n Rectangular sub window ( Neighborhood ), The filter is controlled by S x y Sxy Sxy Defined neighborhood operations .
Noise image at point ( x , y ) (x,y) (x,y) Value g ( x , y ) g(x,y) g(x,y), The variance of the noise σ η 2 \sigma^2_{\eta} ση2 Estimated from noisy images ; S x y Sxy Sxy The local average gray level of pixels in the is z ˉ S x y \bar{z}_{Sxy} zˉSxy, The local variance of gray scale is σ S x y 2 \sigma^2_{Sxy} σSxy2.
Image restored using adaptive local noise reduction filter f ^ \hat{f} f^ At point ( x , y ) (x,y) (x,y) Value , Described by the following adaptive expression :
f ^ ( x , y ) = g ( x , y ) − σ η 2 σ S x y 2 [ g ( x , y ) − z S x y ˉ ] \hat{f}(x,y) = g(x,y) - \frac{\sigma^2_{\eta}}{\sigma^2_{Sxy}} [g(x,y)-\bar{z_{Sxy}}] f^(x,y)=g(x,y)−σSxy2ση2[g(x,y)−zSxyˉ]
routine 9.14: Adaptive local noise reduction filter
# 9.14: Adaptive local noise reduction filter (Adaptive local noise reduction filter)
img = cv2.imread("../images/Fig0507b.tif", 0) # flags=0 Read as grayscale image
hImg = img.shape[0]
wImg = img.shape[1]
m, n = 5, 5
imgAriMean = cv2.boxFilter(img, -1, (m, n)) # Arithmetic average filtering
# Edge fill
hPad = int((m-1) / 2)
wPad = int((n-1) / 2)
imgPad = np.pad(img.copy(), ((hPad, m-hPad-1), (wPad, n-wPad-1)), mode="edge")
# Estimate the noise variance of the original image sigmaEta
mean, stddev = cv2.meanStdDev(img)
sigmaEta = stddev ** 2
print(sigmaEta)
# Adaptive local noise reduction
epsilon = 1e-8
imgAdaLocal = np.zeros(img.shape)
for i in range(hImg):
for j in range(wImg):
pad = imgPad[i:i+m, j:j+n] # Neighborhood Sxy, m*n
gxy = img[i,j] # Pixels of noisy image
zSxy = np.mean(pad) # Local average gray level
sigmaSxy = np.var(pad) # Local variance of gray level
rateSigma = min(sigmaEta / (sigmaSxy + epsilon), 1.0) # Additive noise hypothesis :sigmaEta/sigmaSxy < 1
imgAdaLocal[i, j] = gxy - rateSigma * (gxy - zSxy)
plt.figure(figsize=(9, 6))
plt.subplot(131), plt.axis('off'), plt.title("Original")
plt.imshow(img, cmap='gray', vmin=0, vmax=255)
plt.subplot(132), plt.axis('off'), plt.title("Arithmentic mean filter")
plt.imshow(imgAriMean, cmap='gray', vmin=0, vmax=255)
plt.subplot(133), plt.axis('off'), plt.title("Adaptive local filter")
plt.imshow(imgAdaLocal, cmap='gray', vmin=0, vmax=255)
plt.tight_layout()
plt.show()

( At the end of this section )
Copyright notice :
[email protected] Original works , Reprint must be marked with the original link
Copyright 2021 youcans, XUPT
Crated:2022-2-1
Welcome to your attention 『OpenCV routine 200 piece 100 piece 』 series , Ongoing update
Welcome to your attention 『Python Small white OpenCV Learning lessons 』 series , Ongoing update【OpenCV routine 200 piece 】01. Image reading (cv2.imread)
【OpenCV routine 200 piece 】02. Image saving (cv2.imwrite)
【OpenCV routine 200 piece 】03. Image display (cv2.imshow)
【OpenCV routine 200 piece 】04. use matplotlib Display images (plt.imshow)
【OpenCV routine 200 piece 】05. The properties of the image (np.shape)
【OpenCV routine 200 piece 】06. Pixel editing (img.itemset)
【OpenCV routine 200 piece 】07. Image creation (np.zeros)
【OpenCV routine 200 piece 】08. Copy of image (np.copy)
【OpenCV routine 200 piece 】09. Image clipping (cv2.selectROI)
【OpenCV routine 200 piece 】10. Image stitching (np.hstack)
【OpenCV routine 200 piece 】11. Split of image channel (cv2.split)
【OpenCV routine 200 piece 】12. Merging of image channels (cv2.merge)
【OpenCV routine 200 piece 】13. The addition of images (cv2.add)
【OpenCV routine 200 piece 】14. The image is added to the scalar (cv2.add)
【OpenCV routine 200 piece 】15. Weighted addition of images (cv2.addWeight)
【OpenCV routine 200 piece 】16. Addition of images of different sizes
【OpenCV routine 200 piece 】17. Gradient switching between two images
【OpenCV routine 200 piece 】18. Mask addition of images
【OpenCV routine 200 piece 】19. The circular mask of the image
【OpenCV routine 200 piece 】20. Bitwise operation of image
【OpenCV routine 200 piece 】21. Image overlay
【OpenCV routine 200 piece 】22. Add non Chinese text to the image
【OpenCV routine 200 piece 】23. Add Chinese text to the image
【OpenCV routine 200 piece 】23. Add Chinese text to the image
【OpenCV routine 200 piece 】24. Affine transformation of image
【OpenCV routine 200 piece 】25. Translation of image
【OpenCV routine 200 piece 】26. The rotation of the image ( Centered on the origin )
【OpenCV routine 200 piece 】27. The rotation of the image ( Centered on any point )
【OpenCV routine 200 piece 】28. The rotation of the image ( Right angle rotation )
【OpenCV routine 200 piece 】29. Image flipping (cv2.flip)
【OpenCV routine 200 piece 】30. Image zooming (cv2.resize)
【OpenCV routine 200 piece 】31. Image pyramid (cv2.pyrDown)
【OpenCV routine 200 piece 】32. Image distortion ( Crosscutting )
【OpenCV routine 200 piece 】33. Composite transformation of image
【OpenCV routine 200 piece 】34. Projection transformation of image
【OpenCV routine 200 piece 】35. Projection transformation of image ( Border filling )
【OpenCV routine 200 piece 】36. Conversion of rectangular coordinates and polar coordinates
【OpenCV routine 200 piece 】37. Gray processing and binary processing of image
【OpenCV routine 200 piece 】38. Inverse color transformation of image ( Image reversal )
【OpenCV routine 200 piece 】39. Linear transformation of image gray
【OpenCV routine 200 piece 】40. Image piecewise linear gray scale transformation
【OpenCV routine 200 piece 】41. Gray scale transformation of image ( Grayscale stratification )
【OpenCV routine 200 piece 】42. Gray scale transformation of image ( Bit plane layering )
【OpenCV routine 200 piece 】43. Gray scale transformation of image ( Logarithmic transformation )
【OpenCV routine 200 piece 】44. Gray scale transformation of image ( Gamma transform )
【OpenCV routine 200 piece 】45. Gray histogram of the image
【OpenCV routine 200 piece 】46. Histogram equalization
【OpenCV routine 200 piece 】47. Image enhancement — Histogram matching
【OpenCV routine 200 piece 】48. Image enhancement — Color histogram matching
【OpenCV routine 200 piece 】49. Image enhancement — Local histogram processing
【OpenCV routine 200 piece 】50. Image enhancement — Histogram statistics image enhancement
【OpenCV routine 200 piece 】51. Image enhancement — Histogram back tracking
【OpenCV routine 200 piece 】52. Image correlation and convolution
【OpenCV routine 200 piece 】53. Scipy Realize image two-dimensional convolution
【OpenCV routine 200 piece 】54. OpenCV Realize image two-dimensional convolution
【OpenCV routine 200 piece 】55. Separable convolution kernel
【OpenCV routine 200 piece 】56. Low pass cartridge filter
【OpenCV routine 200 piece 】57. Low pass Gaussian filter
【OpenCV routine 200 piece 】58. Nonlinear filtering — median filtering
【OpenCV routine 200 piece 】59. Nonlinear filtering — Bilateral filtering
【OpenCV routine 200 piece 】60. Nonlinear filtering — Joint bilateral filtering
【OpenCV routine 200 piece 】61. Guided filtering (Guided filter)
【OpenCV routine 200 piece 】62. Sharpen the image —— Passivation masking
【OpenCV routine 200 piece 】63. Sharpen the image ——Laplacian operator
【OpenCV routine 200 piece 】64. Sharpen the image ——Sobel operator
【OpenCV routine 200 piece 】65. Sharpen the image ——Scharr operator
【OpenCV routine 200 piece 】66. Low pass of image filtering / qualcomm / Band stop / Bandpass
【OpenCV routine 200 piece 】67. Comprehensive application of image enhancement in spatial domain
【OpenCV routine 200 piece 】68. Comprehensive application of image enhancement in spatial domain
【OpenCV routine 200 piece 】69. Discontinuous Fourier coefficients
【OpenCV routine 200 piece 】70. Fourier transform of one-dimensional continuous function
【OpenCV routine 200 piece 】71. Sampling of continuous functions
【OpenCV routine 200 piece 】72. One dimensional discrete Fourier transform
【OpenCV routine 200 piece 】73. Two dimensional continuous Fourier transform
【OpenCV routine 200 piece 】74. Anti aliasing of images
【OpenCV routine 200 piece 】75. Numpy Realize image Fourier transform
【OpenCV routine 200 piece 】76. OpenCV Realize image Fourier transform
【OpenCV routine 200 piece 】77. OpenCV Realize fast Fourier transform
【OpenCV routine 200 piece 】78. Fundamentals of image filtering in frequency domain
【OpenCV routine 200 piece 】79. The basic steps of image filtering in frequency domain
【OpenCV routine 200 piece 】80. Detailed steps of image filtering in frequency domain
【OpenCV routine 200 piece 】81. Gaussian low pass filter in frequency domain
【OpenCV routine 200 piece 】82. Butterworth low pass filter in frequency domain
【OpenCV routine 200 piece 】83. Low pass filtering in frequency domain : Printed text character repair
【OpenCV routine 200 piece 】84. The high pass filter is obtained from the low pass filter
【OpenCV routine 200 piece 】85. Application of high pass filter in frequency domain
【OpenCV routine 200 piece 】86. Frequency domain filtering applications : Fingerprint image processing
【OpenCV routine 200 piece 】87. Frequency domain passivation masking
【OpenCV routine 200 piece 】88. Laplace high pass filter in frequency domain
【OpenCV routine 200 piece 】89. Transfer function of band stop filter
【OpenCV routine 200 piece 】90. Frequency domain notch filter
【OpenCV routine 200 piece 】91. Gaussian noise 、 rayleigh noise 、 Irish noise
【OpenCV routine 200 piece 】92. Exponential noise 、 Uniform noise 、 Salt and pepper noise
【OpenCV routine 200 piece 】93. Histogram of noise model
【OpenCV routine 200 piece 】94. Arithmetic average filter
【OpenCV routine 200 piece 】95. Geometric mean filter
【OpenCV routine 200 piece 】96. Harmonic averaging filter
【OpenCV routine 200 piece 】97. Anti harmonic averaging filter
【OpenCV routine 200 piece 】98. Statistical sorting filter
【OpenCV routine 200 piece 】99. Modified alpha mean filter
【OpenCV routine 200 piece 】100. Adaptive local noise reduction filter
边栏推荐
- PXE installation UOS prompt NFS over TCP not available from 10 x.x.x
- 绕过ObRegisterCallbacks需要驱动签名方法
- Shuttle encapsulated AppBar
- IPhone 6 plus is listed in Apple's "retro products" list
- C modifier
- 区间DP AcWing 282. 石子合并
- Obtain file copyright information
- 浏览器存储方案
- Js1day (input / output syntax, data type, data type conversion, VaR and let differences)
- Redis bloom filter
猜你喜欢

Async/await asynchronous function
![[ybtoj advanced training guidance] cross the river [BFS]](/img/4e/83f14452ea6410768cdd01e725af2e.jpg)
[ybtoj advanced training guidance] cross the river [BFS]

spfa AcWing 852. SPFA judgement negative ring

Rust search server, rust quick service finding tutorial

JS6day(DOM结点的查找、增加、删除。实例化时间,时间戳,时间戳的案例,重绘和回流)

Js1day (syntaxe d'entrée / sortie, type de données, conversion de type de données, Var et let différenciés)

Redis bloom filter
![JDBC 预防sql注入问题与解决方法[PreparedStatement]](/img/32/f71f5a31cdf710704267ff100b85d7.png)
JDBC 预防sql注入问题与解决方法[PreparedStatement]
![[ybtoj advanced training guide] similar string [string] [simulation]](/img/eb/acfefc7f85018fe9365d13502e2b0a.jpg)
[ybtoj advanced training guide] similar string [string] [simulation]

Apply lnk306gn-tl converter, non isolated power supply
随机推荐
Fluent fluent library encapsulation
Shuttle encapsulated AppBar
Obtain file copyright information
Five best software architecture patterns that architects must understand
计数类DP AcWing 900. 整数划分
堆 AcWing 839. 模拟堆
VLAN experiment
JS8day(滚动事件(scroll家族),offset家族,client家族,轮播图案例(待做))
Deep copy event bus
3 a VTT terminal regulator ncp51200mntxg data
Ltc3307ahv meets EMI standard, step-down converter qca7005-al33 phy
JS7day(事件对象,事件流,事件捕获和冒泡,阻止事件流动,事件委托,学生信息表案例)
Js3day (array operation, JS bubble sort, function, debug window, scope and scope chain, anonymous function, object, Math object)
Direct control PTZ PTZ PTZ PTZ camera debugging (c)
Win10 system OmniPeek wireless packet capturing network card driver failed to install due to digital signature problem solution
Variable, "+" sign, data type
Js10day (API phased completion, regular expression introduction, custom attributes, filtering sensitive word cases, registration module verification cases)
线性DP AcWing 896. 最长上升子序列 II
C#运算符
Hash table acwing 841 String hash