openCV3: Not getting the expected output on morphologically transforming an image in opencv
问题 I am trying to do top hat morphological transformation to an image but not getting the expected output for some reason. # Top Hat: difference between input image and opening kernel = np.ones((5,5),np.float32)/25 tophat = cv2.morphologyEx(img, cv2.MORPH_TOPHAT, kernel) plt.subplot(121),plt.imshow(img, cmap='gray'),plt.title('Original') plt.xticks([]), plt.yticks([]) plt.subplot(122),plt.imshow(tophat, cmap='gray'),plt.title('Top Hat') plt.xticks([]), plt.yticks([]) plt.show() What is expected