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

Commit 0fbc003

Browse files
authored
Merge pull request #268 from sharur7/ssr
Added sepia image convertor script
2 parents 95a3bca + 5717396 commit 0fbc003

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Image to Sepia image
2+
The original image is converted into Sepia filtered image.
3+
4+
### Results:
5+
6+
#### Original Image
7+
<img src ="https://github.com/sharur7/Awesome-Python-Scripts/blob/ssr/Image-Processing/Image%20To%20Sepia%20Effect/original.jpg?raw=true" alt="Original_image" width="400" height="330">
8+
9+
#### Sepia Image
10+
<img src ="https://github.com/sharur7/Awesome-Python-Scripts/blob/ssr/Image-Processing/Image%20To%20Sepia%20Effect/sepia.jpg?raw=true" alt="Sepia_image" width="400" height="330">
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)