OpenCV and matplotlib sometimes give the same output, sometimes they give different output, when displaying an image with their respective imshow
functions. What is the difference between them?
For example it gives the same output for this code:
img = cv2.imread("sudoku.jpg")
plt.figure()
plt.imshow(img, cmap="gray")
plt.axis("off")
plt.title("orjinal")
plt.show()
cv2.imshow("orjinal",img)
matplotlib:
OpenCV:
It gives different output for this code:
laplacian = cv2.Laplacian(img,ddepth=cv2.CV_16S)
plt.figure()
plt.imshow(laplacian, cmap="gray")
plt.axis("off")
plt.title("laplacian")
plt.show()
cv2.imshow("laplacian",laplacian)
matplotlib:
OpenCV: