OpenCV 图形API(78)图像与通道拼接函数-----调整图像大小的函数resize-参数

时间:2025-05-08 19:46:52
  • 参数 src:输入图像。

  • 参数 dsize:输出图像的尺寸;如果为零,则根据 fx 和 fy 计算得出:
    dsize   =   Size(round(fx*src.cols),   round(fy*src.rows)) \texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))} dsize = Size(round(fx*src.cols), round(fy*src.rows))
    dsize 必须非零,或者 fx 和 fy 都必须非零。

  • fx:水平方向上的缩放因子;当为 0 时,将根据 dsize.width / src.cols 自动计算:
    (double)dsize.width/src.cols \texttt{(double)dsize.width/src.cols} (double)dsize.width/src.cols

  • fy:垂直方向上的缩放因子;当为 0 时,将根据 dsize.height / src.rows 自动计算:
    (double)dsize.height/src.rows \texttt{(double)dsize.height/src.rows} (double)dsize.height/src.rows

  • interpolation:插值方法,详见 cv::InterpolationFlags(例如 INTER_NEAREST, INTER_LINEAR, INTER_CUBIC, INTER_AREA 等)。