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 78b97be

Browse files
Merge pull request avinashkranjan#2958 from avinashkranjan/deepsource-transform-0ad6ad40
format code with autopep8
2 parents dfa2a01 + 418e897 commit 78b97be

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

‎Matching shapes/matching_shapes.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,24 @@
66
window.title("Matching shapes")
77
window.geometry('350x200')
88

9-
def image1(): # getting image 1
9+
10+
def image1(): # getting image 1
1011
photo1 = askopenfilename()
1112
global gray1
1213
img1 = cv2.imread(photo1)
13-
img1 = cv2.resize(img1,(500,500))
14+
img1 = cv2.resize(img1,(500,500))
1415
gray1 = cv2.cvtColor(img1, cv2.COLOR_RGB2GRAY)
15-
1616

17-
def image2(): # getting image 2
17+
18+
def image2(): # getting image 2
1819
photo2 = askopenfilename()
1920
global gray2
2021
img2 = cv2.imread(photo2)
21-
img2 = cv2.resize(img2,(500,500))
22+
img2 = cv2.resize(img2,(500,500))
2223
gray2 = cv2.cvtColor(img2, cv2.COLOR_RGB2GRAY)
23-
2424

25-
def proceeds(): # detecting shape matching using contours
25+
26+
def proceeds(): # detecting shape matching using contours
2627
ret, threshold = cv2.threshold(gray1, 127, 255, 0)
2728
ret, threshold2 = cv2.threshold(gray2, 127, 255, 0)
2829
contours, hierarchy, rem1 = cv2.findContours(threshold, 2, 1)
@@ -31,7 +32,9 @@ def proceeds(): # detecting shape matching using contours
3132
cnt2 = contours[0]
3233
ret = cv2.matchShapes(cnt1, cnt2, 1, 0.0)
3334
print(ret)
34-
label = tk.Label(window, text="Probability of shapes matching: "+str(1-ret)).grid(row=4,column=1)
35+
label = tk.Label(window, text="Probability of shapes matching: " +
36+
str(1-ret)).grid(row=4, column=1)
37+
3538

3639
label = tk.Label(window, text="Image 1").grid(row=1, column=0)
3740
label = tk.Label(window, text="Image 2").grid(row=2, column=0)
@@ -40,9 +43,9 @@ def proceeds(): # detecting shape matching using contours
4043
b2 = tk.Button(window, text='choose image 2', command=image2)
4144
proceed = tk.Button(window, text='Proceed', command=proceeds)
4245

43-
b1.grid(row=1,column=1)
44-
b2.grid(row=2,column=1)
45-
proceed.grid(row=3,column=1)
46+
b1.grid(row=1,column=1)
47+
b2.grid(row=2,column=1)
48+
proceed.grid(row=3,column=1)
4649

4750
window.mainloop()
4851
cv2.destroyAllWindows()

0 commit comments

Comments
(0)

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