import numpy as np
import cv2
import matplotlib.pyplot as plt
img1 = cv2.imread("./images/test.jpg")
kenel = np.ones((10,10),np.uint8)
top = cv2.morphologyEx(img1,cv2.MORPH_TOPHAT,kenel)
black = cv2.morphologyEx(img1,cv2.MORPH_BLACKHAT,kenel)
plt.figure("img show")
plt.subplot(1,2,1,title='top')
plt.imshow(top)
plt.subplot(1,2,2,title='black')
plt.imshow(black)
plt.show()