Repository: opencv
Issue: Proposal: Drop Output and InputOutput arguments from Python bindings interfaces for OpenCV 5.x
Labels: category: python bindings,RFC,effort: few hours

##### System information (version)
- OpenCV => 3.x/4.x/5.x
- Operating System / Platform => Any
- Python versions => 2.x / 3.x

##### Detailed description

OpenCV 5 development is a great opportunity to resolve some design issues in interfaces that might break existing users' code, but resolve several issues.
One of such big things is to remove `InputOutput`/`Output` arguments from Python bindings interfaces.
C++ functions in OpenCV stick to `InOut/Out` arguments in their interfaces because it can save a lot of dynamic memory allocations.
Unfortunately in Python, this can not be done - you have to either modify the input argument (if it is possible e.g. `list`/`dict`) or return a new object.
Due to the automatic generation nature of the bindings (they should completely match or look pretty similar to their C++ parents) the "output" arguments strategy might lead to misusage of the interfaces and unexpected errors (Examples are in next section).

My proposal is to completely remove "output"/"input-output" arguments from Python interfaces because during the generation of the bindings they are already moved to the "return" section e.g.:
```python
Help on built-in function normalize:

normalize(...)
    normalize(src, dst[, alpha[, beta[, norm_type[, dtype[, mask]]]]]) -> dst
...
```

Efforts: easy - arguments can be easily filtered and be completely removed.

Unfortunately, help documentation for function parameters will be affected by this change too, but it is possible to match the name of the parameter and its help information.

This work correlates with #20370 in terms of interfaces improvement.

##### Steps to reproduce
The different result when output argument matches expected output type and when its not:
```python
test_input = np.array([1., 3., 6.])
test_output = np.zeros(test_input.shape, dtype=test_input.dtype)
res = cv2.normalize(test_input, test_output, 1.0, 0.0, cv2.NORM_L1)
print(test_output) # prints [0.1, 0.3, 0.6]
print(res) # prints [0.1, 0.3, 0.6]

test_output = np.zeros(test_input.shape, dtype=np.float32)
res = cv2.normalize(test_input, test_output, 1.0, 0.0, cv2.NORM_L1)
print(test_output) # prints [0., 0., 0.]
print(res) # prints [0.1, 0.3, 0.6]
```

Some operations can't be done in place in Python (e.g. `mixChannels`, `extractChannel`, `insertChannel`) (Some operations have their direct alternatives using numpy slices)
```python
src = np.ones((3, 3, 3), dtype=np.uint8)
dst = np.zeros(a.shape[:-1], dtype=a.dtype)
res = cv2.extractChannel(src, 0) # Correct behavior
res = cv2.extractChannel(src, 0, None) # Correct behavior
res = cv2.extractChannel(src, 0, dst) # Leads to TypeError: Expected Ptr<cv::UMat> for argument 'dst'
```

Misusage of the arguments doesn't lead to the error, but should:
```python
x = np.array([0., 1.])
y = np.array([1., 0.])
res = cv2.phase(x, y)
print(res) # prints [[1.5707964], [0. ]]
# If you want angle in degrees you may write:
res = cv2.phase(x, y, True) #  but definitely error should be rised
print(res) # prints [[1.5707964], [0. ]]
# Instead you should write, if you want to stick to positional arguments
res = cv2.phase(x, y, None, True) 
print(res) # prints [[90.], [0. ]]
# Or use keyword arguments
res = cv2.phase(x, y, angleInDegrees=True)
```

Bad style interface, because `None` is enforced to be used: e.g. #14461

As far as NumPy arrays are used for `Mat` representation in Python code it is possible to observe situations when an operation can be performed in-place or sometimes can't depending on array layout in memory.

##### Issue submission checklist

 - [x] I report the issue, it's not a question
 - [x] I checked the problem with documentation, FAQ, open issues,
       forum.opencv.org, Stack Overflow, etc and have not found solution
 - [x] I updated to latest OpenCV version and the issue is still there
 - [x] There is reproducer code and related data files: videos, images, onnx, etc