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 5d247f6

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in 79593fb according to the output from Autopep8. Details: None
1 parent ec01786 commit 5d247f6

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

‎Perspective_transform/perspective_transform.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,29 @@
33
import tkinter as tk
44
from tkinter.filedialog import *
55

6-
photo = askopenfilename() # reading the input image
6+
photo = askopenfilename() # reading the input image
77
img = cv2.imread(photo)
8-
img = cv2.resize(img,(500,500))
8+
img = cv2.resize(img,(500,500))
99

10-
window = tk.Tk()
10+
window = tk.Tk()
1111
window.title("Perspective transform")
1212
window.geometry('350x200')
1313

1414

1515
# pts1 is an array storing coordinates of 4 points on the original image
16-
pts1 = np.float32([[103,97],[390,93],[85,351],[412,352]])
16+
pts1 = np.float32([[103,97],[390,93],[85,351],[412,352]])
1717
# pts2 is an array storing coordinates of 4 positions where the above points should be after the transformation
18-
pts2 = np.float32([[103,97],[390,93],[133,400],[390,400]])
18+
pts2 = np.float32([[103,97],[390,93],[133,400],[390,400]])
1919

20-
Mat = cv2.getPerspectiveTransform(pts1,pts2)
21-
dst = cv2.warpPerspective(img, Mat, (500,500))
20+
Mat = cv2.getPerspectiveTransform(pts1,pts2)
21+
dst = cv2.warpPerspective(img, Mat, (500,500))
2222

23-
label = tk.Label(window, text="Points chosen on original image: " + str(pts1)).grid(row=0, column=1)
24-
label = tk.Label(window, text="Points on transformed image: " + str(pts2)).grid(row=1, column=1)
25-
label = tk.Label(window, text="The coordinates can be changed in the code ").grid(row=2, column=1)
23+
label = tk.Label(window, text="Points chosen on original image: " +
24+
str(pts1)).grid(row=0, column=1)
25+
label = tk.Label(window, text="Points on transformed image: " +
26+
str(pts2)).grid(row=1, column=1)
27+
label = tk.Label(window, text="The coordinates can be changed in the code ").grid(
28+
row=2, column=1)
2629
# displaying the images
2730
cv2.imshow("Original Image", img)
2831
cv2.imshow("Transformed Image", dst)

0 commit comments

Comments
(0)

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