enable bgsegm, xfeatures2d, xobjdetect and xphoto modules
MODIFY
build.rs
build.rs
@@ -36,7 +36,6 @@ fn get_modules(opencv_dir_as_string: &str) -> Result<&'static Vec<(String, Vec<S
return Ok(modules);
}
let ignore_modules: HashSet<&'static str> = HashSet::from_iter([
- "bgsegm",
"core_detect",
"cudalegacy",
"cudev",
@@ -56,10 +55,7 @@ fn get_modules(opencv_dir_as_string: &str) -> Result<&'static Vec<(String, Vec<S
"surface_matching",
"text",
"tracking",
- "xfeatures2d", // only appears in some builds, maybe platform or opencv compile flag specific
"ximgproc",
- "xobjdetect",
- "xphoto",
].iter().map(|x| *x));
let ignore_header_suffix = [
".details.hpp",

MODIFY
gen_rust.py
gen_rust.py
@@ -500,6 +500,9 @@ func_rename = {
### utility ###
"cv_getImpl_VectorOfint_VectorOfString": "-",
+
+ ### xfeatures2d ###
+ "cv_xfeatures2d_AffineFeature2D_create_PtrOfFeature2D_PtrOfFeature2D": "+_with_extrator",
}
# list of classes to skip, elements are regular expressions for re.match() against ClassInfo.fullname
@@ -614,6 +617,7 @@ type_replace = {
"Size_<float>": "Size2f",
"Size_<double>": "Size2d",
"Scalar_<double>": "Scalar",
+ "cv::xfeatures2d::Feature2D": "cv::Feature2D",
}
# dict for handling primitives
@@ -3563,6 +3567,8 @@ class RustWrapperGenerator(object):
# all your bases...
def all_bases(self, name):
bases = set()
+ if name in type_replace:
+ name = type_replace[name]
ci = self.get_class(name)
if ci is not None:
for b in ci.bases:
@@ -3589,8 +3595,8 @@ class RustWrapperGenerator(object):
logging.info("Not namespaced. Skipped %s", ci)
return
if ci.is_trait:
- if len(ci.bases):
bases = sorted(x.rust_full for x in (self.get_type_info(x) for x in ci.bases) if not isinstance(x, UnknownTypeInfo))
+ if len(bases) > 0:
bases = ": " + " + ".join(bases)
else:
bases = ""

enable bgsegm, xfeatures2d, xobjdetect and xphoto modules