Skip to content

Commit 3e10319

Browse files
Gradient_Mapping_Script added
1 parent 469ba28 commit 3e10319

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# import the required libraries
2+
import cv2
3+
import numpy as np
4+
from matplotlib import pyplot as plt
5+
6+
# Read Image in GrayScale
7+
img = cv2.imread("scene.jpg", cv2.IMREAD_GRAYSCALE)
8+
9+
titles = ["image"]
10+
images = [img]
11+
12+
# Applying gradient
13+
for i in range(1):
14+
plt.subplot(1, 1, i + 1), plt.imshow(images[i], "grey")
15+
plt.title(titles[i])
16+
plt.xticks([]), plt.yticks([])
17+
18+
plt.show()

Gradient_Mapping_Script/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Gradient Mapping to an Image
2+
3+
A simple Python Script to apply Gradient Mapping to an Image.
4+
5+
## Prerequisites
6+
7+
- Python3
8+
- Windows OS
9+
- A good Internet connection (of course!😉)
10+
11+
## Required Libraries
12+
13+
- opencv-python
14+
15+
```
16+
$ pip install opencv-python
17+
```
18+
19+
- matplotlib
20+
21+
```
22+
$ pip install matplotlib
23+
```
24+
25+
- numpy
26+
27+
NOTE - `numpy` package automatically installs while installing `opencv-python` package
28+
29+
## Understanding Code
30+
31+
![carbon (1)](https://user-images.githubusercontent.com/44089458/88452536-342fc080-ce7d-11ea-9646-d7f7375c79ed.png)
32+
33+
## Gradient Application
34+
35+
```
36+
$ python gradient_mapping.py
37+
```
38+
39+
|Original|Gradient|
40+
|---|---|
41+
|![Gradient-Original](https://user-images.githubusercontent.com/44089458/88452087-70612200-ce79-11ea-98c3-a14d6370e9ee.jpg)|![Gradient-Result](https://snipboard.io/j8EF13.jpg)|

0 commit comments

Comments
 (0)