morphClose static method

Uint8List morphClose(
  1. Uint8List gray,
  2. int width,
  3. int height, {
  4. int kernelSize = 3,
})

Morphological closing: dilation followed by erosion.

Fills small dark holes while preserving shape and size of larger objects. Equivalent to OpenCV's cv::morphologyEx(MORPH_CLOSE).

Implementation

static Uint8List morphClose(
  Uint8List gray,
  int width,
  int height, {
  int kernelSize = 3,
}) {
  final dilated = dilate(gray, width, height, kernelSize: kernelSize);
  return erode(dilated, width, height, kernelSize: kernelSize);
}