Skip to content

Commit b2d2592

Browse files
Merge pull request avinashkranjan#1125 from A-kriti/f1
Neon Effect Filter avinashkranjan#1117
2 parents 343d167 + 6b43f57 commit b2d2592

File tree

5 files changed

+67
-0
lines changed

5 files changed

+67
-0
lines changed

Neon Effect Filter/Code.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import numpy as np
2+
import cv2
3+
import os.path
4+
from matplotlib import pyplot as plt
5+
6+
img_path = input("Enter the path of image: ") #example -> C:\Users\xyz\OneDrive\Desktop\project\image.jpg
7+
img = cv2.imread(img_path)
8+
image = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
9+
10+
img_small = cv2.pyrDown(image)
11+
num_iter = 5
12+
for _ in range(num_iter):
13+
img_small= cv2.bilateralFilter(img_small, d=9, sigmaColor=9, sigmaSpace=7)
14+
15+
img_rgb = cv2.pyrUp(img_small)
16+
17+
img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_RGB2GRAY)
18+
img_blur = cv2.medianBlur(img_gray, 7)
19+
img_edge = cv2.adaptiveThreshold(img_blur, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 7, 2)
20+
21+
img_edge = cv2.cvtColor(img_edge, cv2.COLOR_GRAY2RGB)
22+
array = cv2.bitwise_and(image, img_edge)
23+
array1 = cv2.bitwise_xor(array, image)
24+
plt.figure(figsize= (10,10))
25+
plt.imshow(array1,cmap='gray')
26+
plt.title("Neon Effect Filtered Photo")
27+
plt.axis('off')
28+
filename = os.path.basename(image_path)
29+
plt.savefig("./Neon Effect Filter/Neon Effect Filter"+filename) #saved file name as (Filtered)image_name.jpg
30+
31+
plt.show()
56.8 KB
Loading
91.3 KB
Loading

Neon Effect Filter/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
# Neon Effect Filter
3+
4+
Converting an image into an neon effect filtered image using some of the python libraries.
5+
6+
## Libraries used
7+
Firstly import the following python libraries
8+
* OpenCv
9+
* Os
10+
* Matplotlib
11+
* Numpy
12+
13+
Taking path of the image/Real image as input using os and finally reading it using cv2
14+
15+
## Detailed explanation of the method used
16+
17+
* Imported the required libraries ( Numpy, Matplotlib, OpenCv, Os)
18+
* Read the input path of the image using Cv2 library
19+
* Used Bilateral Filter
20+
* Followed by Median Blur
21+
* Followed by Adaptive Threshold
22+
* Followed by Bitwise "and" between original image and edge image
23+
* And at last used Bitwise "xor" between orginal and output of the above "bitwise and image"
24+
* Finally converted the image into "Neon Effect Filtered" image
25+
26+
## Original Image
27+
<img src="Image/image_.jpg" height="500px">
28+
29+
## Neon Effect Filtered Image
30+
<img src="Image/(Neon Effect Filter)image_.jpg" height="500px">
31+
32+
## Author(s)
33+
[Akriti](https://github.com/A-kriti)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
numpy==1.18.5
2+
opencv_python==4.5.1.48
3+
matplotlib==3.2.2

0 commit comments

Comments
 (0)