2020-05-09 21:13:41 -04:00
|
|
|
/**
|
2020-05-20 09:45:39 -04:00
|
|
|
* Python interface for python matchers like:
|
|
|
|
|
* - SuperGlue: https://github.com/magicleap/SuperGluePretrainedNetwork
|
|
|
|
|
* - OANET https://github.com/zjhthu/OANet
|
2020-05-09 21:13:41 -04:00
|
|
|
*/
|
|
|
|
|
|
2020-05-20 09:45:39 -04:00
|
|
|
#ifndef PYMATCHER_H
|
|
|
|
|
#define PYMATCHER_H
|
2020-05-09 21:13:41 -04:00
|
|
|
|
|
|
|
|
#include <opencv2/core/types.hpp>
|
|
|
|
|
#include <opencv2/core/mat.hpp>
|
2021-01-17 01:56:27 -05:00
|
|
|
#include "rtabmap/core/PythonInterface.h"
|
2026-08-06 13:32:20 -07:00
|
|
|
#include "rtabmap/core/rtabmap_core_export.h"
|
2020-05-09 21:13:41 -04:00
|
|
|
#include <vector>
|
|
|
|
|
#include <Python.h>
|
|
|
|
|
|
|
|
|
|
namespace rtabmap
|
|
|
|
|
{
|
|
|
|
|
|
2026-08-06 13:32:20 -07:00
|
|
|
class RTABMAP_CORE_EXPORT PyMatcher
|
2020-05-09 21:13:41 -04:00
|
|
|
{
|
|
|
|
|
public:
|
2020-05-20 09:45:39 -04:00
|
|
|
PyMatcher(const std::string & pythonMatcherPath,
|
|
|
|
|
float matchThreshold = 0.2f,
|
|
|
|
|
int iterations = 20,
|
|
|
|
|
bool cuda = true,
|
|
|
|
|
const std::string & model = "indoor");
|
|
|
|
|
virtual ~PyMatcher();
|
2020-05-09 21:13:41 -04:00
|
|
|
|
|
|
|
|
const std::string & path() const {return path_;}
|
|
|
|
|
float matchThreshold() const {return matchThreshold_;}
|
|
|
|
|
int iterations() const {return iterations_;}
|
|
|
|
|
bool cuda() const {return cuda_;}
|
2020-05-20 09:45:39 -04:00
|
|
|
const std::string & model() const {return model_;}
|
2020-05-09 21:13:41 -04:00
|
|
|
|
|
|
|
|
std::vector<cv::DMatch> match(
|
|
|
|
|
const cv::Mat & descriptorsQuery,
|
|
|
|
|
const cv::Mat & descriptorsTrain,
|
|
|
|
|
const std::vector<cv::KeyPoint> & keypointsQuery,
|
|
|
|
|
const std::vector<cv::KeyPoint> & keypointsTrain,
|
|
|
|
|
const cv::Size & imageSize);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
PyObject * pModule_;
|
|
|
|
|
PyObject * pFunc_;
|
|
|
|
|
std::string path_;
|
|
|
|
|
float matchThreshold_;
|
|
|
|
|
int iterations_;
|
|
|
|
|
bool cuda_;
|
2020-05-20 09:45:39 -04:00
|
|
|
std::string model_;
|
2020-05-09 21:13:41 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|