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

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2025-09-26 09:24:38 +03:00
91 changed files with 5339 additions and 1508 deletions
+34 -6
View File
@@ -320,7 +320,6 @@ class Namespace(object):
class JSWrapperGenerator(object):
def __init__(self, preprocessor_definitions=None):
self.bindings = []
self.wrapper_funcs = []
@@ -333,6 +332,29 @@ class JSWrapperGenerator(object):
)
self.class_idx = 0
def _is_string_type(self, tp: str) -> bool:
"""Check if a type should be treated as string in bindings."""
string_types = {
"std::string",
"char",
"signed char",
"unsigned char",
}
return tp in string_types
def _generate_class_properties(self, class_info, class_bindings):
# Generate bindings for properties
for prop in class_info.props:
if prop.tp in type_dict and not self._is_string_type(prop.tp):
_class_property = class_property_enum_template
else:
_class_property = class_property_template
class_bindings.append(_class_property.substitute(
js_name=prop.name,
cpp_name='::'.join([class_info.cname, prop.name])
))
def add_class(self, stype, name, decl):
class_info = ClassInfo(name, decl)
class_info.decl_idx = self.class_idx
@@ -893,11 +915,17 @@ class JSWrapperGenerator(object):
# Generate bindings for properties
for property in class_info.props:
_class_property = class_property_enum_template if property.tp in type_dict else class_property_template
class_bindings.append(_class_property.substitute(js_name=property.name, cpp_name='::'.join(
[class_info.cname, property.name])))
# Generate bindings for properties(prop)
for prop in class_info.props:
if prop.tp in type_dict and not self._is_string_type(prop.tp):
_class_property = class_property_enum_template
else:
_class_property = class_property_template
class_bindings.append(_class_property.substitute(
js_name=prop.name,
cpp_name='::'.join([class_info.cname, prop.name])
))
dv = ''
base = Template("""base<$base>""")
+4
View File
@@ -107,6 +107,10 @@ typedef SimpleBlobDetector::Params SimpleBlobDetector_Params;
typedef TrackerMIL::Params TrackerMIL_Params;
#endif
#ifdef HAVE_OPENCV_XIMGPROC
typedef ximgproc::EdgeDrawing::Params EdgeDrawing_Params;
#endif
// HACK: JS generator ommits namespace for parameter types for some reason. Added typedef to handle std::string correctly
typedef std::string string;