Skip to content

Commit 8de6127

Browse files
Added Image Processing
1 parent 04a2dfe commit 8de6127

File tree

5 files changed

+95
-0
lines changed

5 files changed

+95
-0
lines changed
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+
#open the image from directory , in my case its in same directory
7+
img=ig.open("default.jpg")
8+
9+
#Apply the compressing
10+
img.save("Compressed.jpg",optimize=True,quality=30)
11+
12+
13+
print("Done!")
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
3+
#Flipping the image
4+
from PIL import Image
5+
6+
#opening the image
7+
img = Image.open('default.jpg')
8+
9+
#transpose of the matrix
10+
transposed_img=img.transpose(Image.FLIP_LEFT_RIGHT)
11+
12+
#save it in a new file
13+
14+
transposed_img.save("Corrected.png")
15+
16+
print("Done!")

Image Processing/ImgEnhancing.py

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

Image Processing/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
<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"/>
9+
<a href="https://ibb.co/51JhvX7"><img width="40%" src="https://i.ibb.co/j8jkG9p/enhanced.jpg" alt="enhanced" border="0"></a>
10+
11+
12+
<hr>
13+
14+
15+
## 2. Image Compressing
16+
17+
<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"/>
18+
<a href="https://ibb.co/BBJx5PM"><img width="40%" src="https://i.ibb.co/TtGSxT3/Compressed.jpg" alt="Compressed" border="0"></a>
19+
<hr>
20+
21+
## 3. Image Transposing
22+
<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"/>
23+
<a href="https://ibb.co/4KNZYG2"><img width="40%" src="https://i.ibb.co/JmkRy4q/Transposed.png" alt="Transposed" border="0"></a>
24+
<hr>
25+
## Libraries Required
26+
27+
Instructions on how to use them in your own application are linked below.
28+
29+
| Library | Documentation |
30+
| ------ | ------ |
31+
| CV2 | [https://pypi.org/project/opencv-python/][PlDb] |
32+
| PIL | [https://pypi.org/project/Pillow/][PlGh] |
33+
| CLAHE | [https://pypi.org/project/clahe/][PlGd] |
34+
35+
## Author
36+
[Lakhan Kumawat](https://github.com/Lakhankumawat)
37+
38+
39+
[PlDb]: <https://pypi.org/project/opencv-python/>
40+
[PlGh]: <https://pypi.org/project/Pillow/>
41+
[PlGd]: <https://pypi.org/project/clahe/>
42+

Image Processing/default.jpg

123 KB
Loading

0 commit comments

Comments
 (0)