Skip to content

Commit 6fcc33f

Browse files
authored
Merge pull request larymak#75 from GSAUC3/gsauce1
Image Diver code using opencv in python added
2 parents 3194b08 + 68110a5 commit 6fcc33f

File tree

7 files changed

+34
-0
lines changed

7 files changed

+34
-0
lines changed

ImageDivider/ImageDivider.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import cv2
2+
3+
img = cv2.imread('imaag.jpg')
4+
height,width,channels= img.shape
5+
6+
left = img[:,:width//2]
7+
right = img[:,width//2:]
8+
9+
cv2.imshow('original', img)
10+
cv2.imshow('Left Half', left)
11+
cv2.imshow('Right half', right)
12+
13+
cv2.imwrite('Left.jpg', left)
14+
cv2.imwrite('Right.jpg', right)
15+
cv2.waitKey(0)

ImageDivider/Left.jpg

16.4 KB
Loading

ImageDivider/Readme.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Dividing an image into euqal halves using OpenCV
2+
3+
### Requirements
4+
```python
5+
pip install opencv-python
6+
```
7+
8+
### Steps
9+
- Navigate to this folder.
10+
- Upload an image of your choice.
11+
- Tweak the code by changing the file name to your name
12+
- Hit run and you are done!!
13+
14+
Note: This code will divide the images vertically.
15+
16+
## Demo:
17+
18+
<img src="https://github.com/GSAUC3/Python-project-Scripts/blob/gsauce1/ImageDivider/Screenshot%20.png">

ImageDivider/Right.jpg

26.9 KB
Loading

ImageDivider/Screenshot .png

611 KB
Loading

ImageDivider/imaag.jpg

57.1 KB
Loading

ImageDivider/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
opencv-python

0 commit comments

Comments
 (0)