Skip to main content

Applying some image kernel(s) on an image

Project description

Pyimkernel

With this package, You can apply various image kernels such as Blur, Sobel, Scharr and so forth (The list of image kernels is mentioned below) on a grayscale or color image, and show images using the class ApplyKernels in this package to reach a wide range of effects and enhancements in digital images.

Installation

pip install pyimkernel

Usage

from pyimkernel import ApplyKernels
import mnist
import cv2

# Load data
X_train, X_test, y_train, y_test = mnist.train_images(), mnist.test_images(), mnist.train_labels(), mnist.test_labels()

# Create an instance
imkernel = ApplyKernels(random_seed=0)

# Grayscale
# Show image 9 
imkernel.imshow(X_train[19], cmap=plt.cm.gray)

# Apply blur kernel on a grayscale image 9
filtered_image = imkernel.apply_filter_on_gray_img(X_train[19], kernel_name='blur')

# Show the filtered image 9
imkernel.imshow(image=filtered_image, cmap='gray')

# Color Scale
# Read the flower image
image1 = cv2.imread('examples/Images/1.jpg')

# Show the flower image
imkernel.imshow(image1.reshape(image1.shape[0], -1), cmap='gray', figsize=(20, 10))

# Show the filtered flower image
imkernel.imshow(image=imkernel.apply_filter_on_color_img(image1, kernel_name='laplacian', with_resize=True),
                figsize=(7, 6), cmap='gray')

Grayscale Output

Before Applying the blur kernel on a grayscale image 9

After Applying the blur kernel on a grayscale image 9

Color Scale Output

Before Applying the laplacian kernel on a color scale flower image

After Applying the laplacian kernel on a color scale flower image and assigning True to the with_resize parameter

Image kernels

Image kernels are listed below:

  • blur
  • bottom sobel
  • emboss
  • identity
  • left sobel
  • outline
  • right sobel
  • sharpen
  • top sobel
  • horizontal edge
  • vertical edge
  • box blur
  • laplacian
  • prewitt horizontal edge
  • prewitt vertical edge
  • high-pass filter
  • unsharp masking
  • dilate
  • soften
  • scharr horizontal edge
  • scharr vertical edge

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

pyimkernel-0.5.0.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyimkernel-0.5.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file pyimkernel-0.5.0.tar.gz.

File metadata

  • Download URL: pyimkernel-0.5.0.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pyimkernel-0.5.0.tar.gz
Algorithm Hash digest
SHA256 a069b0121ade12b15212f38c770d526376cae381455daa339563a80ca42bf66a
MD5 1ffdc9e216384cda8ee252c34202d48c
BLAKE2b-256 41b121b3352368d52bb2357ed55e9edb72be76b0c8ed22f2146ca42c591808ab

See more details on using hashes here.

File details

Details for the file pyimkernel-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: pyimkernel-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pyimkernel-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7153b043771554f71dae6ae519699fe6f828156d212c2e7d05b8857c11a38a3
MD5 58d00bbd8bdcc65ceee07b9aafc4cc8e
BLAKE2b-256 fa4ded236fb1bffda07ebb5129041825dae9889b630c2d40354d8023e7ed0cba

See more details on using hashes here.

Supported by

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