37 int id = rhs[0].toInt();
38 string method(rhs[1].toString());
41 if (method ==
"new") {
49 else if (method ==
"RansacParamsDefault2dMotion") {
52 RansacParams ransacParams = RansacParams::default2dMotion(model);
61 if (method ==
"delete") {
66 else if (method ==
"reset") {
70 else if (method ==
"nextFrame") {
71 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
73 for (
int i=2; i<nrhs; i+=2) {
74 string key(rhs[i].toString());
75 if (key ==
"FlipChannels")
76 flip = rhs[i+1].toBool();
79 "Unrecognized option %s", key.
c_str());
82 if (
flip && (frame.channels() == 3 || frame.channels() == 4)) {
84 cvtColor(frame, frame, (frame.channels()==3 ?
89 else if (method ==
"setLog") {
94 else if (method ==
"setFrameSource") {
97 rhs[2].toString(), rhs.
begin() + 3, rhs.
end());
100 else if (method ==
"setDeblurer") {
103 rhs[2].toString(), rhs.
begin() + 3, rhs.
end());
106 else if (method ==
"setMotionEstimator") {
109 rhs[2].toString(), rhs.
begin() + 3, rhs.
end());
112 else if (method ==
"setInpainter") {
115 rhs[2].toString(), rhs.
begin() + 3, rhs.
end());
118 else if (method ==
"setMotionFilter") {
121 rhs[2].toString(), rhs.
begin() + 3, rhs.
end());
124 else if (method ==
"getLog") {
129 else if (method ==
"getFrameSource") {
134 else if (method ==
"getDeblurer") {
139 else if (method ==
"getMotionEstimator") {
144 else if (method ==
"getInpainter") {
149 else if (method ==
"getMotionFilter") {
154 else if (method ==
"get") {
156 string prop(rhs[2].toString());
157 if (prop ==
"BorderMode")
159 else if (prop ==
"CorrectionForInclusion")
161 else if (prop ==
"Radius")
163 else if (prop ==
"TrimRatio")
167 "Unrecognized property %s", prop.
c_str());
169 else if (method ==
"set") {
171 string prop(rhs[2].toString());
172 if (prop ==
"BorderMode")
174 else if (prop ==
"CorrectionForInclusion")
176 else if (prop ==
"Radius")
178 else if (prop ==
"TrimRatio")
182 "Unrecognized property %s", prop.
c_str());
186 "Unrecognized operation %s", method.
c_str());
void setCorrectionForInclusion(bool val)
Common definitions for the videostab module.
cv::Ptr< cv::videostab::DeblurerBase > createDeblurerBase(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of DeblurerBase using options in arguments.
void cvtColor(InputArray src, OutputArray dst, int code, int dstCn=0)
cv::Ptr< cv::videostab::InpainterBase > createInpainterBase(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of InpainterBase using options in arguments.
Ptr< ImageMotionEstimatorBase > motionEstimator() const
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
void setLog(Ptr< ILog > ilog)
int last_id
Last object id to allocate.
bool doCorrectionForInclusion() const
Ptr< InpainterBase > inpainter() const
map< int, Ptr< OnePassStabilizer > > obj_
Object container.
struct mxArray_tag mxArray
Forward declaration for mxArray.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
void setMotionFilter(Ptr< MotionFilterBase > val)
MxArray toStruct(const std::vector< cv::ml::DTrees::Node > &nodes)
Convert tree nodes to struct array.
const ConstMap< int, std::string > BorderTypeInv
Inverse border type map for option processing.
Ptr< MotionFilterBase > motionFilter() const
const ConstMap< std::string, cv::videostab::MotionModel > MotionModelMap
motion model types for option processing
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.
cv::Ptr< cv::videostab::IFrameSource > createIFrameSource(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of IFrameSource using options in arguments.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
void setBorderMode(int val)
Global constant definitions.
void setInpainter(Ptr< InpainterBase > val)
cv::Ptr< cv::videostab::ImageMotionEstimatorBase > createImageMotionEstimator(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of ImageMotionEstimatorBase using options in arguments.
void flip(InputArray src, OutputArray dst, int flipCode)
void setTrimRatio(float val)
Ptr< DeblurerBase > deblurrer() const
Ptr< IFrameSource > frameSource() const
cv::Ptr< cv::videostab::MotionFilterBase > createMotionFilterBase(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of MotionFilterBase using options in arguments.
void setDeblurer(Ptr< DeblurerBase > val)
void setFrameSource(Ptr< IFrameSource > val)
cv::Ptr< cv::videostab::ILog > createILog(const std::string &type)
Create an instance of ILog of the specified type.
void setMotionEstimator(Ptr< ImageMotionEstimatorBase > val)