Menu

Tree [1e06bb] master 0.0.1 /
 History

HTTPS access


File Date Author Commit
 cv2_plt_imshow 2020-06-27 Rupesh Rupesh [770d2e] coding completed
 dist 2020-06-27 Rupesh Rupesh [1e06bb] whl build version 0.0.1 added
 images 2020-06-27 Rupesh Rupesh [097ff1] sample test images
 tests 2020-06-27 Rupesh Rupesh [bbaf44] created blank test
 .gitignore 2020-06-27 RUPESH RUPESH [c9df9e] Initial commit
 LICENSE 2020-06-27 RUPESH RUPESH [c9df9e] Initial commit
 README.md 2020-06-27 RUPESH RUPESH [ab7bc4] Update README.md
 setup.py 2020-06-27 Rupesh Rupesh [db3784] setup completed
 testing_notebook.ipynb 2020-06-27 Rupesh Rupesh [f51432] testing by jupyter notebook

Read Me

cv2_plt_imshow

Using matplotlib_imshow for images read by cv2

Introduction

One of the major issue faced while using cv2, especially when you are using jupyter-notebooks, is to perform cv2.imshow the kernel breaks. Apart from this, most of the users are comfortable using matplotlib for display, specially its display in notebook using %matplotlib inline magic.

This package provides two of the main function, converting the image to a format more suitable in matplotlib, and plotting the image using matplotlib in the notebooks.

Table of contents

Setup

pip install cv2_plt_imshow

Usage

import cv2
import matplotlib.pyplot as plt
from cv2_plt_imshow import cv2_plt_imshow, plt_format

# read image
im1 = cv2.imread('./images/potrait.jpg')

# use cv2_plt_imshow function to plot any image that was read by cv2, but is plotted using pyplot
cv2_plt_imshow(im1)

# Convert the image to be suitable for pyplot format and later use it for plotting using pyplot functions
im2 = cv2.imread('./images/landscape.jpg')
fig, axs = plt.subplots(2 , figsize=(20,20))
fig.suptitle('Vertically stacked subplots')
axs[0].imshow(plt_format(im1))
axs[1].imshow(plt_format(im2))

Dependencies

Contact

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.