9.opencv-python;cv2库;形态学;MORPH_TOPHAT礼帽与MORPH_BLACKHAT黑帽
importcv2#opencv读取的格式是BGRimportnumpyasnpimportmatplotlib.pyplotasplt#Matplotlib是RGB%matplotlibinline#读取img=cv2.imread('lena.jpg')img_gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)#图像二值化ret,thresh1=cv2.thre