Applying some image kernel(s) on a grayscale or RGB color-scale image
Project description
Pyimkernel
With this package, You can apply various image kernels such as Blur, Sobel, Scharr and so forth (The comprehensive list of image kernels is mentioned below) on a grayscale or RGB color-scale image, and then show them. These effects and enhancements in digital images can be achieved using the "ApplyKernels" class, allowing for a wide range of transformations.
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
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(cv2.cvtColor(image1, cv2.COLOR_BGR2RGB), figsize=(6, 6))
# Show the filtered flower image
blurred_image = imkernel.apply_filter_on_color_img(image1, kernel_name='box blur', with_resize=True, dsize=(100, 100))
imkernel.imshow(image=cv2.cvtColor(blurred_image, cv2.COLOR_BGR2RGB))
sharpened_image = imkernel.apply_filter_on_color_img(image1, kernel_name='sharpen', with_resize=True)
imkernel.imshow(image=cv2.cvtColor(sharpened_image, cv2.COLOR_BGR2RGB), figsize=(6, 6))
imkernel.imshow(image=cv2.cvtColor(imkernel.apply_filter_on_color_img(sharpened_image, kernel_name='soften'),
cv2.COLOR_BGR2RGB), figsize=(6, 6))
imkernel.imshow(image=cv2.cvtColor(imkernel.apply_filter_on_color_img(sharpened_image, kernel_name='unsharp masking'),
cv2.COLOR_BGR2RGB), figsize=(6, 6))
The Grayscale Output
Before Applying a Blur Kernel on a grayscale image 9
After Applying a Blur Kernel on a grayscale image 9
The Color Scale Output
Before Applying a Box Blur Kernel on a color-scale flower image
After Applying a Box Blur Kernel on a color-scale flower image and assigning True to the with_resize parameter and (100, 100) to the dsize parameter
After Applying a Sharpen Kernel on a color-scale flower image and assigning True to the with_resize parameter and 'auto' to the dsize parameter
After Applying a Soften Kernel on a color-scale image, which was filtered using the Sharpen Kernel before, and assigning False to the with_resize parameter
After Applying an Unsharp Masking Kernel on a color-scale image, which was filtered using the Sharpen Kernel before, and assigning False to the with_resize parameter
Package Status
All Tests Passed Successfully.
Maintainer Contact
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyimkernel-1.0.0.tar.gz.
File metadata
- Download URL: pyimkernel-1.0.0.tar.gz
- Upload date:
- Size: 2.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d499468b8e88e5364e0fefe80d9ce16c9ea5a6cbe521b7a1cf62ea106e380e4b
|
|
| MD5 |
0a8245a38c28fc8e6ef7e8dd5cf2e3b0
|
|
| BLAKE2b-256 |
1e81a0f77c2bba6aa2e04409bc456f27b5e3a11742cf2667f1896c6e76a2cd4a
|
File details
Details for the file pyimkernel-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyimkernel-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2995afc524f0aea367a2b8ec6b14db4653d594b00cc0053eb3080cd43d43ffd7
|
|
| MD5 |
1cd117f0b675745af9edb2811c35a0b2
|
|
| BLAKE2b-256 |
4ad7f0ba29af26f3331db423dbd075b19507ac63ea4c603963d6714066c0b7b6
|