opencv 我如何在Python中去除这张图片上的噪点?[closed]

uqjltbpv  于 2022-12-13  发布在  Python
关注(0)|答案(1)|浏览(132)

**已关闭。**此问题需要debugging details。当前不接受答案。

编辑问题以包含desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将有助于其他人回答问题。
5天前关闭。
Improve this question
我有下面的图像:

我想去除这个图像中的一些噪声。我已经尝试过使用OpenCV和下面的代码:

cv2.fastNlMeansDenoisingColored(image_sharp, None, 2, 10, 7, 20)

然而,返回给我的图像看起来完全相同:

有人有什么建议吗?

bwitn5fc

bwitn5fc1#

您可以在Python/OpenCV中进行除法规范化。

  • 读取输入
  • 转换为灰度
  • 应用高斯模糊
  • 将灰度图像除以模糊图像
  • 保存输出

输入:

import cv2
import numpy as np

# read the image
img = cv2.imread('equation.png')

# convert to gray
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

# blur
smooth = cv2.GaussianBlur(gray, None, sigmaX=100, sigmaY=100)

# divide gray by morphology image
division = cv2.divide(gray, smooth, scale=255)

# save results
cv2.imwrite('equation_division.jpg',division)

# show results
cv2.imshow('smooth', smooth)  
cv2.imshow('division', division)  
cv2.waitKey(0)
cv2.destroyAllWindows()

结果:

相关问题