In the description, the morphological operation is dilating before eroding. But in your code, you erode before you dilate. And we have the same problem with open operation.
File: ImageProcessing100Wen/Question_41_50/answers_py/answer_49.py, answer_50.py
In the description, the morphological operation is dilating before eroding. But in your code, you erode before you dilate. And we have the same problem with open operation. File: ImageProcessing100Wen/Question_41_50/answers_py/answer_49.py, answer_50.py