33 if (arr.
isField(
"densityNeighborhoodSize"))
37 if (arr.
isField(
"kmeansAttempts"))
39 if (arr.
isField(
"minDistanceToAddKeypoint"))
41 if (arr.
isField(
"keypointScale"))
43 if (arr.
isField(
"minGraphConfidence"))
47 if (arr.
isField(
"vertexPenalty"))
49 if (arr.
isField(
"existingVertexGain"))
52 params.
edgeGain = arr.
at(
"edgeGain").toFloat();
55 if (arr.
isField(
"convexHullFactor"))
57 if (arr.
isField(
"minRNGEdgeSwitchDist"))
61 if (arr.
isField(
"maxRectifiedDistance"))
68 for (
size_t i = 1; i < args.size(); i+=2) {
69 string key(args[i].toString());
70 if (key ==
"DensityNeighborhoodSize")
72 else if (key ==
"MinDensity")
74 else if (key ==
"KmeansAttempts")
76 else if (key ==
"MinDistanceToAddKeypoint")
78 else if (key ==
"KeypointScale")
80 else if (key ==
"MinGraphConfidence")
82 else if (key ==
"VertexGain")
84 else if (key ==
"VertexPenalty")
86 else if (key ==
"ExistingVertexGain")
88 else if (key ==
"EdgeGain")
89 params.
edgeGain = args[i+1].toFloat();
90 else if (key ==
"EdgePenalty")
92 else if (key ==
"ConvexHullFactor")
94 else if (key ==
"MinRNGEdgeSwitchDist")
96 else if (key ==
"SquareSize")
98 else if (key ==
"MaxRectifiedDistance")
102 "Unrecognized CirclesGridFinderParameters2 option %s", key.
c_str());
119 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=2);
125 bool symmetricGrid =
true;
126 bool clustering =
false;
129 for (
int i=2; i<nrhs; i+=2) {
130 string key(rhs[i].toString());
131 if (key ==
"SymmetricGrid")
132 symmetricGrid = rhs[i+1].toBool();
133 else if (key ==
"Clustering")
134 clustering = rhs[i+1].toBool();
135 else if (key ==
"BlobDetector") {
136 if (rhs[i+1].isChar())
139 else if (rhs[i+1].isCell() && rhs[i+1].numel() >= 2) {
146 "Invalid detector arguments");
148 else if (key ==
"FinderParameters")
152 "Unrecognized option %s", key.
c_str());
157 if (blobDetector.
empty())
162 Size patternSize(rhs[1].toSize());
165 blobDetector, params);
168 plhs[1] =
MxArray(patternFound);
const ConstMap< string, cv::CirclesGridFinderParameters::GridType > GridTypesMap
grid types for option processing
T at(mwIndex index) const
Template for numeric array element accessor.
int minDistanceToAddKeypoint
cv::Size2f densityNeighborhoodSize
float minRNGEdgeSwitchDist
CirclesGridFinderParameters2 MxArrayToFinderParameters(const MxArray &arr)
Convert MxArray to cv::CirclesGridFinderParameters2.
struct mxArray_tag mxArray
Forward declaration for mxArray.
cv::Ptr< cv::FeatureDetector > createFeatureDetector(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Factory function for FeatureDetector creation.
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...
bool isField(const std::string &fieldName) const
Determine whether a struct array has a specified field.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
Common definitions for the features2d and xfeatures2d modules.
bool findCirclesGrid2(InputArray image, Size patternSize, OutputArray centers, int flags, const Ptr< FeatureDetector > &blobDetector, CirclesGridFinderParameters2 parameters)
bool isStruct() const
Determine whether input is structure array.
std::vector< T > toVector() const
Convert MxArray to std::vector<T> of primitive types.
float maxRectifiedDistance
Global constant definitions.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
std::map wrapper with one-line initialization and lookup method.
void create(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)