36 int id = rhs[0].toInt();
37 string method(rhs[1].toString());
40 if (method ==
"new") {
41 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
46 int out_dtype =
CV_8U;
50 for (
int i=2; i<nrhs; i+=2) {
51 string key(rhs[i].toString());
53 ddepth = (rhs[i+1].isChar()) ?
56 dx = rhs[i+1].toInt();
58 dy = rhs[i+1].toInt();
59 else if (key ==
"KSize")
60 ksize = rhs[i+1].toInt();
61 else if (key ==
"OutDType")
62 out_dtype = (rhs[i+1].isChar()) ?
64 else if (key ==
"Scale")
65 scale = rhs[i+1].toDouble();
66 else if (key ==
"Delta")
67 delta = rhs[i+1].toDouble();
68 else if (key ==
"BorderType")
72 "Unrecognized option %s", key.
c_str());
75 out_dtype, scale, delta, borderType);
85 if (method ==
"delete") {
90 else if (method ==
"clear") {
94 else if (method ==
"load") {
95 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
97 bool loadFromString =
false;
98 for (
int i=3; i<nrhs; i+=2) {
99 string key(rhs[i].toString());
100 if (key ==
"ObjName")
101 objname = rhs[i+1].toString();
102 else if (key ==
"FromString")
103 loadFromString = rhs[i+1].toBool();
106 "Unrecognized option %s", key.
c_str());
108 obj_[id] = (loadFromString ?
109 Algorithm::loadFromString<RidgeDetectionFilter>(rhs[2].toString(), objname) :
110 Algorithm::load<RidgeDetectionFilter>(rhs[2].toString(), objname));
112 else if (method ==
"save") {
114 obj->
save(rhs[2].toString());
116 else if (method ==
"empty") {
120 else if (method ==
"getDefaultName") {
124 else if (method ==
"getRidgeFilteredImage") {
132 "Unrecognized operation %s", method.
c_str());
const ConstMap< std::string, int > ClassNameMap
Translates class name used in MATLAB to equivalent OpenCV depth.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
virtual void getRidgeFilteredImage(InputArray _img, OutputArray out)=0
struct mxArray_tag mxArray
Forward declaration for mxArray.
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...
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
const ConstMap< std::string, int > BorderType
Border type map for option processing.
int last_id
Last object id to allocate.
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 String getDefaultName() const
Global constant definitions.
virtual void save(const String &filename) const
virtual bool empty() const
map< int, Ptr< RidgeDetectionFilter > > obj_
Object container.
void create(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)