python - mentioning interpolation method in cv2.warpaffine() -


how can use bicubic interpolation method in cv2.warpaffine() method? trying rotate image through non-center point.

import cv2 import numpy np import matplotlib.pyplot plt  img = cv2.imread('1.jpg',0) rows,cols = img.shape m = cv2.getrotationmatrix2d((cols/2,rows/2),-40,1)  dst = cv2.warpaffine(img,m,(cols,rows),flags=cv_inter_cubic) #cv2.resize(src, dst, interpolation=cv_inter_cubic) plt.imshow(dst) 

with nameerror: name 'cv_inter_cubic' not defined

most of constants in opencv have prepending cv_ have them removed in newer versions , become constant_value instead of cv_constant_value. example, when you're changing colorspace bgr hsv, use cv2.color_bgr2hsv instead of cv2.cv_color_bgr2hsv use in c++. c++ constants interpolation methods have had prepending cv_ removed, it's inter_cubic , not cv_inter_cubic (although latter still defined). see e.g. docs resize() docs warpaffine() reference interpolation methods.

the basic separation cv_ constants come original c api. can see c api constants definitions here. , can see how prepending cv_ removed constants in newer api browsing through documentation, here e.g.

so anyways, answer question use flag cv2.inter_cubic.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -