28 const Mat& P1,
const Mat& P2,
const Mat& P3,
const Mat& Q,
31 const char* fieldnames[] = {
"R1",
"R2",
"R3",
"P1",
"P2",
"P3",
"Q",
32 "roi1",
"roi2",
"ratio"};
58 nargchk(nrhs>=11 && (nrhs%2)==1 && nlhs<=1);
68 for (
int i=11; i<nrhs; i+=2) {
69 string key(rhs[i].toString());
70 if (key ==
"ImgPoints1")
71 imgpt1 = rhs[i+1].toVector<
Point2f>();
72 else if (key ==
"ImgPoints3")
73 imgpt3 = rhs[i+1].toVector<
Point2f>();
74 else if (key ==
"Alpha")
75 alpha = rhs[i+1].toDouble();
76 else if (key ==
"NewImageSize")
77 newImageSize = rhs[i+1].toSize();
78 else if (key ==
"ZeroDisparity")
82 "Unrecognized option %s", key.
c_str());
96 R1, R2, R3, P1, P2, P3, Q;
97 Size imageSize(rhs[6].toSize());
100 cameraMatrix2, distCoeffs2, cameraMatrix3, distCoeffs3,
101 imgpt1, imgpt3, imageSize, R12, T12, R13, T13,
102 R1, R2, R3, P1, P2, P3, Q, alpha, newImageSize, &roi1, &roi2, flags);
103 plhs[0] =
toStruct(R1, R2, R3, P1, P2, P3, Q, roi1, roi2,
ratio);
MxArray toStruct(const Mat &R1, const Mat &R2, const Mat &R3, const Mat &P1, const Mat &P2, const Mat &P3, const Mat &Q, const Rect &roi1, const Rect &roi2, float ratio)
Create a new MxArray from stereo rectified transforms.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
struct mxArray_tag mxArray
Forward declaration for mxArray.
void set(mwIndex index, const T &value)
Template for numeric array element write accessor.
#define UPDATE_FLAG(NUM, TF, BIT)
set or clear a bit in flag depending on bool value
float rectify3Collinear(InputArray cameraMatrix1, InputArray distCoeffs1, InputArray cameraMatrix2, InputArray distCoeffs2, InputArray cameraMatrix3, InputArray distCoeffs3, InputArrayOfArrays imgpt1, InputArrayOfArrays imgpt3, Size imageSize, InputArray R12, InputArray T12, InputArray R13, InputArray T13, OutputArray R1, OutputArray R2, OutputArray R3, OutputArray P1, OutputArray P2, OutputArray P3, OutputArray Q, double alpha, Size newImgSize, Rect *roi1, Rect *roi2, int flags)
LIBMWMEX_API_EXTERN_C void mexErrMsgIdAndTxt(const char *identifier, const char *err_msg,...)
Issue formatted error message with corresponding error identifier and return to MATLAB prompt...
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
static MxArray Struct(const char **fields=NULL, int nfields=0, mwSize m=1, mwSize n=1)
Create a new struct array.
Global constant definitions.