去除图像中的“噪音”或“孔洞”

问题描述

所以我有一个灰度图像(像元值为2的2D矩阵)。我正在使用python进行操作。

我希望它具有逐渐变化的价值,但是它带有一些明显不希望的“伪像”,如下面的图片中用红色标记的(以及周围的其他)。

I want to 'remove' the darker artifacts like the one marked in red

是否已经有一个已实现的库(或已知算法)以编程方式“填充”它们,就像“周围像素的加权平均值”一样? 它们可以被描述为“由-0.1或更小的值梯度包围的像素组”。

解决方法

有趣的问题,我编写了一个程序,该程序将循环遍历图像并通过对像素求平均来使其平滑。它寻找超过一定大小的绝对值,如果检测到,将对这两个值求平均值,从而重建矩阵。让我知道您的想法:

final HtmlForm loginForm = page.getForms().get(0);
final HtmlTextInput netID = loginForm.getInputByName("j_username");
netID.type(username);
final HtmlPasswordInput password = loginForm.getInputByName("j_password");
password.type(password);
final HtmlSubmitInput submit = loginForm.getInputByValue("Login");
page = submit.click();