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 1fcc22f

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in b55a2e1 according to the output from Autopep8. Details: None
1 parent 4c8daab commit 1fcc22f

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

‎Blending Images/blending_Image.py‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,36 @@
66
window.title("Image blending")
77
window.geometry('300x140')
88

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

15-
def image2(): # getting image 2
17+
def image2(): # getting image 2
1618
photo2 = askopenfilename()
1719
global img2
1820
img2 = cv2.imread(photo2)
19-
img2 = cv2.resize(img2,(500,500))
21+
img2 = cv2.resize(img2,(500,500))
2022

21-
def proceeds(): # reading alpha and displaying output
23+
24+
def proceeds(): # reading alpha and displaying output
2225
global alpha
2326
alpha = t.get(1.0, "end-1c")
2427
alpha = float(alpha)
25-
if alpha>=0 and alpha<=1:
28+
if alpha>=0 and alpha<=1:
2629
beta = 1-alpha
2730
res = cv2.addWeighted(img1, alpha, img2, beta, 0.0)
2831
cv2.imshow('Result', res)
2932
cv2.imwrite("Output.jpg", res)
3033
cv2.waitKey(0)
31-
else: # when alpha is invalid
34+
else: # when alpha is invalid
3235
print("invalid alpha")
3336
exit()
3437

38+
3539
label = tk.Label(window, text="Enter alpha (0 to 1)").grid(row=0, column=0)
3640
label = tk.Label(window, text="Image 1").grid(row=1, column=0)
3741
label = tk.Label(window, text="Image 2").grid(row=2, column=0)
@@ -41,10 +45,10 @@ def proceeds(): # reading alpha and displaying output
4145
b2 = tk.Button(window, text='choose image 2', command=image2)
4246
proceed = tk.Button(window, text='Proceed', command=proceeds)
4347

44-
t.grid(row=0,column=1)
45-
b1.grid(row=1,column=1)
46-
b2.grid(row=2,column=1)
47-
proceed.grid(row=3,column=1)
48+
t.grid(row=0,column=1)
49+
b1.grid(row=1,column=1)
50+
b2.grid(row=2,column=1)
51+
proceed.grid(row=3,column=1)
4852

4953
window.mainloop()
5054
cv2.destroyAllWindows()

0 commit comments

Comments
(0)

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