Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to solve this error? "AttributeError: 'module' object has no attribute 'wrapAffine'"

I am trying to run the following code:

    import cv2
    import numpy as np

    img = cv2.imread('images/input.png') 
    num_rows, num_cols = img.shape[:2]

    translation_matrix = np.float32([[1, 0, 70], [0, 1, 110]])
    img_translation = cv2.wrapAffine(img, translation_matrix, (num_cols, num_rows)) #I get the error in this line
    cv2.imshow('Translation', img_translation)
    cv2.waitKey()

But when I run the code I get this "C:\Python27\python.exe C:/OpenCV_Python/Python_Test.py Traceback (most recent call last): File "C:/OpenCV_Python/Python_Test.py", line 8, in <module> img_translation = cv2.wrapAffine(img, translation_matrix, (num_cols, num_rows)) AttributeError: 'module' object has no attribute 'wrapAffine'"

I am using OpenCV 3.1.0 and Python 2.7.11

Please help me. Thanks a lot in advance.

This code is from a book named "OpenCV with Python by Example" by Prateek Joshi. This book was first published in September 2015.

How to solve this error? "AttributeError: 'module' object has no attribute 'wrapAffine'"

I am trying to run the following code:

    import cv2
    import numpy as np

    img = cv2.imread('images/input.png') 
    num_rows, num_cols = img.shape[:2]

    translation_matrix = np.float32([[1, 0, 70], [0, 1, 110]])
    img_translation = cv2.wrapAffine(img, cv2.warpAffine(img, translation_matrix, (num_cols, num_rows)) #I get the error in this line
    cv2.imshow('Translation', img_translation)
    cv2.waitKey()

But when I run the code I get this "C:\Python27\python.exe C:/OpenCV_Python/Python_Test.py Traceback (most recent call last): File "C:/OpenCV_Python/Python_Test.py", line 8, in <module> img_translation = cv2.wrapAffine(img, translation_matrix, (num_cols, num_rows)) AttributeError: 'module' object has no attribute 'wrapAffine''warpAffine'"

I am using OpenCV 3.1.0 and Python 2.7.11

Please help me. Thanks a lot in advance.

This code is from a book named "OpenCV with Python by Example" by Prateek Joshi. This book was first published in September 2015.

click to hide/show revision 3
retagged

updated 2016-06-07 23:14:42 -0600

berak gravatar image

How to solve this error? "AttributeError: 'module' object has no attribute 'wrapAffine'"

I am trying to run the following code:

    import cv2
    import numpy as np

    img = cv2.imread('images/input.png') 
    num_rows, num_cols = img.shape[:2]

    translation_matrix = np.float32([[1, 0, 70], [0, 1, 110]])
    img_translation = cv2.warpAffine(img, translation_matrix, (num_cols, num_rows)) #I get the error in this line
    cv2.imshow('Translation', img_translation)
    cv2.waitKey()

But when I run the code I get this "C:\Python27\python.exe C:/OpenCV_Python/Python_Test.py Traceback (most recent call last): File "C:/OpenCV_Python/Python_Test.py", line 8, in <module> img_translation = cv2.wrapAffine(img, translation_matrix, (num_cols, num_rows)) AttributeError: 'module' object has no attribute 'warpAffine'"

I am using OpenCV 3.1.0 and Python 2.7.11

Please help me. Thanks a lot in advance.

This code is from a book named "OpenCV with Python by Example" by Prateek Joshi. This book was first published in September 2015.

How to solve this error? "AttributeError: 'module' object has no attribute 'wrapAffine'"'warpAffine'"

I am trying to run the following code:

    import cv2
    import numpy as np

    img = cv2.imread('images/input.png') 
    num_rows, num_cols = img.shape[:2]

    translation_matrix = np.float32([[1, 0, 70], [0, 1, 110]])
    img_translation = cv2.warpAffine(img, translation_matrix, (num_cols, num_rows)) #I get the error in this line
    cv2.imshow('Translation', img_translation)
    cv2.waitKey()

But when I run the code I get this "C:\Python27\python.exe C:/OpenCV_Python/Python_Test.py Traceback (most recent call last): File "C:/OpenCV_Python/Python_Test.py", line 8, in <module> img_translation = cv2.wrapAffine(img, translation_matrix, (num_cols, num_rows)) AttributeError: 'module' object has no attribute 'warpAffine'"

I am using OpenCV 3.1.0 and Python 2.7.11

Please help me. Thanks a lot in advance.

This code is from a book named "OpenCV with Python by Example" by Prateek Joshi. This book was first published in September 2015.

How to solve this error? "AttributeError: 'module' object has no attribute 'warpAffine'"'wrapAffine'"

I am trying to run the following code:

    import cv2
    import numpy as np

    img = cv2.imread('images/input.png') 
    num_rows, num_cols = img.shape[:2]

    translation_matrix = np.float32([[1, 0, 70], [0, 1, 110]])
    img_translation = cv2.warpAffine(img, cv2.wrapAffine(img, translation_matrix, (num_cols, num_rows)) #I get the error in this line
    cv2.imshow('Translation', img_translation)
    cv2.waitKey()

But when I run the code I get this "C:\Python27\python.exe C:/OpenCV_Python/Python_Test.py Traceback (most recent call last): File "C:/OpenCV_Python/Python_Test.py", line 8, in <module> img_translation = cv2.wrapAffine(img, translation_matrix, (num_cols, num_rows)) AttributeError: 'module' object has no attribute 'warpAffine''wrapAffine'"

I am using OpenCV 3.1.0 and Python 2.7.11

Please help me. Thanks a lot in advance.

This code is from a book named "OpenCV with Python by Example" by Prateek Joshi. This book was first published in September 2015.