/Grayscale

Grayscale with Python

Primary LanguagePython

Grayscale

Grayscale filter is a widely used and popular filter used by youngsters. Lets try making a filter of our own through Image Processing.

Tools and Languages:

OpenCV

VS Code

pip

Python


Installation

Use the package manager pip to install cv2 and numpy.

pip install cv2
pip install numpy

Import

import cv2
import numpy as np

Reading image from file

img = cv2.imread("cat.png")

Gray scale

gray = cv2.cvtColor(img , cv2.COLOR_BGR2GRAY)

Completion message

print('Image Grayscaled.')

Comparing original vs grayscale

cv2.imshow('ORIGINAL',img)
cv2.imshow('GRAYSCALE',gray)
cv2.waitKey(0)
cv2.destroyAllWindows()

Images

Logo Gray

Developed by

Ashish ku. Behera