Pysource.com

https://pysource.com/2018/02/27/morphological-transformation-opencv-3-4-with-python-3-tutorial-17/ dilate, erode image to remove small spots. See Python and opencv

cv2.morphologyEx dilate, erode in one step.

links
https://github.com/navigatingbots/OpenCV-python-tests

Learnopencv.com

Pyimagesearch.com