Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 27a4c96

Browse files
Merge pull request #1068 from Khushi-sharma07/main
Image Neon Effect Filter
2 parents 6f3d2c7 + 0b31036 commit 27a4c96

File tree

11 files changed

+80
-0
lines changed

11 files changed

+80
-0
lines changed
949 KB
Loading[フレーム]
906 KB
Loading[フレーム]
52.5 KB
Loading[フレーム]
39 KB
Loading[フレーム]
465 KB
Loading[フレーム]
1.18 MB
Loading[フレーム]
998 KB
Loading[フレーム]
1.96 MB
Loading[フレーム]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Neon/Glow Filter Of An Image
2+
3+
# Aim
4+
This project helps in converting an image into glow/neon image.
5+
6+
# Purpose
7+
In this project a normal RGB image is converted into its neon or glow image using a single script.
8+
9+
# Short description of package/script
10+
>This project contains a script neon.py which helps to convert image into neon or glow image.
11+
>It uses Open CV library to manipulate pixels of the image
12+
>Numpy is used because Open CV stores images in form of numpy array and it can be manipulated easily by performing numpy operations.
13+
14+
# Workflow of the Project
15+
User will enter the name of the file present in the media folder then the program will process the image and convert it into neon/glow image. Then simply the converted file will be created with both the images concattenated for comparision purposes. The new file created will be automatically saved and renamed as "Neon of FILENAME".
16+
17+
# Detailed Setup instructions
18+
The first step is to install python and fulfill all the requirements mentioned in requirements.txt. Then copy your images to the Media folder. The extension of image should be .jpg to get the best results.
19+
After running the program you will get the image converted as per your need and will get saved automatically in the same directory.
20+
21+
# Compilation Steps
22+
In this we are using cv2,matplotlib and numpy to read the images and then store it in the form of array. Then with the help of matrix multiplication and setting the pixels properly we get the new image. Then, we finally merge the old and the new image together for better comparision/visualisation purpose and display it and save the image as final output.
23+
24+
# Conclusion
25+
This image processing script helps the user to instantly beautify their image and give it a glow by one simple step.
26+
27+
# Screenshots
28+
29+
![Image Neon Effect Filter](Media/Screenshot 1)
30+
31+
32+
![Image Neon Effect Filter](Media/Screenshot 2)
33+
34+
35+
# Author
36+
37+
Khushi Sharma
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import cv2
2+
import numpy as np
3+
import matplotlib.pyplot as plt
4+
5+
def main():
6+
filename = input("Please Enter File Name : ") # Asking Image name
7+
newfilename = "Media/" + filename # Accessing Image inside "Media" folder
8+
img = cv2.imread(newfilename)
9+
param_resize = 2000
10+
11+
# Resize based on the parameters
12+
img = cv2.resize(img, (param_resize, param_resize))
13+
14+
# Gausian
15+
gaussian = cv2.GaussianBlur(img,(3,3),1)
16+
17+
# Split the gausian and the orginal image
18+
b_gaus,g_gaus,r_gaus=cv2.split(gaussian)
19+
b,g,r=cv2.split(img)
20+
21+
# Matrix multiplication
22+
#When reading in with cv2 then the type is uint8, which means the range is max 255
23+
calculated_b_array = b_gaus.astype(int) + b.astype(int)
24+
calculated_g_array = g_gaus.astype(int) + g.astype(int)
25+
calculated_r_array = r_gaus.astype(int) + r.astype(int)
26+
27+
## If the pixelvalue is higher than 255, set it to 255
28+
calculated_b_array[calculated_b_array > 255] = 255
29+
calculated_g_array[calculated_g_array > 255] = 255
30+
calculated_r_array[calculated_r_array > 255] = 255
31+
32+
## Merge for visualization purposes
33+
merged = cv2.merge([calculated_b_array, calculated_g_array, calculated_r_array])
34+
img2 = np.concatenate((img, merged), axis=1)
35+
36+
# After doing this write the image to the folder
37+
cv2.imwrite(f"Neon of {filename}", img2)
38+
print(f"Neon of {filename} is created") # Display message
39+
cv2.waitKey(0)
40+
41+
42+
if __name__ == "__main__":
43+
main()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /