morphOpen static method
Morphological opening: erosion followed by dilation.
Removes small bright noise while preserving shape and size of larger objects.
Equivalent to OpenCV's cv::morphologyEx(MORPH_OPEN).
Implementation
static Uint8List morphOpen(
Uint8List gray,
int width,
int height, {
int kernelSize = 3,
}) {
final eroded = erode(gray, width, height, kernelSize: kernelSize);
return dilate(eroded, width, height, kernelSize: kernelSize);
}