No project description provided
Project description
Image Processing
Toolbox to perform image processing.
Libraries
- Install numpy, scipy, matplotlib, pillow.
Documentation
imgmagic.display.greyscale(x: numpy.ndarray)
Function that converts image into greyscale. Parameters: x : numpy.ndarray Image to convert. Returns: output : numpy.ndarray Returns the greyscale image.
imgmagic.geometric.crop(img:numpy.ndarray, x:Tuple[int], width:int, height:int)
Function that crops an image. Parameters: img : numpy.ndarray Image to crop. x : Tuple[int] Coordiates of starting point. width : int Width of the cropped image. height : int Height of the cropped image. Returns: output : numpy.ndarray Cropped image.
imgmagic.geometric.rotate(img:numpy.ndarray, degree:float)
Function that rotates an image. Parameters: img : numpy.ndarray Image to rotate. degree : int Angle of rotaion (degrees). This parameter can be positive or negative. Returns: output : numpy.ndarray Rotated image.
imgmagic.geometric.flipping(img:numpy.ndarray)
Function that flips an image. Parameters: img : numpy.ndarray Image to rotate. Returns: output : numpy.ndarray Flipped image.
imgmagic.geometric.scaling(img:numpy.ndarray, scale:float)
Function that scales an image. Parameters: img : numpy.ndarray Image to scale. scale : float Factor of scaling (ex. 0.5, 1.25, 2...etc). Returns: output : numpy.ndarray Scaled image.
imgmagic.geometric.reverse(img:numpy.ndarray)
Function that reverts an image. Parameters: img : numpy.ndarray Image to reverse. Returns: output : numpy.ndarray Reverted image.
imgmagic.histogram.adjustContrast(img:numpy.ndarray)
Function that performs contrast stretching. Parameters: img : numpy.ndarray Input image. Returns: output : numpy.ndarray Image (with contrat stretching).
imgmagic.histogram.equalization(img:numpy.ndarray)
Function that performs histogram equalization. Parameters: img : numpy.ndarray Input image. Returns: output : numpy.ndarray Image (with equalization).
imgmagic.histogram.negative(img:numpy.ndarray)
Function that performs computes digital negative of an image. s = T( r ) = (L – 1) – r Parameters: img : numpy.ndarray Input image. Returns: output : numpy.ndarray Image (negative).
imgmagic.filter.GaussianNoise(img:numpy.ndarray, mean:float, sigma:float)
Function that adds gaussian noise to an image. Parameters: img : numpy.ndarray Input image. mean, sigma : float Parameters for gaussian distribution. Returns: output : numpy.ndarray Image (with noise).
imgmagic.filter.SaltnPepperNoise(img:numpy.ndarray, prob:float)
Function that adds salt and pepper noise. Parameters: img : numpy.ndarray Input image. prob : float Probability for salting (ex. 0.01 ...etc). Returns: output : numpy.ndarray Image (with noise).
imgmagic.filter.filtering(img:numpy.ndarray, types:str, mode:str, *args: Tuple[Any])
Function that perfoms filtering on an image. Parameters: img : numpy.ndarray Input image. types : {"lowpass", "highpass", "avg", "gauss"} Type of filter. mode : {"reflect", "constant", "nearest", "mirror", "wrap"} Type of padding. args : float Extra arguments (optional). For instance, it can be: n : size for avg filter Returns: output : numpy.ndarray Image (filtered).
imgmagic.filter.sharpening(img:numpy.ndarray, types:str, mode:str)
Function that perfoms sharpening on an image. Parameters: img : numpy.ndarray Input image. types : {"laplacian", "sobel", "roberts"} Type of filter. mode : {"reflect", "constant", "wrap"} Type of padding. Returns: output : numpy.ndarray Image (filtered).
imgmagic.filter.crosscorrelation(img:numpy.ndarray, filters:str, sub:numpy.ndarray)
Function that find a subimage in an image. Parameters: img : numpy.ndarray Input image. filters : {"laplacian", "sobel", "roberts"} Type of filter. sub : numpy.ndarray Subimage image. Returns: output : numpy.ndarray Image (found).
imgmagic.fourier.ftfiltering(img:numpy.ndarray, filters:str, *args: Tuple[Any])
Function that perfoms sharpening on an image. Parameters: img : numpy.ndarray Input image. filters : {"lowpass", "blowpass", "glowpass", "highpass", "bhighpass", "ghighpass", "bandreject", "bandpass", "homomorphic"} Type of filter. args : float Extra arguments (optional). For instance, it can be: D0 : cutoff frequency for Ideal filter ("lowpass", "highpass") D0, n : cutoff frequency, order for Butterworth filter ("blowpass", "bhighpass") sigma : cutoff frequency for Gaussian filter ("glowpass", "ghighpass") Returns: output : numpy.ndarray Image (filtered).
imgmagic.fourier.UnsharpMasking(img:numpy.ndarray, D0:int, k:int)
Function that performs Unsharp Masking and Highboost filtering. Parameters: img : numpy.ndarray Input image. k : float Parameter: k=1 - unsharp masking k>1 - highboost filtering Returns: output : numpy.ndarray Image.
imgmagic.fourier.HighFreqEmph(img:numpy.ndarray, D0:int, k1:int, k2:int)
Function that performs High-frequency emphasis. Parameters: img : numpy.ndarray Input image. k1, k2 : float Parameters: k1=1 k2=1 - unsharp masking k2>1 - highboost filtering Returns: output : numpy.ndarray Image.
Example
import imgmagic
import numpy
import matplotlib.image as mpimg
from PIL import Image
filename = "img.jpeg"
img1 = mpimg.imread(filename)
img2 = imgmagic.filter.filtering(img1, "avg", "wrap", 9)
im = Image.fromarray(img2)
im.save("new.jpeg")
see Image Processing toolbox on github.
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 Distributions
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 imgmagic-0.2.0-py3-none-any.whl.
File metadata
- Download URL: imgmagic-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
075c028e43e57412fb04ea08fc8376b34d658c502a168c9bc68e28e17e9be94e
|
|
| MD5 |
ebbb2611e896227fc86922875afc1e5c
|
|
| BLAKE2b-256 |
f402f6729981cf3cb9f05f6ac4526542396db4d32d21b49256a5403a6a05c2e1
|