enable aruco module
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([
- "aruco",
"bgsegm",
"core_detect",
"cudalegacy",
@@ -128,6 +127,7 @@ fn get_modules(opencv_dir_as_string: &str) -> Result<&'static Vec<(String, Vec<S
"core/types.hpp",
"core/mat.hpp",
"core/persistence.hpp",
+ "aruco/dictionary.hpp",
];
modules.sort_by_key(|(mod_name, ..)| module_order.iter().position(|&order_module| order_module == mod_name).unwrap_or_else(|| module_order.len()));
@@ -267,15 +267,22 @@ fn build_wrapper(opencv_header_dir: &PathBuf) -> Result<(), Box<dyn Error>> {
writeln!(&mut types, "#define HAVE_OPENCV_OCL true")?; // for 3.2 opencl support
for m in modules {
writeln!(&mut types, "#include <opencv2/{}.hpp>", m.0)?;
- if m.0 == "dnn" {
+ match m.0.as_str() {
+ "dnn" => {
// include it manually, otherwise it's not included
if cfg!(feature = "opencv-41") {
writeln!(&mut types, "#include <opencv2/{}/version.hpp>", m.0)?;
}
writeln!(&mut types, "#include <opencv2/{}/all_layers.hpp>", m.0)?;
- } else if m.0 == "core" {
+ }
+ "aruco" => {
+ writeln!(&mut types, "#include <opencv2/{}/charuco.hpp>", m.0)?;
+ }
+ "core" => {
writeln!(&mut types, "#include <opencv2/{}/ocl.hpp>", m.0)?;
}
+ _ => ()
+ }
}
if !cfg!(feature = "opencv-32") {
writeln!(&mut types, "#include <opencv2/core/utils/logger.hpp>")?;

MODIFY
gen_rust.py
gen_rust.py
@@ -132,6 +132,16 @@ decls_manual_post = {
# dict of functions to rename or skip, key is FuncInfo.identifier, value is new name ("+" will be replaces by old name) or "-" to skip
func_rename = {
+ ### aruco ###
+ "cv_aruco_calibrateCameraAruco__InputArray__InputArray__InputArray_PtrOfBoard_Size__InputOutputArray__InputOutputArray__OutputArray__OutputArray__OutputArray__OutputArray__OutputArray_int_TermCriteria": "+_with_stddev",
+ "cv_aruco_calibrateCameraCharuco__InputArray__InputArray_PtrOfCharucoBoard_Size__InputOutputArray__InputOutputArray__OutputArray__OutputArray__OutputArray__OutputArray__OutputArray_int_TermCriteria": "+_with_stddev",
+ "cv_aruco_generateCustomDictionary_int_int_PtrOfDictionary": "+_with_base", # 3.2 only
+ "cv_aruco_generateCustomDictionary_int_int_PtrOfDictionary_int": "+_with_base",
+ "cv_aruco_getPredefinedDictionary_int": "+_i32",
+ "cv_aruco_Dictionary_Dictionary_PtrOfDictionary": "copy",
+ "cv_aruco_Dictionary_create_int_int_PtrOfDictionary": "+_with_base", # 3.2 only
+ "cv_aruco_Dictionary_create_int_int_PtrOfDictionary_int": "+_with_base",
+
### bioinspired ###
"cv_bioinspired_Retina_setup_String_bool": "+_from_file",
"cv_bioinspired_Retina_getParvoRAW__OutputArray": "+_to",
@@ -802,6 +812,9 @@ force_slice = {
# set of enum's that need to be generated, other enums are just expanded to constants, elements are EnumInfo.fullname
enum_generate = {
+ ### aruco ###
+ "cv::aruco::PREDEFINED_DICTIONARY_NAME",
+
### calib3d ###
"cv::HandEyeCalibrationMethod",

MODIFY
hdr_parser.py
hdr_parser.py
@@ -772,6 +772,8 @@ class CppHeaderParser(object):
return stmt_type, classname, True, decl
if stmt.startswith("enum") or stmt.startswith("namespace"):
+ if "CV_EXPORTS_W_SIMPLE " in stmt:
+ stmt = stmt.replace("CV_EXPORTS_W_SIMPLE ", "")
stmt_list = stmt.rsplit(" ", 1)
if len(stmt_list) < 2:
stmt_list.append("<unnamed>")

enable aruco module