图像去噪与滤波

2024-09-29 03:35:30 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在进行车牌识别。我把盘子切出来了,但它很模糊。因此,我无法分割数字/字符并识别它。

这是我的照片:

enter image description here

我试图通过使用scikit image函数对其进行去噪。

首先,导入库:

import cv2
from skimage import restoration
from skimage.filters import threshold_otsu, rank
from skimage.morphology import closing, square, disk

然后,我读取图像并将其转换为灰度

image = cv2.imread("plate.jpg")
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

我试图消除噪音:

denoise = restoration.denoise_tv_chambolle(image , weight=0.1)
thresh = threshold_otsu(denoise)
bw = closing(denoise  > thresh, square(2))

我得到的是:

enter image description here

如您所见,所有数字都是混合在一起的。因此,我无法将它们分开并逐个识别字符。

我期望的是这样的东西(我画出来):

enter image description here

我正在寻求帮助我如何才能更好地过滤图像?谢谢您。

===================================================================== 更新

在使用skimage.morphology.erosion之后,我得到:

enter image description here


Tags: from图像imageimportthreshold数字字符cv2