Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何去除图像中的噪声?[Python,cv2]_Python_Opencv_Captcha_Opencv Python - Fatal编程技术网

如何去除图像中的噪声?[Python,cv2]

如何去除图像中的噪声?[Python,cv2],python,opencv,captcha,opencv-python,Python,Opencv,Captcha,Opencv Python,我是python和opencv的新手,我可以从中消除噪音并只保留文本图像: 我尝试了在stackoverflow上找到的所有东西,但没有得到正确的结果。我们无法完全消除图像中的噪声。我们只能尽量减少噪音。我使用了libscv2、numpy和matplotlid在这里我用图像颜色做了一个小例子: import numpy as np import cv2 from matplotlib import pyplot as plt img = cv2.imread("yourimage&

我是python和opencv的新手,我可以从中消除噪音并只保留文本图像:


我尝试了在stackoverflow上找到的所有东西,但没有得到正确的结果。

我们无法完全消除图像中的噪声。我们只能尽量减少噪音。我使用了libs
cv2
numpy
matplotlid
在这里我用图像颜色做了一个小例子:

import numpy as np
import cv2
from matplotlib import pyplot as plt

img = cv2.imread("yourimage")
b,g,r = cv2.split(img)           # get b,g,r
rgb_img = cv2.merge([r,g,b])     # switch it to rgb

# Denoising
dst = cv2.fastNlMeansDenoisingColored(img,None,10,10,7,21)

b,g,r = cv2.split(dst)           # get b,g,r
rgb_dst = cv2.merge([r,g,b])     # switch it to rgb

plt.subplot(211),plt.imshow(rgb_img)
plt.subplot(212),plt.imshow(rgb_dst)
plt.show()
输出:

有关更多详细信息,请参考教程opencv


看起来像是验证码。请介绍您的研究成果。@RSNight RSNight,请更新信息。这将有助于您避免再被投票(OMG,-2),也请反馈我的答案。