15 (
"Correlation", cv::HISTCMP_CORREL)
16 (
"ChiSquare", cv::HISTCMP_CHISQR)
17 (
"Intersection", cv::HISTCMP_INTERSECT)
18 (
"Bhattacharyya", cv::HISTCMP_BHATTACHARYYA)
19 (
"Hellinger", cv::HISTCMP_HELLINGER)
20 (
"AltChiSquare", cv::HISTCMP_CHISQR_ALT)
21 (
"KullbackLeibler", cv::HISTCMP_KL_DIV);
31 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
34 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
37 vector<MxArray> rhs(prhs, prhs+nrhs);
40 int method = cv::HISTCMP_CORREL;
41 for (
int i=2; i<nrhs; i+=2) {
42 string key(rhs[i].toString());
44 method = (rhs[i+1].isChar()) ?
45 HistComp[rhs[i+1].toString()] : rhs[i+1].toInt();
47 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
52 if (rhs[0].isSparse() && rhs[1].isSparse()) {
53 SparseMat H1(rhs[0].toSparseMat(CV_32F)),
54 H2(rhs[1].toSparseMat(CV_32F));
55 d = compareHist(H1, H2, method);
58 MatND H1(rhs[0].toMatND(CV_32F)),
59 H2(rhs[1].toMatND(CV_32F));
60 d = compareHist(H1, H2, method);
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
Global constant definitions.
std::map wrapper with one-line initialization and lookup method.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.