openCV cv2.warpAffine

获取仿射变换后的图片
affine_matrix_image = cv2.warpAffine(image, affine_matrix, (image_w, image_h))
def warpAffine(src, M, dsize, dst=None, flags=None, borderMode=None, borderValue=None): # real signature unknown; restored from __doc__
    """
    warpAffine(src, M, dsize[, dst[, flags[, borderMode[, borderValue]]]]) -> dst
    .   @brief Applies an affine transformation to an image.
    .   
    .   The function warpAffine transforms the source image using the specified matrix:
    .   
    .   \f[\texttt{dst} (x,y) =  \texttt{src} ( \texttt{M} _{11} x +  \texttt{M} _{12} y +  \texttt{M} _{13}, \texttt{M} _{21} x +  \texttt{M} _{22} y +  \texttt{M} _{23})\f]
    .   
    .   when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted
    .   with #invertAffineTransform and then put in the formula above instead of M. The function cannot
    .   operate in-place.
    .   
    .   @param src input image.
    .   @param dst output image that has the size dsize and the same type as src .
    .   @param M \f$2\times 3\f$ transformation matrix.
    .   @param dsize size of the output image.
    .   @param flags combination of interpolation methods (see #InterpolationFlags) and the optional
    .   flag #WARP_INVERSE_MAP that means that M is the inverse transformation (
    .   \f$\texttt{dst}\rightarrow\texttt{src}\f$ ).
    .   @param borderMode pixel extrapolation method (see #BorderTypes); when
    .   borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to
    .   the "outliers" in the source image are not modified by the function.
    .   @param borderValue value used in case of a constant border; by default, it is 0.
    .   
    .   @sa  warpPerspective, resize, remap, getRectSubPix, transform
    """
    pass

猜你喜欢

转载自blog.csdn.net/xkx_07_10/article/details/103510723