版权声明:本文为博主原创文章,可以自由转载。 https://blog.csdn.net/u010953692/article/details/83956877
opencv python 图像平滑和滤波
1,高斯滤波
#! /usr/local/bin/python3
# coding:utf-8
"""
图像二值化 全局阀值
"""
from PIL import Image
import cv2
src = "/root/captcha_png.png"
import cv2
img = cv2.imread(src , 0)
#高斯滤波
gauss = cv2.GaussianBlur(img,(5,5),0)
#全局二值化
ret , thresh1 = cv2.threshold(gauss ,127, 255, cv2.THRESH_BINARY)
cv2.imshow("gauss", thresh1)
cv2.waitKey()
- 原图
- 二值化 未滤波
- 二值化 高斯滤波
参考: