25 const char* fieldnames[] = {
"R1",
"R2",
"P1",
"P2",
"Q"};
46 nargchk(nrhs>=7 && (nrhs%2)==1 && nlhs<=1);
55 double fov_scale = 1.0;
56 for (
int i=7; i<nrhs; i+=2) {
57 string key(rhs[i].toString());
58 if (key ==
"ZeroDisparity")
60 else if (key ==
"NewImageSize")
61 newImageSize = rhs[i+1].toSize();
62 else if (key ==
"Balance")
63 balance = rhs[i+1].toDouble();
64 else if (key ==
"FOVScale")
65 fov_scale = rhs[i+1].toDouble();
68 "Unrecognized option %s", key.
c_str());
79 Size imageSize(rhs[4].toSize());
80 fisheye::stereoRectify(K1, D1, K2, D2, imageSize, R,
T, R1, R2, P1, P2, Q,
81 flags, newImageSize, balance, fov_scale);
82 plhs[0] =
toStruct(R1, R2, P1, P2, Q);
void stereoRectify(InputArray cameraMatrix1, InputArray distCoeffs1, InputArray cameraMatrix2, InputArray distCoeffs2, Size imageSize, InputArray R, InputArray T, OutputArray R1, OutputArray R2, OutputArray P1, OutputArray P2, OutputArray Q, int flags=CALIB_ZERO_DISPARITY, double alpha=-1, Size newImageSize=Size(), Rect *validPixROI1=0, Rect *validPixROI2=0)
struct mxArray_tag mxArray
Forward declaration for mxArray.
void set(mwIndex index, const T &value)
Template for numeric array element write accessor.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
#define UPDATE_FLAG(NUM, TF, BIT)
set or clear a bit in flag depending on bool value
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.
MxArray toStruct(const Mat &R1, const Mat &R2, const Mat &P1, const Mat &P2, const Mat &Q)
Create a new MxArray from stereo rectified transforms.
Global constant definitions.