cv2.resize

简介:
  • src – input image.
  • dst – output image; it has the size dsize (when it is non-zero) or the size computed from src.size(), fx, and fy; the type of dst is the same as of src.
  • dsize –output image size; if it equals zero, it is computed as: 
    dsize = Size(round(fx × src.cols), round(fy × src.rows))
  • fx –scale factor along the horizontal axis; when it equals 0, it is computed as
  • fy –scale factor along the vertical axis; when it equals 0, it is computed as
  • interpolation –interpolation method:
  • INTER_NEAREST a nearest-neighbor interpolation  最近邻插值
    INTER_LINEAR a bilinear interpolation (used by default)  双线性插值(默认设置)
    INTER_AREA resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire’-free results. But when the image is zoomed, it is similar to the INTER_NEAREST method.使用像素区域关系进行重采样。 它可能是图像抽取的首选方法,因为它会产生无云纹理的结果。 但是当图像缩放时,它类似于INTER_NEAREST方法。
    INTER_CUBIC a bicubic interpolation over 4x4 pixel neighborhood  4x4像素邻域的双三次插值
    INTER_LANCZOS4 a Lanczos interpolation over 8x8 pixel neighborhood  8x8像素邻域的Lanczos插值


resize(...)

    resize(src, dsize[, dst[, fx[, fy[, interpolation]]]]) -> dst

    .   @brief Resizes an image.

    .   

    .   The function resize resizes the image src down to or up to the specified size. Note that the

    .   initial dst type or size are not taken into account. Instead, the size and type are derived from

    .   the `src`,`dsize`,`fx`, and `fy`. If you want to resize src so that it fits the pre-created dst,

    .   you may call the function as follows:

    .   @code

    .   // explicitly specify dsize=dst.size(); fx and fy will be computed from that.

    .   resize(src, dst, dst.size(), 0, 0, interpolation);

    .   @endcode

    .   If you want to decimate the image by factor of 2 in each direction, you can call the function this

    .   way:

    .   @code

    .   // specify fx and fy and let the function compute the destination image size.

    .   resize(src, dst, Size(), 0.5, 0.5, interpolation);

    .   @endcode

    .   To shrink an image, it will generally look best with cv::INTER_AREA interpolation, whereas to

    .   enlarge an image, it will generally look best with cv::INTER_CUBIC (slow) or cv::INTER_LINEAR

    .   (faster but still looks OK).

    .   

    .   @param src input image.

    .   @param dst output image; it has the size dsize (when it is non-zero) or the size computed from

    .   src.size(), fx, and fy; the type of dst is the same as of src.

    .   @param dsize output image size; if it equals zero, it is computed as:

    .   \f[\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\f]

    .   Either dsize or both fx and fy must be non-zero.

    .   @param fx scale factor along the horizontal axis; when it equals 0, it is computed as

    .   \f[\texttt{(double)dsize.width/src.cols}\f]

    .   @param fy scale factor along the vertical axis; when it equals 0, it is computed as

    .   \f[\texttt{(double)dsize.height/src.rows}\f]

    .   @param interpolation interpolation method, see cv::InterpolationFlags

    .   

    .   @sa  warpAffine, warpPerspective, remap

目录
相关文章
|
7月前
|
存储 编译器 计算机视觉
cv::Mat
cv::Mat
67 3
|
2月前
|
算法 计算机视觉
Opencv学习笔记(六):cv2.resize函数的介绍
这篇文章介绍了OpenCV库中cv2.resize函数的使用方法,包括其参数、插值方式选择以及实际代码示例。
468 1
Opencv学习笔记(六):cv2.resize函数的介绍
|
2月前
|
计算机视觉
Opencv学习笔记(五):cv2.putText()和cv2.rectangle()详细理解
这篇文章详细介绍了OpenCV库中的`cv2.putText()`和`cv2.rectangle()`函数的使用方法,并通过一个实战例子展示了如何使用这些函数在图像上绘制文字和矩形框。
266 0
Opencv学习笔记(五):cv2.putText()和cv2.rectangle()详细理解
|
7月前
|
计算机视觉
cv2.putText
cv2.putText
476 1
|
7月前
|
计算机视觉 Python
cv2.polylines
cv2.polylines
327 1
|
7月前
|
计算机视觉 Python
opencv cv::Range()和cv::Rect()用于crop来获得感兴趣区域
opencv cv::Range()和cv::Rect()用于crop来获得感兴趣区域
280 0
|
计算机视觉
|
计算机视觉
OpenCV-尺寸调整cv::resize
OpenCV-尺寸调整cv::resize
|
计算机视觉
OpenCV-均值滤波cv::blur
OpenCV-均值滤波cv::blur
116 0
|
计算机视觉 Python
cv2 resize 与reshape的区别
cv2 resize 与reshape的区别