The legacy function GLCM does not perform yet in opencv2. I use the following code:
#import <opencv2/legacy.hpp>
cv::Mat inputIm = [in_image CVMat];
cv::Mat grayIm = [in_image CVGrayscaleMat];
// cv::cvtColor(inputIm, grayIm, cv::COLOR_RGB2GRAY);
// here I get an error: "no matching function..." !!!
CvGLCM* glcm = cvCreateGLCM(grayIm, 1, NULL, 4, CV_GLCM_OPTIMIZATION_LUT);
cvCreateGLCMDescriptors(glcm, CV_GLCMDESC_OPTIMIZATION_ALLOWDOUBLENEST);
double d = cvGetGLCMDescriptor(glcm, 0, CV_GLCMDESC_HOMOGENITY );
double a = 1; double *ave = &a;
double s = 1; double *sd = &s;
cvGetGLCMDescriptorStatistics(glcm, CV_GLCMDESC_ENERGY, ave, sd);
NSLog(@"ave = %f sd = %f", *ave, *sd);
I tried already to use the namespace cv::CvGLCM* glcm = cv::cvCreateGLCM(grayIm,.... -- but no change :/
Any help on this is very much appreciated !
What helped finally was the answer from Alexander Shishkov posted here: link1
I did exchange the texture.cpp code and compiled my opencv-framework again (explained here: link2: i.e. in particular I re-did the last step of the three...).
Doing all that, my glcm-code performs without exception and delivers two numbers per glcm-method.