def zoom_cv ( x , z ) : if z == 0 : return x r , c ,  * _ = x . shape M = cv2 . getRotationMatrix2D ( ( c / 2 , r / 2 ) , 0 , z + 1. ) return cv2 . warpAffine ( x , M , ( c , r ) )
python opencv rotate along z axis
Zoom the center of image x by a factor of z + 1 while retaining the original image size and proportion .
def zoom_cv(x,z):
    """ Zoom the center of image x by a factor of z+1 while retaining the original image size and proportion. """
    if z==0: return x
    r,c,*_ = x.shape
    M = cv2.getRotationMatrix2D((c/2,r/2),0,z+1.)
    return cv2.warpAffine(x,M,(c,r))