Document read-only check in Python bindings.

This commit is contained in:
Alexander Smorkalov 2023-12-25 12:47:39 +03:00
parent 4884083019
commit 639fd80aa3

View File

@ -79,9 +79,12 @@ Functions are extended using `CV_EXPORTS_W` macro. An example is shown below.
@code{.cpp} @code{.cpp}
CV_EXPORTS_W void equalizeHist( InputArray src, OutputArray dst ); CV_EXPORTS_W void equalizeHist( InputArray src, OutputArray dst );
@endcode @endcode
Header parser can understand the input and output arguments from keywords like Header parser can understand the input and output arguments from keywords like InputArray,
InputArray, OutputArray etc. But sometimes, we may need to hardcode inputs and outputs. For that, OutputArray etc. The arguments semantics are kept in Python: anything that is modified in C++
macros like `CV_OUT`, `CV_IN_OUT` etc. are used. will be modified in Python. And vice-versa read-only Python objects cannot be modified by OpenCV,
if they are used as output. Such situation will cause Python exception. Sometimes, the parameters
that are passed by reference in C++ may be used as input, output or both.
Macros `CV_OUT`, `CV_IN_OUT` allow to solve ambiguity and generate correct bindings.
@code{.cpp} @code{.cpp}
CV_EXPORTS_W void minEnclosingCircle( InputArray points, CV_EXPORTS_W void minEnclosingCircle( InputArray points,
CV_OUT Point2f& center, CV_OUT float& radius ); CV_OUT Point2f& center, CV_OUT float& radius );