I am doing the erosion example from the OpenCV3 documentation but the color of the image change to purple yellow instead of black and white despite the fact that I changed while reading the image. The default image is also black and white. Though if I don't change the image to black and white it shows correctly.
img = cv2.imread('j.png', 0) # 0 for black and white
kernel = np.ones((5,5), np.uint8)
erosion = cv2.erode(img, kernel, iterations=1)
plt.subplot(121), plt.imshow(img), plt.title('Original')
plt.xticks([]), plt.yticks([])
plt.subplot(122), plt.imshow(erosion), plt.title('Erosion')
plt.xticks([]), plt.yticks([])
plt.show()