21 s.
set(
"TypeId",
string(
typeid(*p).name()));
44 s.
set(
"TypeId",
string(
typeid(*p).name()));
71 float defaultCost = 0.2f;
72 for (; first != last; first += 2) {
73 string key(first->toString());
74 const MxArray& val = *(first + 1);
75 if (key ==
"NDummies")
76 nDummies = val.
toInt();
77 else if (key ==
"DefaultCost")
78 defaultCost = val.toFloat();
79 else if (key ==
"NormFlag")
83 "Unrecognized option %s", key.c_str());
96 float defaultCost = 0.2f;
97 for (; first != last; first += 2) {
98 string key(first->toString());
99 const MxArray& val = *(first + 1);
100 if (key ==
"NDummies")
101 nDummies = val.
toInt();
102 else if (key ==
"DefaultCost")
103 defaultCost = val.toFloat();
104 else if (key ==
"NormFlag")
108 "Unrecognized option %s", key.c_str());
120 float defaultCost = 0.2f;
121 for (; first != last; first += 2) {
122 string key(first->toString());
123 const MxArray& val = *(first + 1);
124 if (key ==
"NDummies")
125 nDummies = val.
toInt();
126 else if (key ==
"DefaultCost")
127 defaultCost = val.toFloat();
130 "Unrecognized option %s", key.c_str());
142 float defaultCost = 0.2f;
143 for (; first != last; first += 2) {
144 string key(first->toString());
145 const MxArray& val = *(first + 1);
146 if (key ==
"NDummies")
147 nDummies = val.
toInt();
148 else if (key ==
"DefaultCost")
149 defaultCost = val.toFloat();
152 "Unrecognized option %s", key.c_str());
163 if (
type ==
"NormHistogramCostExtractor")
165 else if (
type ==
"EMDHistogramCostExtractor")
167 else if (
type ==
"ChiHistogramCostExtractor")
169 else if (
type ==
"EMDL1HistogramCostExtractor")
173 "Unrecognized histogram cost extractor %s",
type.c_str());
176 "Failed to create HistogramCostExtractor");
186 double regularizationParameter = 0;
187 for (; first != last; first += 2) {
188 string key(first->toString());
189 const MxArray& val = *(first + 1);
190 if (key ==
"RegularizationParameter")
191 regularizationParameter = val.
toDouble();
194 "Unrecognized option %s", key.c_str());
205 bool fullAffine =
true;
206 for (; first != last; first += 2) {
207 string key(first->toString());
208 const MxArray& val = *(first + 1);
209 if (key ==
"FullAffine")
210 fullAffine = val.
toBool();
213 "Unrecognized option %s", key.c_str());
224 if (
type ==
"ThinPlateSplineShapeTransformer")
226 else if (
type ==
"AffineTransformer")
230 "Unrecognized shape transformer %s",
type.c_str());
233 "Failed to create ShapeTransformer");
243 int nAngularBins = 12;
245 float innerRadius = 0.2f;
246 float outerRadius = 2;
250 for (; first != last; first += 2) {
251 string key(first->toString());
252 const MxArray& val = *(first + 1);
253 if (key ==
"AngularBins")
254 nAngularBins = val.
toInt();
255 else if (key ==
"RadialBins")
256 nRadialBins = val.toInt();
257 else if (key ==
"InnerRadius")
258 innerRadius = val.toFloat();
259 else if (key ==
"OuterRadius")
260 outerRadius = val.toFloat();
261 else if (key ==
"Iterations")
262 iterations = val.toInt();
263 else if (key ==
"CostExtractor") {
267 args[0].toString(), args.
begin() + 1, args.
end());
269 else if (key ==
"TransformAlgorithm") {
273 args[0].toString(), args.
begin() + 1, args.
end());
277 "Unrecognized option %s", key.c_str());
279 if (comparer.
empty())
281 if (transformer.
empty())
284 innerRadius, outerRadius, iterations, comparer, transformer);
294 float rankProp = 0.6f;
295 for (; first != last; first += 2) {
296 string key(first->toString());
297 const MxArray& val = *(first + 1);
298 if (key ==
"DistanceFlag")
299 distanceFlag =
NormType[val.toString()];
300 else if (key ==
"RankProportion")
301 rankProp = val.toFloat();
304 "Unrecognized option %s", key.c_str());
Common definitions for the shape module.
int toInt() const
Convert MxArray to int.
Ptr< HistogramCostExtractor > create_HistogramCostExtractor(const string &type, vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of HistogramCostExtractor using options in arguments.
MxArray toStruct(Ptr< HistogramCostExtractor > p)
Convert a HistogramCostExtractor to MxArray.
Ptr< ShapeContextDistanceExtractor > create_ShapeContextDistanceExtractor(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of ShapeContextDistanceExtractor using options in arguments.
Ptr< ShapeContextDistanceExtractor > createShapeContextDistanceExtractor(int nAngularBins=12, int nRadialBins=4, float innerRadius=0.2f, float outerRadius=2, int iterations=3, const Ptr< HistogramCostExtractor > &comparer=createChiHistogramCostExtractor(), const Ptr< ShapeTransformer > &transformer=createThinPlateSplineShapeTransformer())
Ptr< HistogramCostExtractor > createChiHistogramCostExtractor(int nDummies=25, float defaultCost=0.2f)
Ptr< HistogramCostExtractor > create_NormHistogramCostExtractor(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of NormHistogramCostExtractor using options in arguments.
void set(mwIndex index, const T &value)
Template for numeric array element write accessor.
Ptr< ShapeTransformer > create_ShapeTransformer(const string &type, vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of ShapeTransformer using options in arguments.
const ConstMap< int, std::string > DistTypeInv
Inverse Distance types for Distance Transform and M-estimators.
Ptr< HistogramCostExtractor > create_EMDL1HistogramCostExtractor(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of EMDL1HistogramCostExtractor using options in arguments.
Ptr< HausdorffDistanceExtractor > create_HausdorffDistanceExtractor(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of HausdorffDistanceExtractor using options in arguments.
Ptr< HistogramCostExtractor > create_EMDHistogramCostExtractor(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of EMDHistogramCostExtractor using options in arguments.
Ptr< HistogramCostExtractor > createEMDL1HistogramCostExtractor(int nDummies=25, float defaultCost=0.2f)
Ptr< HausdorffDistanceExtractor > createHausdorffDistanceExtractor(int distanceFlag=cv::NORM_L2, float rankProp=0.6f)
bool toBool() const
Convert MxArray to bool.
Ptr< Y > dynamicCast() const
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...
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
static MxArray Struct(const char **fields=NULL, int nfields=0, mwSize m=1, mwSize n=1)
Create a new struct array.
const ConstMap< std::string, int > DistType
Distance types for Distance Transform and M-estimators.
Ptr< HistogramCostExtractor > createEMDHistogramCostExtractor(int flag=DIST_L2, int nDummies=25, float defaultCost=0.2f)
double toDouble() const
Convert MxArray to double.
Ptr< HistogramCostExtractor > createNormHistogramCostExtractor(int flag=DIST_L2, int nDummies=25, float defaultCost=0.2f)
Ptr< AffineTransformer > createAffineTransformer(bool fullAffine)
Ptr< ThinPlateSplineShapeTransformer > createThinPlateSplineShapeTransformer(double regularizationParameter=0)
Ptr< HistogramCostExtractor > create_ChiHistogramCostExtractor(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of ChiHistogramCostExtractor using options in arguments.
Ptr< AffineTransformer > create_AffineTransformer(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of AffineTransformer using options in arguments.
Ptr< ThinPlateSplineShapeTransformer > create_ThinPlateSplineShapeTransformer(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of ThinPlateSplineShapeTransformer using options in arguments. ...
const ConstMap< std::string, int > NormType
Norm type map for option processing.