1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2025-02-19 09:31:51 +03:00
130 changed files with 6998 additions and 3110 deletions
@@ -52,6 +52,20 @@ def apply_manual_api_refinement(root: NamespaceNode) -> None:
])
def make_optional_none_return(root_node: NamespaceNode,
function_symbol_name: SymbolName) -> None:
"""
Make return type Optional[MatLike],
for the functions that may return None.
"""
function = find_function_node(root_node, function_symbol_name)
for overload in function.overloads:
if overload.return_type is not None:
if not isinstance(overload.return_type.type_node, OptionalTypeNode):
overload.return_type.type_node = OptionalTypeNode(
overload.return_type.type_node
)
def export_matrix_type_constants(root: NamespaceNode) -> None:
MAX_PREDEFINED_CHANNELS = 4
@@ -326,6 +340,8 @@ NODES_TO_REFINE = {
SymbolName(("cv", ), (), "resize"): make_optional_arg("dsize"),
SymbolName(("cv", ), (), "calcHist"): make_optional_arg("mask"),
SymbolName(("cv", ), (), "floodFill"): make_optional_arg("mask"),
SymbolName(("cv", ), (), "imread"): make_optional_none_return,
SymbolName(("cv", ), (), "imdecode"): make_optional_none_return,
}
ERROR_CLASS_PROPERTIES = (
@@ -54,8 +54,12 @@ _PREDEFINED_TYPES = (
doc="Required length is 2"),
AliasTypeNode.sequence_("Size2f", PrimitiveTypeNode.float_(),
doc="Required length is 2"),
AliasTypeNode.sequence_("Scalar", PrimitiveTypeNode.float_(),
doc="Required length is at most 4"),
AliasTypeNode.union_(
"Scalar",
items=(SequenceTypeNode("Scalar", PrimitiveTypeNode.float_()),
PrimitiveTypeNode.float_()),
doc="Max sequence length is at most 4"
),
AliasTypeNode.sequence_("Point", PrimitiveTypeNode.int_(),
doc="Required length is 2"),
AliasTypeNode.ref_("Point2i", "Point"),