1 #include <gtwrap/matlab.h> 22 std::streambuf *outbuf = std::cout.rdbuf(&mout);
24 bool anyDeleted =
false;
52 "WARNING: Wrap modules with variables in the workspace have been reloaded due to\n" 53 "calling destructors, call 'clear all' again if you plan to now recompile a wrap\n" 54 "module, so that your recompiled module is used instead of the old one." << endl;
55 std::cout.rdbuf(outbuf);
59 const mxArray *alreadyCreated = mexGetVariablePtr(
"global",
"gtsam_special_cases_rttiRegistry_created");
61 std::map<std::string, std::string> types;
65 mxArray *registry = mexGetVariable(
"global",
"gtsamwrap_rttiRegistry");
67 registry = mxCreateStructMatrix(1, 1, 0,
NULL);
68 typedef std::pair<std::string, std::string> StringPair;
69 for(
const StringPair& rtti_matlab: types) {
70 int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
72 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
74 mxArray *matlabName = mxCreateString(rtti_matlab.second.c_str());
75 mxSetFieldByNumber(registry, 0, fieldId, matlabName);
77 if(mexPutVariable(
"global",
"gtsamwrap_rttiRegistry", registry) != 0) {
78 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
80 mxDestroyArray(registry);
82 mxArray *newAlreadyCreated = mxCreateNumericMatrix(0, 0, mxINT8_CLASS, mxREAL);
83 if(mexPutVariable(
"global",
"gtsam_special_cases_rttiRegistry_created", newAlreadyCreated) != 0) {
84 mexErrMsgTxt(
"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
86 mxDestroyArray(newAlreadyCreated);
93 typedef std::shared_ptr<gtsam::NonlinearFactorGraph> Shared;
95 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
101 typedef std::shared_ptr<gtsam::NonlinearFactorGraph> Shared;
102 checkArguments(
"delete_gtsamNonlinearFactorGraph",nargout,nargin,1);
103 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
104 Collector_gtsamNonlinearFactorGraph::iterator item;
114 checkArguments(
"addPriorPinholeCameraCal3Bundler",nargout,nargin-1,3);
115 auto obj = unwrap_shared_ptr<gtsam::NonlinearFactorGraph>(in[0],
"ptr_gtsamNonlinearFactorGraph");
118 std::shared_ptr<gtsam::noiseModel::Base> noiseModel = unwrap_shared_ptr< gtsam::noiseModel::Base >(in[3],
"ptr_gtsamnoiseModelBase");
125 typedef std::shared_ptr<gtsam::SfmTrack> Shared;
127 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
133 typedef std::shared_ptr<gtsam::SfmTrack> Shared;
135 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
136 Collector_gtsamSfmTrack::iterator item;
147 auto obj = unwrap_shared_ptr<gtsam::SfmTrack>(in[0],
"ptr_gtsamSfmTrack");
154 auto obj = unwrap_shared_ptr<gtsam::SfmTrack>(in[0],
"ptr_gtsamSfmTrack");
155 std::shared_ptr<std::vector<std::pair<size_t,Point2>>> measurements = unwrap_shared_ptr< std::vector<std::pair<size_t,Point2>> >(in[1],
"ptr_stdvectorpairsize_tPoint2");
156 obj->measurements = *measurements;
162 typedef std::shared_ptr<gtsam::PinholeCamera<gtsam::Cal3Bundler>> Shared;
164 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
170 typedef std::shared_ptr<gtsam::PinholeCamera<gtsam::Cal3Bundler>> Shared;
171 checkArguments(
"delete_gtsamPinholeCameraCal3Bundler",nargout,nargin,1);
172 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
173 Collector_gtsamPinholeCameraCal3Bundler::iterator item;
184 typedef std::shared_ptr<gtsam::GeneralSFMFactor<gtsam::PinholeCamera<gtsam::Cal3Bundler>,
gtsam::Point3>> Shared;
186 Shared *
self = *
reinterpret_cast<Shared**
> (mxGetData(in[0]));
192 typedef std::shared_ptr<gtsam::GeneralSFMFactor<gtsam::PinholeCamera<gtsam::Cal3Bundler>,
gtsam::Point3>> Shared;
193 checkArguments(
"delete_gtsamGeneralSFMFactorCal3Bundler",nargout,nargin,1);
194 Shared *
self = *
reinterpret_cast<Shared**
>(mxGetData(in[0]));
195 Collector_gtsamGeneralSFMFactorCal3Bundler::iterator item;
206 auto obj = unwrap_shared_ptr<gtsam::GeneralSFMFactor<gtsam::PinholeCamera<gtsam::Cal3Bundler>,
gtsam::Point3>>(in[0],
"ptr_gtsamGeneralSFMFactorCal3Bundler");
207 out[0] =
wrap_enum(obj->verbosity,
"gtsam.GeneralSFMFactorCal3Bundler.Verbosity");
213 auto obj = unwrap_shared_ptr<gtsam::GeneralSFMFactor<gtsam::PinholeCamera<gtsam::Cal3Bundler>,
gtsam::Point3>>(in[0],
"ptr_gtsamGeneralSFMFactorCal3Bundler");
215 obj->verbosity = verbosity;
222 std::streambuf *outbuf = std::cout.rdbuf(&mout);
270 }
catch(
const std::exception&
e) {
271 mexErrMsgTxt((
"Exception from gtsam:\n" + std::string(e.what()) +
"\n").c_str());
274 std::cout.rdbuf(outbuf);
int unwrap< int >(const mxArray *array)
const gtsam::Symbol key('X', 0)
mxArray * wrap_shared_ptr(std::shared_ptr< Class > shared_ptr, const std::string &matlabName, bool isVirtual)
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
Point2 prior(const Point2 &x)
Prior on a single pose.
void gtsamNonlinearFactorGraph_deconstructor_1(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::ofstream out("Result.txt")
void checkArguments(const string &name, int nargout, int nargin, int expected)
void gtsamSfmTrack_get_measurements_5(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamGeneralSFMFactorCal3Bundler_collectorInsertAndMakeBase_9(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamGeneralSFMFactorCal3Bundler_deconstructor_10(int nargout, mxArray *out[], int nargin, const mxArray *in[])
gtsam::PinholeCamera< gtsam::Cal3Bundler > PinholeCameraCal3Bundler
std::set< std::shared_ptr< gtsam::SfmTrack > * > Collector_gtsamSfmTrack
void gtsamPinholeCameraCal3Bundler_collectorInsertAndMakeBase_7(int nargout, mxArray *out[], int nargin, const mxArray *in[])
iterator iter(handle obj)
void gtsamSfmTrack_set_measurements_6(int nargout, mxArray *out[], int nargin, const mxArray *in[])
size_t unwrap< size_t >(const mxArray *array)
static Collector_gtsamPinholeCameraCal3Bundler collector_gtsamPinholeCameraCal3Bundler
void gtsamSfmTrack_deconstructor_4(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void gtsamGeneralSFMFactorCal3Bundler_set_verbosity_12(int nargout, mxArray *out[], int nargin, const mxArray *in[])
void _special_cases_RTTIRegister()
gtsam::enable_if_t< needs_eigen_aligned_allocator< T >::value, std::shared_ptr< T > > make_shared(Args &&... args)
void gtsamGeneralSFMFactorCal3Bundler_get_verbosity_11(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_gtsamSfmTrack collector_gtsamSfmTrack
Array< double, 1, 3 > e(1./3., 0.5, 2.)
gtsam::GeneralSFMFactor< gtsam::PinholeCamera< gtsam::Cal3Bundler >, gtsam::Point3 > GeneralSFMFactorCal3Bundler
void gtsamPinholeCameraCal3Bundler_deconstructor_8(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< std::shared_ptr< PinholeCameraCal3Bundler > * > Collector_gtsamPinholeCameraCal3Bundler
std::set< std::shared_ptr< gtsam::NonlinearFactorGraph > * > Collector_gtsamNonlinearFactorGraph
void gtsamSfmTrack_collectorInsertAndMakeBase_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
static Collector_gtsamGeneralSFMFactorCal3Bundler collector_gtsamGeneralSFMFactorCal3Bundler
mxArray * wrap_enum(const T x, const std::string &classname)
Wrap the C++ enum to Matlab mxArray.
void gtsamNonlinearFactorGraph_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
std::set< std::shared_ptr< GeneralSFMFactorCal3Bundler > * > Collector_gtsamGeneralSFMFactorCal3Bundler
static Collector_gtsamNonlinearFactorGraph collector_gtsamNonlinearFactorGraph
Calibration used by Bundler.
void gtsamNonlinearFactorGraph_addPrior_2(int nargout, mxArray *out[], int nargin, const mxArray *in[])