Skip to main content

Using matplotlib_imshow for images read by cv2

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cv2_plt_imshow-0.0.1.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

cv2_plt_imshow-0.0.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file cv2_plt_imshow-0.0.1.tar.gz.

File metadata

  • Download URL: cv2_plt_imshow-0.0.1.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.7

File hashes

Hashes for cv2_plt_imshow-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e7f33fe6b8e3aa00bd18e61a879a9b6014873dfb962e8afc225f6fd758c7a6fc
MD5 587bca0e0110c689da432c9229c8d4ad
BLAKE2b-256 c196300763974de5d8b140b97c8a976c203508aa26de8c831d7dc41985ad85fb

See more details on using hashes here.

File details

Details for the file cv2_plt_imshow-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: cv2_plt_imshow-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.7

File hashes

Hashes for cv2_plt_imshow-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc889a4796bd84eab2d886c7e3ff0080ce2c9eb16a20867e16a7ce8309e68813
MD5 8f1a266a8bb4a25a44d8b783d42346df
BLAKE2b-256 cb9de276c41b1c407815a4b60d46860aa7ca661527d0a577d8b68cb0c90ca10c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page