1

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
Felix Kunz
  • 354
  • 2
  • 15
  • Possible duplicate of [Invalid character in identifier](https://stackoverflow.com/questions/14844687/invalid-character-in-identifier) – Flomp Jul 14 '17 at 10:13
  • [MCVE](https://stackoverflow.com/help/mcve) = Minimal, **Complete** and Verifiable example. Complete meaning that someone else can copy the code and run it to reproduce the problem, without having to muck about adding all the missing imports and whatever else that's necessary to actually call the function. – Dan Mašek Jul 14 '17 at 16:45

0 Answers0