36 int id = rhs[0].toInt();
37 string method(rhs[1].toString());
40 if (method ==
"new") {
53 if (method ==
"delete") {
58 else if (method ==
"clear") {
62 else if (method ==
"load") {
63 nargchk(nrhs>=3 && (nrhs%2)!=0 && nlhs==0);
65 bool loadFromString =
false;
66 for (
int i=3; i<nrhs; i+=2) {
67 string key(rhs[i].toString());
69 objname = rhs[i+1].toString();
70 else if (key ==
"FromString")
71 loadFromString = rhs[i+1].toBool();
74 "Unrecognized option %s", key.
c_str());
83 FileStorage fs(rhs[2].toString(), FileStorage::READ +
84 (loadFromString ? FileStorage::MEMORY : 0));
93 else if (method ==
"save") {
95 obj->
save(rhs[2].toString());
97 else if (method ==
"empty") {
101 else if (method ==
"getDefaultName") {
105 else if (method ==
"computeDistance") {
108 if (rhs[2].isNumeric() && rhs[3].isNumeric()) {
114 else if (rhs[2].isCell() && rhs[3].isCell()) {
116 contour2(rhs[3].toVector<Point2f>());
123 else if (method ==
"setImages") {
129 else if (method ==
"setCostExtractor") {
132 rhs[2].toString(), rhs.
begin() + 3, rhs.
end());
135 else if (method ==
"setTransformAlgorithm") {
138 rhs[2].toString(), rhs.
begin() + 3, rhs.
end());
141 else if (method ==
"getImages") {
149 else if (method ==
"getCostExtractor") {
154 else if (method ==
"getTransformAlgorithm") {
159 else if (method ==
"get") {
161 string prop(rhs[2].toString());
162 if (prop ==
"AngularBins")
164 else if (prop ==
"RadialBins")
166 else if (prop ==
"InnerRadius")
168 else if (prop ==
"OuterRadius")
170 else if (prop ==
"RotationInvariant")
172 else if (prop ==
"ShapeContextWeight")
174 else if (prop ==
"ImageAppearanceWeight")
176 else if (prop ==
"BendingEnergyWeight")
178 else if (prop ==
"Iterations")
180 else if (prop ==
"StdDev")
184 "Unrecognized property %s", prop.
c_str());
186 else if (method ==
"set") {
188 string prop(rhs[2].toString());
189 if (prop ==
"AngularBins")
191 else if (prop ==
"RadialBins")
193 else if (prop ==
"InnerRadius")
195 else if (prop ==
"OuterRadius")
197 else if (prop ==
"RotationInvariant")
199 else if (prop ==
"ShapeContextWeight")
201 else if (prop ==
"ImageAppearanceWeight")
203 else if (prop ==
"BendingEnergyWeight")
205 else if (prop ==
"Iterations")
207 else if (prop ==
"StdDev")
211 "Unrecognized property %s", prop.
c_str());
215 "Unrecognized operation %s", method.
c_str());
Common definitions for the shape module.
cv::Ptr< cv::ShapeTransformer > create_ShapeTransformer(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of ShapeTransformer using options in arguments.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
MxArray toStruct(const std::vector< cv::ml::DTrees::Node > &nodes)
Convert tree nodes to struct array.
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 String getDefaultName() const
Global constant definitions.
virtual void save(const String &filename) const
cv::Ptr< cv::ShapeContextDistanceExtractor > create_ShapeContextDistanceExtractor(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of ShapeContextDistanceExtractor using options in arguments.
virtual bool empty() const
cv::Ptr< cv::HistogramCostExtractor > create_HistogramCostExtractor(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of HistogramCostExtractor using options in arguments.