Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit 57ed721

Browse files
committed
added sepia image convertor script
1 parent b32d45b commit 57ed721

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Importing libraries
2+
import cv2
3+
import numpy as np
4+
5+
img = cv2.imread('taj_mahal.jpg')
6+
original = img.copy()
7+
# Converting into float
8+
img = np.array(img, dtype=np.float64)
9+
# Multipying image with special sepia matrix
10+
img = cv2.transform(img, np.matrix([[0.272, 0.534, 0.131],
11+
[0.349, 0.686, 0.168],
12+
[0.393, 0.769, 0.189]]))
13+
img[np.where(img > 255)] = 255
14+
# Converting into integer again
15+
img = np.array(img, dtype=np.uint8)
16+
cv2.imshow("original", original)
17+
cv2.imshow("sepia", img)
18+
cv2.waitKey(0)
19+
cv2.destroyAllWindows()
Loading

0 commit comments

Comments
 (0)