5 #include "../rpp_types.h" 6 #include "../rpp_vecmat.h" 11 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
13 const mxArray *model_p, *iprts_p;
14 double *model_v, *iprts_v, *R_v, *t_v, *e_v;
18 model_v = mxGetPr(model_p);
19 iprts_v = mxGetPr(iprts_p);
21 if(mxGetN(model_p) != mxGetN(iprts_p))
23 mexErrMsgTxt(
"size(model) ~= size(iprts)");
26 if((mxGetM(model_p) != 3) || (mxGetM(iprts_p) != 3))
28 mexErrMsgTxt(
"[model] and [iprts] must be 3-by-N matrices");
33 unsigned int n = mxGetN(model_p);
41 for(
unsigned int i=0; i<n; i++)
62 plhs[0] = mxCreateDoubleMatrix(3, 3, mxREAL);
63 R_v = mxGetPr(plhs[0]);
65 R_v[0] = R.
m[0][0]; R_v[1] = R.
m[1][0]; R_v[2] = R.
m[2][0];
66 R_v[3] = R.
m[0][1]; R_v[4] = R.
m[1][1]; R_v[5] = R.
m[2][1];
67 R_v[6] = R.
m[0][2]; R_v[7] = R.
m[1][2]; R_v[8] = R.
m[2][2];
69 plhs[1] = mxCreateDoubleMatrix(3, 1, mxREAL);
70 t_v = mxGetPr(plhs[1]);
76 plhs[2] = mxCreateDoubleMatrix(1, 1, mxREAL);
77 e_v = mxGetPr(plhs[2]);
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
std::vector< vec3_t > vec3_array
void mat33_set_all_zeros(mat33_t &m)
void robust_pose(real_t &err, mat33_t &R, vec3_t &t, const vec3_array &_model, const vec3_array &_iprts, const options_t _options)
void vec3_assign(vec3_t &v, const real_t x, const real_t y, const real_t z)