38 int id = rhs[0].toInt();
39 string method(rhs[1].toString());
42 if (method ==
"new") {
45 rhs[2].toString(), rhs.
begin() + 4, rhs.
end(), rhs[3].toFloat());
55 if (method ==
"delete") {
60 else if (method ==
"typeid") {
62 plhs[0] =
MxArray(
string(
typeid(*obj).name()));
64 else if (method ==
"buildMaps") {
66 Size src_size(rhs[2].toSize());
77 else if (method ==
"warpPoint") {
84 else if (method ==
"warp") {
85 nargchk(nrhs>=5 && (nrhs%2)==1 && nlhs<=2);
88 for (
int i=5; i<nrhs; i+=2) {
89 string key(rhs[i].toString());
90 if (key ==
"InterpMode")
91 interp_mode = (rhs[i+1].isChar()) ?
92 InterpType[rhs[i+1].toString()] : rhs[i+1].toInt();
93 else if (key ==
"BorderMode")
94 border_mode = (rhs[i+1].isChar()) ?
95 BorderType[rhs[i+1].toString()] : rhs[i+1].toInt();
98 "Unrecognized option %s", key.
c_str());
102 Point tl = obj->
warp(src, K, R, interp_mode, border_mode, dst);
107 else if (method ==
"warpBackward") {
108 nargchk(nrhs>=6 && (nrhs%2)==0 && nlhs<=1);
111 for (
int i=6; i<nrhs; i+=2) {
112 string key(rhs[i].toString());
113 if (key ==
"InterpMode")
114 interp_mode = (rhs[i+1].isChar()) ?
115 InterpType[rhs[i+1].toString()] : rhs[i+1].toInt();
116 else if (key ==
"BorderMode")
117 border_mode = (rhs[i+1].isChar()) ?
118 BorderType[rhs[i+1].toString()] : rhs[i+1].toInt();
121 "Unrecognized option %s", key.
c_str());
125 Size dst_size(rhs[5].toSize());
126 obj->
warpBackward(src, K, R, interp_mode, border_mode, dst_size, dst);
129 else if (method ==
"warpRoi") {
131 Size src_size(rhs[2].toSize());
136 else if (method ==
"get") {
138 string prop(rhs[2].toString());
143 "Unrecognized property %s", prop.
c_str());
145 else if (method ==
"set") {
147 string prop(rhs[2].toString());
152 "Unrecognized property %s", prop.
c_str());
156 "Unrecognized operation %s", method.
c_str());
virtual void setScale(float)
virtual void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, Size dst_size, OutputArray dst)=0
virtual Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst)=0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Common definitions for the stitching module.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
cv::Ptr< cv::detail::RotationWarper > createRotationWarper(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last, float scale=1.0f)
Create an instance of RotationWarper using options in arguments.
const ConstMap< std::string, int > InterpType
Interpolation type map for option processing.
map< int, Ptr< RotationWarper > > obj_
Object container.
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R)=0
int last_id
Last object id to allocate.
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...
const ConstMap< std::string, int > BorderType
Border type map for option processing.
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
virtual float getScale() const
Global constant definitions.
virtual Rect warpRoi(Size src_size, InputArray K, InputArray R)=0
virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap)=0