[−][src]Function opencv::imgproc::resize
pub fn resize(
src: &dyn ToInputArray,
dst: &mut dyn ToOutputArray,
dsize: Size,
fx: f64,
fy: f64,
interpolation: i32
) -> Result<()>
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:
ⓘThis example is not tested
// explicitly specify dsize=dst.size(); fx and fy will be computed from that. resize(src, dst, dst.size(), 0, 0, interpolation);
If you want to decimate the image by factor of 2 in each direction, you can call the function this way:
ⓘThis example is not tested
// specify fx and fy and let the function compute the destination image size. resize(src, dst, Size(), 0.5, 0.5, interpolation);
To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to enlarge an image, it will generally look best with c#INTER_CUBIC (slow) or #INTER_LINEAR (faster but still looks OK).
Parameters
- 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: Either dsize or both fx and fy must be non-zero.
- 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, see #InterpolationFlags
See also
warpAffine, warpPerspective, remap
C++ default parameters
- fx: 0
- fy: 0
- interpolation: INTER_LINEAR