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 ==
"setMotionStabilizer") {
121 rhs[2].toString(), rhs.
begin() + 3, rhs.
end());
124 else if (method ==
"setWobbleSuppressor") {
127 rhs[2].toString(), rhs.
begin() + 3, rhs.
end());
130 else if (method ==
"getLog") {
135 else if (method ==
"getFrameSource") {
140 else if (method ==
"getDeblurer") {
145 else if (method ==
"getMotionEstimator") {
150 else if (method ==
"getInpainter") {
155 else if (method ==
"getMotionStabilizer") {
160 else if (method ==
"getWobbleSuppressor") {
165 else if (method ==
"get") {
167 string prop(rhs[2].toString());
168 if (prop ==
"BorderMode")
170 else if (prop ==
"CorrectionForInclusion")
172 else if (prop ==
"Radius")
174 else if (prop ==
"TrimRatio")
176 else if (prop ==
"EstimateTrimRatio")
180 "Unrecognized property %s", prop.
c_str());
182 else if (method ==
"set") {
184 string prop(rhs[2].toString());
185 if (prop ==
"BorderMode")
187 else if (prop ==
"CorrectionForInclusion")
189 else if (prop ==
"Radius")
191 else if (prop ==
"TrimRatio")
193 else if (prop ==
"EstimateTrimRatio")
197 "Unrecognized property %s", prop.
c_str());
201 "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)
void setWobbleSuppressor(Ptr< WobbleSuppressorBase > val)
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< IMotionStabilizer > motionStabilizer() const
Ptr< ImageMotionEstimatorBase > motionEstimator() const
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
int last_id
Last object id to allocate.
void setLog(Ptr< ILog > ilog)
Ptr< WobbleSuppressorBase > wobbleSuppressor() const
bool doCorrectionForInclusion() const
cv::Ptr< cv::videostab::IMotionStabilizer > createIMotionStabilizer(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of IMotionStabilizer using options in arguments.
Ptr< InpainterBase > inpainter() const
void setEstimateTrimRatio(bool val)
void setMotionStabilizer(Ptr< IMotionStabilizer > val)
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
struct mxArray_tag mxArray
Forward declaration for mxArray.
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.
cv::Ptr< cv::videostab::WobbleSuppressorBase > createWobbleSuppressorBase(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of WobbleSuppressorBase using options in arguments.
bool mustEstimateTrimaRatio() 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)
map< int, Ptr< TwoPassStabilizer > > obj_
Object container.
void setTrimRatio(float val)
Ptr< DeblurerBase > deblurrer() const
Ptr< IFrameSource > frameSource() const
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)