![80c84f06913007664d83a30643bb57dc.png](https://i-blog.csdnimg.cn/blog_migrate/f86ae9b61538ecff4fd6dabca03ee7a4.png)
首先我们要了解一下什么叫均值滤波和中值滤波,在这里摘录两段题目中给出的介绍。
(a) Local averaging is a common method to denoise images (i.e. suppress noise) where a small square neighbourhood of odd size (e.g. 3x3, 5x5) around each pixel from the noisy image is taken and the average of this neighbourhood is computed. A new ‘denoised’ image is then formed where each pixel is the average from the local neighbourhood of the corresponding pixel in the noisy image.
(b) Median filtering is an alternate method to denoise images where a small square neighbourhood of odd size (e.g. 3x3, 5x5) around each pixel from the noisy image is taken and the median value of this neighbourhood is computed. A new ‘denoised’ image is then formed where each pixel is the median from the local neighbourhood of the corresponding pixel in the noisy image.
倘若未曾接触过图像处理,乍一看可能你也跟我一样毫无头绪。在写程序的过程中,我习惯遵循一个解决问题的方法,即提出问题,解决问题,遇到困难,针对性学习。在这 道题目中,我们要解决的第一个问题是matplotlib是如何处理图像数据的。 根据我最初的构想,因为有RGB三个通道,图像数据应该由一个三维矩阵构成,形状类似于这样。
![f6878a09b449e7def694b5ae490df7ed.png](https://i-blog.csdnimg.cn/blog_migrate/298d97d0d508cb494edac9e2a1f9e3c0.jpeg)
![91e11d0ff04f8418043bf15f4d7700af.png](https://i-blog.csdnimg.cn/blog_migrate/4312df03bc477e507ad9164a91d00ae6.jpeg)
![152a5d81f8325a5083fdda23e3153de0.png](https://i-blog.csdnimg.cn/blog_migrate/2cf2d0ec10ab7beb52c997366a3dda8e.png)
![aab6c9fb56d6838a01a3877bd216bfc8.png](https://i-blog.csdnimg.cn/blog_migrate/182c751640bc17bbf78cc3b7e7424f18.png)
![a38127cf7140b27ec1cf12e1885b2c36.png](https://i-blog.csdnimg.cn/blog_migrate/6560404440cc22d85c93bd4938da43bb.png)
![0aea93aae65605c07319611bf61e27a7.png](https://i-blog.csdnimg.cn/blog_migrate/78a077d85fc42f40ddf611d324744f5a.jpeg)
![7e2d393a01cac00b2ed739b9ff85ab2a.png](https://i-blog.csdnimg.cn/blog_migrate/52df312c8cf161d387743d86e7d82520.png)
![402863e9fce38b54c679e6d415783532.png](https://i-blog.csdnimg.cn/blog_migrate/fd76df368c2679bb59e5b168a8f96e6c.png)
![424de853f5a208b33a3247ee2fe4616a.png](https://i-blog.csdnimg.cn/blog_migrate/949a8815e438921f5a9a3d3ca59ef6a6.png)
![cd6fe373a5fac54334e262d48806e720.png](https://i-blog.csdnimg.cn/blog_migrate/2c78018a14ff40eaf16eee029d5b07c1.png)
List of References Huang, T., G. J. T. G. Y. Yang, and Greory Tang. "A fast two-dimensional median filtering algorithm." IEEE Transactions on Acoustics, Speech, and Signal Processing 27.1 (1979): 13-18. Median filter [Online] https://en.wikipedia.org/wiki/Median_filter [14 May 2020]