Welcome to ChitraPy’s documentation!

ChitraPy is a digital Image Processing Library in Python.

Installation

Install from Pypi

1
pip install ChitraPy

Install from source

1
2
3
git clone https://github.com/mgautam98/ChitraPy.git
cd ChitraPy
python3 setup.py install

Usage

sample.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from ChitraPy import filters, helpers
import matplotlib.pyplot as plt

# Load a sample Image

!wget https://i.imgur.com/D24n5DL.png
img = plt.imread('./D24n5DL.png')
plt.imshow(img)

# invert an image
invert = filters.invert(img)
plt.imshow(invert)

Filters

ChitraPy.filters.contrast_enhancement(img)

Enhances contrast of an image using histogram equalization.

Parameters: arg1 (np.array): Numpy image matrix.

Returns: np.array: Contrast enhanced gray image.

ChitraPy.filters.crop

Crops the image to given dimension.

Parameters: arg1 (np.array): Numpy image matrix. arg2 (np.array): Top left corner co-ordinates. arg3 (np.array): Top right corner co-ordinates.

Returns: np.array: Cropped image.

ChitraPy.filters.dither

Applies dither filter to a colored numpy image.

Parameters: arg1 (np.array): Numpy image matrix.

Returns: np.array: Dithered image.

ChitraPy.filters.emboss

Applies Emboss filter to a colored numpy image.

Parameters: arg1 (np.array): Numpy image matrix.

Returns: np.array: Filtered Embossed image.

ChitraPy.filters.gray_scale

Applies gray scale filter to a colored numpy image.

Parameters: arg1 (np.array): Numpy image matrix.

Returns: np.array: Filterd gray scale image.

ChitraPy.filters.identity

Applies identity filter to a colored numpy image.

Parameters: arg1 (np.array): Numpy image matrix.

Returns: np.array: Identity image.

ChitraPy.filters.invert

Rotates the image by 180 degrees.

Parameters: arg1 (np.array): numpy image matrix.

Returns: np.array: Inverted image.

ChitraPy.filters.left_sobel

Applies left sobel filter to a colored numpy image.

Parameters: arg1 (np.array): Numpy image matrix.

Returns: np.array: Filterd left sobel image.

ChitraPy.filters.monochrome

Applies monochrome filter to a colored numpy image.

Parameters: arg1 (np.array): Numpy image matrix.

Returns: np.array: Monochrome applied image.

ChitraPy.filters.negative

Negates the given image.

Parameters: arg1 (np.array): numpy image matrix.

Returns: np.array: Negative of the given image.

ChitraPy.filters.outline

Applies Outline filter to a colored numpy image.

Parameters: arg1 (np.array): Numpy image matrix.

Returns: np.array: Filtered outlined image.

ChitraPy.filters.quick_blur

Blurs the image

Parameters: arg1 (np.array): numpy image matrix

Returns: np.array: Gray scale numpy image matrix

ChitraPy.filters.right_sobel

Applies right sobel filter to a colored numpy image.

Parameters: arg1 (np.array): Numpy image matrix.

Returns: np.array: Filterd right sobel image.

ChitraPy.filters.rotate

Rotates the image by 90 degrees.

Parameters: arg1 (np.array): Numpy image matrix.

Returns: np.array: Rotated image.

ChitraPy.filters.sepia

Applies sepia filter to the given image.

Parameters: arg1 (np.array): numpy image matrix.

Returns: np.array: Image with sepia filter applied.

ChitraPy.filters.sharpen

Applies Sharpen filter to a colored numpy image.

Parameters: arg1 (np.array): Numpy image matrix.

Returns: np.array: Filtered Sharpen image.

ChitraPy.filters.sliding_contrast

Changes contrast of the image.

Parameters: arg1 (np.array): Numpy image matrix. arg2 (int): Percentage of contrast to change -100 to 100.

Returns: np.array: Monochrome applied image.

ChitraPy.filters.top_sobel

Applies top sobel filter to a colored numpy image.

Parameters: arg1 (np.array): Numpy image matrix.

Returns: np.array: Filterd top sobel image.

Helpers

ChitraPy.helpers.InvertGrayImg(img)

Inverts a single channel image

Parameters: arg1 (np.array): numpy image matrix

Returns: np.array: Gray scale numpy image matrix

ChitraPy.helpers.display

Displays only single channel/ three channel of a numpy image matrix

Parameters: arg1 (np.array): numpy image matrix

ChitraPy.helpers.histogram

Plots intensity plots for a color image.

Parameters: arg1 (np.array): Numpy image matrix.

ChitraPy.helpers.rgb2gray

Converts a given numpy array colored image to gray image

Parameters: arg1 (np.array): numpy image matrix

Returns: np.array: Gray scale numpy image matrix

ChitraPy.helpers.save(img, name='image')

Saves an image in .jpg format in current working directory.

Parameters: arg1 (np.array): Numpy image matrix. arg2 (String) : Name of image. Default it is image.

Indices and tables