Method BlobFromImage
- Namespace
- OpenCvSharp
- Assembly
- OpenCvSharp.dll
BlobFromImage(Mat, double, Size, Scalar, bool, bool)
Creates 4-dimensional blob from image. Optionally resizes and crops @p image from center, subtract @p mean values, scales values by @p scalefactor, swap Blue and Red channels.
public static Mat BlobFromImage(Mat image, double scaleFactor = 1, Size size = default, Scalar mean = default, bool swapRB = true, bool crop = true)
Parameters
imageMatinput image (with 1- or 3-channels).
scaleFactordoublemultiplier for @p image values.
sizeSizespatial size for output image
meanScalarscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if @p image has BGR ordering and @p swapRB is true.
swapRBboolflag which indicates that swap first and last channels in 3-channel image is necessary.
cropboolflag which indicates whether image will be cropped after resize or not
Returns
- Mat
4-dimansional Mat with NCHW dimensions order.
Remarks
if @p crop is true, input image is resized so one side after resize is equal to corresponing dimension in @p size and another one is equal or larger.Then, crop from the center is performed. If @p crop is false, direct resize without cropping and preserving aspect ratio is performed.