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

Added sepia image convertor script #268

Merged
merged 3 commits into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Image-Processing/Image To Sepia Effect/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Image to Sepia image
The original image is converted into Sepia filtered image.

### Results:

#### Original Image
<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">

#### Sepia Image
<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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions Image-Processing/Image To Sepia Effect/sepia image convertor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Importing libraries
import cv2
import numpy as np

img = cv2.imread('taj_mahal.jpg')
original = img.copy()
# Converting into float
img = np.array(img, dtype=np.float64)
# Multipying image with special sepia matrix
img = cv2.transform(img, np.matrix([[0.272, 0.534, 0.131],
[0.349, 0.686, 0.168],
[0.393, 0.769, 0.189]]))
img[np.where(img > 255)] = 255
# Converting into integer again
img = np.array(img, dtype=np.uint8)
cv2.imshow("original", original)
cv2.imshow("sepia", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Binary file added Image-Processing/Image To Sepia Effect/sepia.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.