Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zori/e0a1f0025cb8ea9e9889b79b916d3aaa to your computer and use it in GitHub Desktop.
Save zori/e0a1f0025cb8ea9e9889b79b916d3aaa to your computer and use it in GitHub Desktop.
display opencv image using matplotlib in ipython notebook
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zori
Copy link
Author

zori commented Sep 4, 2018

For flipping BGR -> RGB one could do img2 = img[:, :, ::-1] where img is the color image (read by imread) but it feels hacky, so I like the self-documented solution.

img = cv2.imread('img.jpg')
img2 = img[:, :, ::-1]
plt.imshow(img)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment