Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5c64a71
Added new feature in the existing GST calculator
tanujbordikar Aug 4, 2023
0b9e78c
Added new feature in the existing GST calculator
tanujbordikar Aug 4, 2023
2cffc8f
Improved the calculator by using tkinter
tanujbordikar Aug 4, 2023
0ad6ecc
added the screenshot with tkinter gui and also created a new document…
tanujbordikar Aug 5, 2023
369dcbe
added techCrunch.py
Mihan786Chistie Aug 5, 2023
af89634
updated techCrunch.py
Mihan786Chistie Aug 5, 2023
f1ae4ed
updated techCrunch.py
Mihan786Chistie Aug 5, 2023
58c7c6d
added README.md
Mihan786Chistie Aug 5, 2023
3f15a8f
updated techCrunch.py
Mihan786Chistie Aug 5, 2023
2dc2121
added requirements.txt
Mihan786Chistie Aug 5, 2023
e5d8c91
Pixel Art Generator Script Added
andoriyaprashant Aug 5, 2023
eeda4e1
Lint Fix
andoriyaprashant Aug 5, 2023
ac34009
culturally-inspired names imaginary
Swapnil-2503 Aug 5, 2023
66af624
morphological transformations
invigorzz313 Aug 5, 2023
31a905e
Infinite Runner with Obstacles Script Added
andoriyaprashant Aug 5, 2023
46c36bf
Gomoku_game.py
Shikhar9425 Aug 6, 2023
ac814f2
README.md
Shikhar9425 Aug 6, 2023
0171cee
Adding code, README file
MrResilient Aug 8, 2023
2328db2
Adding code, README file
MrResilient Aug 8, 2023
8a9853c
Merge branch 'cont1' of https://github.com/Shivansh-Jain-github/Amazi…
MrResilient Aug 8, 2023
eec9f8b
Merge pull request #2687 from Shivansh-Jain-github/master
1e9abhi1e10 Aug 8, 2023
14d473a
Merge pull request #2686 from Shivansh-Jain-github/cont1
1e9abhi1e10 Aug 8, 2023
a741426
Completed payment receipt project
Yashika-Agrawal Aug 8, 2023
2d2d94b
Merge pull request #2691 from Yashika-Agrawal/Payment
1e9abhi1e10 Aug 8, 2023
3250119
Adding code, README.md file
MrResilient Aug 8, 2023
84f20e8
Adding code, README.md file
MrResilient Aug 8, 2023
83f766a
Add commit
MrResilient Aug 8, 2023
51cf405
Delete
MrResilient Aug 8, 2023
fabfd2c
delete
MrResilient Aug 8, 2023
034c8d4
Merge pull request #2696 from Shivansh-Jain-github/CONT1
1e9abhi1e10 Aug 8, 2023
42b6943
Merge pull request #2695 from Shivansh-Jain-github/cont1
1e9abhi1e10 Aug 8, 2023
2efacbb
Merge pull request #2668 from Shikhar9425/master-8
1e9abhi1e10 Aug 8, 2023
57fe6d4
Merge pull request #2639 from Swapnil-2503/culturally-inspired-names
1e9abhi1e10 Aug 8, 2023
bfb1e89
Merge pull request #2635 from Mihan786Chistie/techCrunch
1e9abhi1e10 Aug 8, 2023
b25ce3d
Merge pull request #2650 from andoriyaprashant/branch28
1e9abhi1e10 Aug 8, 2023
a9dee15
Merge pull request #2637 from andoriyaprashant/branch27
1e9abhi1e10 Aug 8, 2023
8890205
Merge pull request #2640 from invigorzz313/morphtransforms
1e9abhi1e10 Aug 8, 2023
148eaea
Merge pull request #2631 from tanujbordikar/screenshot
1e9abhi1e10 Aug 8, 2023
4d01156
True False Automation
MrResilient Aug 8, 2023
c58725c
WhatsApp_timer_messenger code
MrResilient Aug 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Morphological_transforms/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Morphological transformations
This python script will allow us to apply different morphological transformations on an image.

