Repository: opencv
Issue: kernel parameter for dilate and erode functions allowed to be None
Labels: question (invalid tracker),category: imgproc,category: documentation,affected: 3.4

##### System information (version)
- OpenCV => 4.4
- Operating System / Platform => Mac Catalina
- Compiler => Precompiled opencv-python on pip

##### Detailed description

In the Python API, both the `erode()` and `dilate()` functions have a required `kernel` parameter (previously it was an optional `element` parameter), but it is still possible to pass a `None` value for this parameter. This on its own isn't a problem, however the behavior where `kernel` is `None` isn't clearly documented. In the documentation for `dilate()`, the `kernel` parameter is described as such:

> structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular structuring element is used. Kernel can be created using getStructuringElement

Not only is there a spelling error, but it references an old name for the parameter (`element`, which I believe is from v. 2.x) that is no longer in use. It also doesn't mention the cases where `kernel=None`. In my testing, the behavior is the same as if an empty `Mat` object is passed in - a 3x3 kernel is used.

I'd update the documentation, but I wanted to raise the issue in case there was a desire to add more guardrails to the Python API and disallow the passing of `None` as the kernel, since in dilation and erosion an empty kernel doesn't make sense.


##### Steps to reproduce

```.py
image = cv2.imread("test_image.jpg")
dilated = cv2.dilate(edges, None)
eroded = cv2.erode(edges, None)
```

##### Issue submission checklist

 - [x] I report the issue, it's not a question
   <!--
   OpenCV team works with answers.opencv.org, Stack Overflow and other communities
   to discuss problems. Tickets with question without real issue statement will be
   closed.
   -->
 - [x] I checked the problem with documentation, FAQ, open issues,
       answers.opencv.org, Stack Overflow, etc and have not found solution
   <!--
   Places to check:
   * OpenCV documentation: https://docs.opencv.org
   * FAQ page: https://github.com/opencv/opencv/wiki/FAQ
   * OpenCV forum: https://answers.opencv.org
   * OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
   * Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
   -->
 - [x] I updated to latest OpenCV version and the issue is still there
   <!--
   master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
   OpenCV team supports only latest release for each branch.
   The ticket is closed, if the problem is not reproduced with modern version.
   -->
 - [x] There is reproducer code and related data files: videos, images, onnx, etc
   <!--
   The best reproducer -- test case for OpenCV that we can add to the library.
   Recommendations for media files and binary files:
   * Try to reproduce the issue with images and videos in opencv_extra repository
     to reduce attachment size
   * Use PNG for images, if you report some CV related bug, but not image reader
     issue
   * Attach the image as archite to the ticket, if you report some reader issue.
     Image hosting services compress images and it breaks the repro code.
   * Provide ONNX file for some public model or ONNX file with with random weights,
     if you report ONNX parsing or handling issue. Architecture details diagram
     from netron tool can be very useful too. See https://lutzroeder.github.io/netron/
   -->