Skip to main content

Applying some image kernel(s) on a grayscale or color scale image

Project description

Pyimkernel

License: MIT GitHub repo size GitHub pull requests GitHub issues

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-scale image, and then show them. All of these happens using the "ApplyKernels" class to reach a wide range of effects and enhancements in digital images.

Installation

pip install pyimkernel

Usage

from pyimkernel import ApplyKernels
import mnist # pip install mnist
import cv2
import os

# 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')

# the Color-Scale image
# Read the flower image
image1 = cv2.imread(os.path.join('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
blurred_image = imkernel.apply_filter_on_color_img(image1, kernel_name='motion blur', with_resize=True)
imkernel.imshow(image=imkernel.apply_filter_on_gray_img(blurred_image, kernel_name='sharpen'),
                figsize=(7, 6), cmap=plt.cm.gray)

The Grayscale Output

Before Applying the blur kernel on a grayscale image 9

After Applying the blur kernel on a grayscale image 9

The Color Scale Output

Before Applying the laplacian kernel on a color-scale flower image

After Applying the Sharpen Kernel on a filtered color-scale image using the Motion Blur Kernel 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
  • motion blur



All Tests Passed.

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.7.1.tar.gz (2.2 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.7.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyimkernel-0.7.1.tar.gz
Algorithm Hash digest
SHA256 a403c8bc49013978fb16c81fcfe0dcbf66254f876b9843fb15e44459cb95e056
MD5 72b4606556e6bc2c01e1bdea0904f475
BLAKE2b-256 e4e6dd112a6de0eae1be86bbe6518672f29c7dfa1c9d58eb4645d1736b7b198a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyimkernel-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 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.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f18b1938acee4342cef0b8b6057dbc538992647a52bc6577be55815571344483
MD5 eb68e3fbbf181901c79dae6b80fb40ad
BLAKE2b-256 a5501693260d16a4883cc13533230aa29a74259c86a11047b0319fc7dffc5efe

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