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 d2535d3

Browse files
Merge pull request avinashkranjan#622 from Lakhankumawat/Experimental
🚀Added Image Processing
2 parents 03be8a8 + 867f6da commit d2535d3

File tree

5 files changed

+101
-0
lines changed

5 files changed

+101
-0
lines changed

‎Image Processing/ImageCompressing.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Python Imaging Library PIL
4+
from PIL import Image as ig
5+
6+
# Here we have to provide complete address of image from file which contains your py file
7+
filePath=input("Enter the path of your Image : ")
8+
img=ig.open(filePath)
9+
#Apply the compressing
10+
img.save("Compressed.jpg",optimize=True,quality=30)
11+
12+
13+
print("Done!")

‎Image Processing/ImageTransposing.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- coding: utf-8 -*-
2+
3+
#Flipping the image
4+
from PIL import Image
5+
6+
#opening the image
7+
filePath=input("Enter the path of your Image : ")
8+
img=Image.open(filePath)
9+
10+
#transpose of the matrix
11+
transposed_img=img.transpose(Image.FLIP_LEFT_RIGHT)
12+
13+
#save it in a new file
14+
15+
transposed_img.save("Corrected.png")
16+
17+
print("Done!")

‎Image Processing/ImgEnhancing.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
3+
#image enhancement CLAHE - Contrast Limited Adaptive Histogram Equalization
4+
import cv2
5+
6+
#read the image
7+
#Read the img from its location relative to py file
8+
filePath=input("Enter the path of your Image : ")
9+
img = cv2.imread(filePath)
10+
11+
#preparation for CLAHE
12+
clahe= cv2.createCLAHE()
13+
14+
#COnvert to Gray Scale image
15+
16+
gray_img= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
17+
18+
#Lets apply enhancement finally
19+
20+
ench_img=clahe.apply(gray_img)
21+
22+
#And save it into a file
23+
24+
cv2.imwrite('enhanced.jpg',ench_img)
25+
26+
print("Done!!")

‎Image Processing/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Python Image Processing
2+
<h4>Python Imaging Library (PIL) is one of the popular libraries used for image processing. PIL can be used to display image, create thumbnails, resize, rotation, convert between file formats, contrast enhancement, filter and apply other digital image processing techniques etc.</h4><br>
3+
4+
> Here are few things which you can implement using python
5+
<br>
6+
7+
## 1. Image Enhancing
8+
[`source code here`](https://github.com/Lakhankumawat/Amazing-Python-Scripts/blob/Experimental/Image%20Processing/ImgEnhancing.py)<br>
9+
<a href="https://ibb.co/7CDtTBT"><img width="40%" src="https://i.ibb.co/h9NFnrn/default.jpg" alt="default" border="0"></a><img src="https://img.icons8.com/carbon-copy/100/000000/arrow.png"/>
10+
<a href="https://ibb.co/51JhvX7"><img width="40%" src="https://i.ibb.co/j8jkG9p/enhanced.jpg" alt="enhanced" border="0"></a>
11+
12+
13+
<hr>
14+
15+
16+
## 2. Image Compressing
17+
[`source code here`](https://github.com/Lakhankumawat/Amazing-Python-Scripts/blob/Experimental/Image%20Processing/ImageCompressing.py)<br>
18+
<a href="https://ibb.co/7CDtTBT"><img width="40%" src="https://i.ibb.co/h9NFnrn/default.jpg" alt="default" border="0"></a><img src="https://img.icons8.com/carbon-copy/100/000000/arrow.png"/>
19+
<a href="https://ibb.co/BBJx5PM"><img width="40%" src="https://i.ibb.co/TtGSxT3/Compressed.jpg" alt="Compressed" border="0"></a>
20+
<hr>
21+
22+
## 3. Image Transposing
23+
[`source code here`](https://github.com/Lakhankumawat/Amazing-Python-Scripts/blob/Experimental/Image%20Processing/ImageCompressing.py)<br>
24+
<a href="https://ibb.co/7CDtTBT"><img width="40%" src="https://i.ibb.co/h9NFnrn/default.jpg" alt="default" border="0"></a><img src="https://img.icons8.com/carbon-copy/100/000000/arrow.png"/>
25+
<a href="https://ibb.co/4KNZYG2"><img width="40%" src="https://i.ibb.co/JmkRy4q/Transposed.png" alt="Transposed" border="0"></a>
26+
<hr>
27+
28+
## Libraries Required
29+
30+
Instructions on how to use them in your own application are linked below.
31+
32+
| Library | Documentation |
33+
| ------ | ------ |
34+
| CV2 | [https://pypi.org/project/opencv-python/][PlDb] |
35+
| PIL | [https://pypi.org/project/Pillow/][PlGh] |
36+
| CLAHE | [https://pypi.org/project/clahe/][PlGd] |
37+
38+
## Author
39+
[Lakhan Kumawat](https://github.com/Lakhankumawat)
40+
41+
42+
[PlDb]: <https://pypi.org/project/opencv-python/>
43+
[PlGh]: <https://pypi.org/project/Pillow/>
44+
[PlGd]: <https://pypi.org/project/clahe/>
45+

‎Image Processing/default.jpg

123 KB
Loading[フレーム]

0 commit comments

Comments
(0)

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