import cv2
from skimage import data,color
import matplotlib.pyplot as plt
from skimage.morphology import disk
import skimage.filters.rank as sfr
img=cv2.imread('C:/Users/xpp/Desktop/Lena.png')#读取图像
grayImage=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
cv2.imshow('original',img)
auto=sfr.bottomhat(grayImage,disk(5))#半径为5的圆形滤波器
cv2.imshow("result",auto)
cv2.waitKey(0)
cv2.destroyAllWindows()
算法:bottomhat滤波是先计算图像的形态学的闭运算,然后用原图像减去运算的结果值,有点像黑帽操作。bottomhat使用结构元素计算区域的闭合,闭合结果与原始区域之间的差异。与在特定情况下合并区域的闭运算不同,bottom_hat计算通过这种合并生成的区域。结构元素的位置没有意义,因为闭运算对于参考点的选择是不变的。结构元素可选择,圆、矩形、椭圆、区域多边形、区域点等操作符生成。
文献:Juett, X. , & Qi, X. . (2005). Barcode localization using bottom-hat filter. Nsf Research Experience for Undergraduates.
Ooi, J. W. , Tay, L. C. , & Lai, W. K. . (2019). Bottom-hat filtering for Defect Detection with CNN Classification on Car Wiper Arm. 2019 IEEE 15th International Colloquium on Signal Processing & Its Applications (CSPA). IEEE.
链接:https://www.mathworks.com/help/images/ref/imbothat.html
https://www.mvtec.com/doc/halcon/12/en/bottom_hat.html
本文分享自 图像处理与模式识别研究所 微信公众号,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文参与 腾讯云自媒体同步曝光计划 ,欢迎热爱写作的你一起参与!