From 26469c7286966c9d3265f6958c71c6349d9d0ee6 Mon Sep 17 00:00:00 2001 From: Samuel Felton Date: Tue, 1 Oct 2024 17:16:05 +0200 Subject: [PATCH] Fixed python members export to Python bindings --- modules/python/examples/realsense-rbt.py | 7 -- .../generator/visp_python_bindgen/header.py | 6 +- .../render-based/data/sequence1/dragon.0.pos | 12 +-- .../render-based/data/sequence1/dragon.json | 90 ++++++++----------- 4 files changed, 46 insertions(+), 69 deletions(-) mode change 100755 => 100644 tutorial/tracking/render-based/data/sequence1/dragon.0.pos diff --git a/modules/python/examples/realsense-rbt.py b/modules/python/examples/realsense-rbt.py index 87903bbae0..be5a301ee4 100644 --- a/modules/python/examples/realsense-rbt.py +++ b/modules/python/examples/realsense-rbt.py @@ -52,13 +52,6 @@ import pyrealsense2 as rs -try: - import cv2 -except: - print('Could not import opencv-python! make sure that it is installed as it is required') - import sys - sys.exit(1) - import matplotlib.pyplot as plt class PyBaseFeatureTracker(RBFeatureTracker): diff --git a/modules/python/generator/visp_python_bindgen/header.py b/modules/python/generator/visp_python_bindgen/header.py index b0617e07ae..ddec90be2b 100644 --- a/modules/python/generator/visp_python_bindgen/header.py +++ b/modules/python/generator/visp_python_bindgen/header.py @@ -531,7 +531,11 @@ def add_method_doc_to_pyargs(method: types.Method, py_arg_strs: List[str]) -> Li continue field_type = get_type(field.type, owner_specs, header_env.mapping) - field_name_python = field.name.lstrip('m_') + field_name_python = field.name + prefix_member = 'm_' + if field_name_python.startswith(prefix_member): + field_name_python = field_name_python[len(prefix_member):] + logging.info(f'Found field in class/struct {name_cpp}: {field_type} {field.name}') def_str = 'def_' diff --git a/tutorial/tracking/render-based/data/sequence1/dragon.0.pos b/tutorial/tracking/render-based/data/sequence1/dragon.0.pos old mode 100755 new mode 100644 index 1f8b41994b..04e1697184 --- a/tutorial/tracking/render-based/data/sequence1/dragon.0.pos +++ b/tutorial/tracking/render-based/data/sequence1/dragon.0.pos @@ -1,6 +1,6 @@ -0.03385069791 -0.009459969456 -0.1522304652 --2.625824241 --0.03646930969 -0.601980212 \ No newline at end of file +-0.005349535388 +-0.01516976067 +0.2050684923 +-2.690336518 +-0.02316506528 +0.06402556549 \ No newline at end of file diff --git a/tutorial/tracking/render-based/data/sequence1/dragon.json b/tutorial/tracking/render-based/data/sequence1/dragon.json index 3602503ad7..7808f7c326 100644 --- a/tutorial/tracking/render-based/data/sequence1/dragon.json +++ b/tutorial/tracking/render-based/data/sequence1/dragon.json @@ -15,67 +15,47 @@ "maxIterations": 10 }, "model": "data/sequence1/dragon.obj", - - "silhouetteExtractionSettings" : { + "silhouetteExtractionSettings": { "threshold": { "type": "relative", - "value": 0.1, - "reusePreviousPoints": true + "value": 0.1 }, - "sampling" : { + "sampling": { "samplingRate": 1, - "numPoints": 128 + "numPoints": 256, + "reusePreviousPoints": true } }, - -"mask": { - "type": "histogram", - "bins": 32, - "objectUpdateRate": 0.1, - "backgroundUpdateRate": 0.1, - "maxDepthError": 0.01 -}, -"drift": { - "type": "probabilistic", - "colorUpdateRate": 0.1, - "initialColorSigma": 15.0, - "depthSigma": 0.01, - "filteringMaxDistance": 0.001, - "minDistanceNewPoints": 0.005 -}, -"features": [ - { - "type": "depth", - "weight": 0.1, - "step": 8, - "useMask": true, - "minMaskConfidence": 0.7 + "mask": { + "type": "histogram", + "bins": 32, + "objectUpdateRate": 0.1, + "backgroundUpdateRate": 0.1, + "maxDepthError": 0.01 }, - { - "type": "silhouetteColor", - "weight": 0.01, - "ccd": { - "h": 8, - "delta_h": 1 - } + "drift": { + "type": "probabilistic", + "colorUpdateRate": 0.1, + "initialColorSigma": 15.0, + "depthSigma": 0.01, + "filteringMaxDistance": 0.001, + "minDistanceNewPoints": 0.005 }, - - { - "type": "klt", - "weight": 0.1, - "useMask": true, - "minMaskConfidence": 0.5, - "maxReprojectionErrorPixels": 5.0, - "newPointsMinPixelDistance": 4, - "minimumNumPoints": 20, - "blockSize": 5, - "useHarris": true, - "harris": 0.05, - "maxFeatures": 500, - "minDistance": 5.0, - "pyramidLevels": 3, - "quality": 0.01, - "windowSize": 5 - } -] + "features": [ + { + "type": "depth", + "weight": 0.1, + "step": 8, + "useMask": true, + "minMaskConfidence": 0.7 + }, + { + "type": "silhouetteColor", + "weight": 0.01, + "ccd": { + "h": 8, + "delta_h": 1 + } + } + ] }