32 int exclude_range = 4;
34 for (; first != last; first += 2) {
35 string key(first->toString());
36 const MxArray& val = *(first + 1);
38 max_bits = val.
toInt();
39 else if (key ==
"ExcludeRange")
40 exclude_range = val.toInt();
41 else if (key ==
"Cut")
45 "Unrecognized option %s", key.c_str());
65 int id = rhs[0].toInt();
66 string method(rhs[1].toString());
69 if (method ==
"new") {
82 if (method ==
"delete") {
87 else if (method ==
"clear") {
91 else if (method ==
"load") {
92 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
94 bool loadFromString =
false;
95 for (
int i=3; i<nrhs; i+=2) {
96 string key(rhs[i].toString());
98 objname = rhs[i+1].toString();
99 else if (key ==
"FromString")
100 loadFromString = rhs[i+1].toBool();
103 "Unrecognized option %s", key.
c_str());
112 FileStorage fs(rhs[2].toString(), FileStorage::READ +
113 (loadFromString ? FileStorage::MEMORY : 0));
122 else if (method ==
"save") {
124 obj->
save(rhs[2].toString());
126 else if (method ==
"empty") {
130 else if (method ==
"getDefaultName") {
134 else if (method ==
"process") {
146 else if (method ==
"calculateShift") {
153 else if (method ==
"shiftMat") {
156 Point shift(rhs[3].toPoint());
160 else if (method ==
"computeBitmaps") {
168 else if (method ==
"get") {
170 string prop(rhs[2].toString());
171 if (prop ==
"MaxBits")
173 else if (prop ==
"ExcludeRange")
175 else if (prop ==
"Cut")
179 "Unrecognized property %s", prop.
c_str());
181 else if (method ==
"set") {
183 string prop(rhs[2].toString());
184 if (prop ==
"MaxBits")
186 else if (prop ==
"ExcludeRange")
188 else if (prop ==
"Cut")
189 obj->
setCut(rhs[3].toBool());
192 "Unrecognized property %s", prop.
c_str());
196 "Unrecognized operation %s", method.
c_str());
virtual void setCut(bool value)=0
virtual void setExcludeRange(int exclude_range)=0
virtual Point calculateShift(InputArray img0, InputArray img1)=0
virtual int getMaxBits() const=0
int toInt() const
Convert MxArray to int.
virtual bool getCut() const=0
Ptr< AlignMTB > create_AlignMTB(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of AlignMTB using options in arguments.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
map< int, Ptr< AlignMTB > > obj_
Object container.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
virtual bool isOpened() const
Ptr< AlignMTB > createAlignMTB(int max_bits=6, int exclude_range=4, bool cut=true)
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual void setMaxBits(int max_bits)=0
virtual void process(InputArrayOfArrays src, std::vector< Mat > &dst, InputArray times, InputArray response)=0
virtual void computeBitmaps(InputArray img, OutputArray tb, OutputArray eb)=0
virtual void read(const FileNode &fn)
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...
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.
FileNode getFirstTopLevelNode() const
virtual void shiftMat(InputArray src, OutputArray dst, const Point shift)=0
virtual String getDefaultName() const
Global constant definitions.
int last_id
Last object id to allocate.
virtual int getExcludeRange() const=0
virtual void save(const String &filename) const
virtual bool empty() const