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.
hmm, why did you try to "correct" the error in your example ? it does not make any sense, and will confuse readers
I mistakenly asked the question with a typo that's why i had to correct it. I am extremely sorry.
don't be sorry, just edit it back to the original, and let's keep the "follow-up" problems with the answer, right ?
okay. I am editing back to its original form.