## Setup Instructions
### Install python3
sudo apt-get install python3
### Install pip (package installer for python)
sudo apt-get install python3-pip
### Install OpenCV library with pip
pip3 install opencv-python
### Install tkinter library
sudo apt-get install python3-tk

## Details/Output
A dialog box appears with option to select an image and choice of morphological operation.The result is shown in the window.
The input image is first converted into binary format before applying any morphological transformation and hence the output is in black-white format.

## Author
Github: invigorzz313
Binary file added Morphological_transforms/Sample1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Morphological_transforms/Sample2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Morphological_transforms/SampleOutput.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions Morphological_transforms/morph_transforms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
from tkinter.filedialog import *
import tkinter as tk
import cv2

def select_image(): # selecting image and thresholding it to binary format
photo = askopenfilename()
global img, thresh
img = cv2.imread(photo)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
threshold_value = 125 # this value needs to be adjusted for every image
ret, thresh = cv2.threshold(gray, threshold_value, 255, 0)

def erosion():
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(5,5))
eroded = cv2.erode(thresh, kernel, iterations=1)
eroded = cv2.resize(eroded,(300,300))
cv2.imshow("Erosion", eroded)
cv2.waitKey(0)
cv2.destroyAllWindows()

def dilation():
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(5,5)) # elliptic kernel
dilated = cv2.dilate(thresh, kernel, iterations=1)
dilated = cv2.resize(dilated,(300,300))
cv2.imshow("Dilation", dilated)
cv2.waitKey(0)
cv2.destroyAllWindows()

def opening():
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(5,5))
opened = cv2.morphologyEx(thresh, cv2.MORPH_OPEN, kernel)
opened = cv2.resize(opened,(300,300))
cv2.imshow("Opening", opened)
cv2.waitKey(0)
cv2.destroyAllWindows()

def closing_opn():
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(5,5))
closed = cv2.morphologyEx(thresh, cv2.MORPH_CLOSE, kernel)
closed = cv2.resize(closed,(300,300))
cv2.imshow("Closing", closed)
cv2.waitKey(0)
cv2.destroyAllWindows()

def morph_grad():
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(5,5))
grad = cv2.morphologyEx(thresh, cv2.MORPH_GRADIENT, kernel)
grad = cv2.resize(grad,(300,300))
cv2.imshow("Morph gradient", grad)
cv2.waitKey(0)
cv2.destroyAllWindows()

def top_hat():
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(5,5))
tophat = cv2.morphologyEx(thresh, cv2.MORPH_TOPHAT, kernel)
tophat = cv2.resize(tophat,(300,300))
cv2.imshow("Top hat", tophat)
cv2.waitKey(0)
cv2.destroyAllWindows()

def black_hat():
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(5,5))
blackhat = cv2.morphologyEx(thresh, cv2.MORPH_BLACKHAT, kernel)
blackhat = cv2.resize(blackhat,(300,300))
cv2.imshow("Black hat", blackhat)
cv2.waitKey(0)
cv2.destroyAllWindows()

window = tk.Tk()
window.title("Morphological transformations")
window.geometry('320x220')
label = tk.Label(window, text="Select an image and then choose an option").grid(row=0, column=0)
b = tk.Button(window, text="Select image", command=select_image).grid(row=1,column=0)


rad1 = tk.Radiobutton(window, text='erosion', value=1, command=erosion)
rad2 = tk.Radiobutton(window, text='dilation', value=2, command=dilation)
rad3 = tk.Radiobutton(window, text='opening', value=3, command=opening)
rad4 = tk.Radiobutton(window, text='closing', value=4, command=closing_opn)
rad5 = tk.Radiobutton(window, text='morph gradient', value=5, command=morph_grad)
rad6 = tk.Radiobutton(window, text='top hat', value=6, command=top_hat)
rad7 = tk.Radiobutton(window, text='black hat', value=7, command=black_hat)

rad1.grid(row=2, column=0)
rad2.grid(row=3, column=0)
rad3.grid(row=4, column=0)
rad4.grid(row=5, column=0)
rad5.grid(row=6, column=0)
rad6.grid(row=7, column=0)
rad7.grid(row=8, column=0)

window.mainloop()