macOS opencv python 图像滤波

版权声明:本文为博主原创文章,可以自由转载。 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()
  • 原图
    在这里插入图片描述
  • 二值化 未滤波
    在这里插入图片描述
  • 二值化 高斯滤波
    在这里插入图片描述

参考:

  1. openCV—Python(9)—— 图像平滑与滤波
  2. OpenCv-Python 图像滤波

猜你喜欢

转载自blog.csdn.net/u010953692/article/details/83956877
今日推荐