Skip to content

Commit

Permalink
Merge branch 'module_rbt' of github.com:SamFlt/visp into module_rbt
Browse files Browse the repository at this point in the history
  • Loading branch information
SamFlt committed Oct 8, 2024
2 parents 4b3a38a + ce86309 commit 45cf1b6
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/python/bindings/include/rbt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#define VISP_PYTHON_RBT_HPP

#include "rbt/feature_tracker.hpp"
#include "rbt/vo.hpp"




Expand Down
49 changes: 49 additions & 0 deletions modules/python/bindings/include/rbt/vo.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

#ifndef VISP_PYTHON_RBT_VO_HPP
#define VISP_PYTHON_RBT_VO_HPP

#include <visp3/rbt/vpRBVisualOdometry.h>
#include <pybind11/pybind11.h>


class TrampolineRBVisualOdometry : public vpRBVisualOdometry
{
public:
using vpRBVisualOdometry::vpRBVisualOdometry;

TrampolineRBVisualOdometry() : vpRBVisualOdometry() { }

virtual void compute(const vpRBFeatureTrackerInput &frame, const vpRBFeatureTrackerInput &previousFrame) VP_OVERRIDE
{
pybind11::gil_scoped_acquire gil; // Acquire the GIL while in this scope.
// Try to look up the overridden method on the Python side.
pybind11::function override = pybind11::get_override(this, "compute");
if (override) { // method is found
// Pybind seems to copy the frames, so we pass the pointers
override(&frame, &previousFrame);
}
}

virtual vpHomogeneousMatrix getCameraMotion() const VP_OVERRIDE
{
PYBIND11_OVERRIDE(
vpHomogeneousMatrix, /* Return type */
vpRBVisualOdometry, /* Parent class */
getCameraMotion, /* Name of function in C++ (must match Python name) */

);
}
virtual vpHomogeneousMatrix getCameraPose() const VP_OVERRIDE
{
PYBIND11_OVERRIDE(
vpHomogeneousMatrix, /* Return type */
vpRBVisualOdometry, /* Parent class */
getCameraPose, /* Name of function in C++ (must match Python name) */

);
}
};



#endif
4 changes: 4 additions & 0 deletions modules/python/config/rbt.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@
}
]
},
"vpRBVisualOdometry": {
"trampoline": "TrampolineRBVisualOdometry",
"use_publicist": true
},
"vpObjectCentricRenderer": {
"methods": [
{
Expand Down
18 changes: 18 additions & 0 deletions modules/tracker/rbt/include/visp3/rbt/vpRBVisualOdometry.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef VP_RB_VISUAL_ODOMETRY_H
#define VP_RB_VISUAL_ODOMETRY_H

#include <visp3/core/vpConfig.h>

class vpRBFeatureTrackerInput;
class vpHomogeneousMatrix;

class VISP_EXPORT vpRBVisualOdometry
{
public:
virtual void compute(const vpRBFeatureTrackerInput &frame, const vpRBFeatureTrackerInput &previousFrame) = 0;
virtual vpHomogeneousMatrix getCameraMotion() const = 0;
virtual vpHomogeneousMatrix getCameraPose() const = 0;
};


#endif

0 comments on commit 45cf1b6

Please sign in to comment.