blobFromImage function
Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
For further details, please see: https://docs.opencv.org/4.x/d6/d0f/group__dnn.html#ga29f34df9376379a603acd8df581ac8d7
Implementation
Mat blobFromImage(
InputArray image, {
double scalefactor = 1.0,
Size? size,
Scalar? mean,
bool swapRB = false,
bool crop = false,
int ddepth = MatType.CV_32F,
}) {
return using<Mat>((arena) {
size ??= (0, 0);
mean ??= Scalar.zeros;
final _ptr = _bindings.Net_BlobFromImage(
image.ptr,
scalefactor,
size!.toSize(arena).ref,
mean!.ref,
swapRB,
crop,
ddepth,
);
return Mat.fromCMat(_ptr);
});
}