Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

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

$
0
0
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 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.

Viewing all articles
Browse latest Browse all 19555

Trending Articles