I have copied a codesnippet in my existing code ang get the error:
File "qrcode.py", line 51
return warped
^
SyntaxError: invalid character in identifier
I have done some research and they all said something about Hidden symbols, and i should rewrite the code by myself. Now after retyping my code i have still the same problem.
my codesnippet:
def four_point_transform(image, pts):
widthA = np.sqrt(
((pts[2][0] - pts[3][0]) ** 2) + ((pts[2][1] - pts[3][1]) ** 2))
widthB = np.sqrt(
((pts[1][0] - pts[0][0]) ** 2) + ((pts[1][1] - pts[0][1]) ** 2))
maxWidth = max(int(widthA), int(widthB))
heightA = np.sqrt(
((pts[1][0] - pts[2][0]) ** 2) + ((pts[1][1] - pts[2][1]) ** 2))
heightB = np.sqrt(
((pts[0][0] - pts[3][0]) ** 2) + ((pts[0][1] - pts[3][1]) ** 2))
maxHeight = max(int(heightA), int(heightB))
dst = np.array([
[0, 0],
[maxWidth - 1, 0],
[maxWidth - 1, maxHeight - 1],
[0, maxHeight - 1]], dtype="float32")
M = cv2.getPerspectiveTransform(pts, dst)
warped = cv2.warpPerspective(image, M, (maxWidth, maxHeight))
return warped