-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'module_rbt' of github.com:SamFlt/visp into module_rbt
- Loading branch information
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,8 @@ | |
#define VISP_PYTHON_RBT_HPP | ||
|
||
#include "rbt/feature_tracker.hpp" | ||
#include "rbt/vo.hpp" | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
modules/tracker/rbt/include/visp3/rbt/vpRBVisualOdometry.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |