您的位置:首页 > 运维架构

【OpenCv 学习ing】warpPerspective用法

2014-10-27 16:47 337 查看
文档说明:

Applies a perspective transformation to an image.

C++: void warpPerspective(InputArray src,
OutputArray dst, InputArray M, Size dsize, int flags=INTER_LINEAR, intborderMode=BORDER_CONSTANT, const Scalar& borderValue=Scalar())

Python: cv2.warpPerspective(src,
M, dsize[, dst[, flags[, borderMode[, borderValue]]]]) →
dst

C: void cvWarpPerspective(const
CvArr* src, CvArr* dst, const CvMat* mapMatrix, int flags=CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS, CvScalar fillval=cvScalarAll(0) )

Python: cv.WarpPerspective(src,
dst, mapMatrix, flags=CV_INNER_LINEAR+CV_WARP_FILL_OUTLIERS, fillval=(0, 0, 0, 0)) → None
Parameters:src – Source image.
dst – Destination image that has the size dsize and the same type as src .
M

transformation
matrix.
dsize – Size of the destination image.
flags – Combination of interpolation methods (see resize() )
and the optional flag WARP_INVERSE_MAP that means that Mis
the inverse transformation (

).
borderMode – Pixel extrapolation method (see borderInterpolate() ).
When borderMode=BORDER_TRANSPARENT , it means that the pixels in the destination image that corresponds to the “outliers” in the source
image are not modified by the function.
borderValue – Value used in case of a constant border. By default, it is 0.

The function warpPerspective transforms the source image using the specified matrix:



when the flag WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert() and
then put in the formula above instead of M . The function cannot operate in-place.

===========================译:=================================================

功能: 对图像进行透视变换。

参数:

src 输入图像

dst 目标图像

map_matrix 3*3变换矩阵

flags CV_INTER_LINEAR 填充所有目标图像的像素,如果部分图像落在边界外,那么它们的值将被设定为fillval

CV_WARP_FILL_OUTLIERS 指定map_matrix是目标图像的输入图像的反变换

fillval 用于填充边界之外的像素的值
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: