spatialGradient function

(Mat, Mat) spatialGradient(
  1. Mat src, {
  2. Mat? dx,
  3. Mat? dy,
  4. int ksize = 3,
  5. int borderType = BORDER_DEFAULT,
})

SpatialGradient calculates the first order image derivative in both x and y using a Sobel operator.

For further details, please see: https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga405d03b20c782b65a4daf54d233239a2

Implementation

(Mat dx, Mat dy) spatialGradient(
  Mat src, {
  Mat? dx,
  Mat? dy,
  int ksize = 3,
  int borderType = BORDER_DEFAULT,
}) {
  dx ??= Mat.empty();
  dy ??= Mat.empty();
  cvRun(() => cimgproc.SpatialGradient(src.ref, dx!.ref, dy!.ref, ksize, borderType));
  return (dx, dy);
}