How do you use the legacy GLCM?

asked Aug 5 '14

cln1073 gravatar image

updated Aug 5 '14

I am having trouble using and finding documentation about the OpenCV deprecated GLCM algorithm. Links from previous questions in the forum are no longer working.

void CalculateGLCM(cv::Mat grayIm) {
    // Convert Mat to IplImage 
    IplImage pGray = grayIm;
    // Create GLCM
    CvGLCM* glcm = cvCreateGLCM(&pGray, 1, NULL, 4, CV_GLCM_OPTIMIZATION_LUT);
    // Obtain Entropy and IDM values
    cvCreateGLCMDescriptors(glcm, CV_GLCMDESC_OPTIMIZATION_ALLOWDOUBLENEST);
    double d_entropy = cvGetGLCMDescriptor(glcm, 0, CV_GLCMDESC_ENTROPY);
    double d_idm = cvGetGLCMDescriptor(glcm, 0, CV_GLCMDESC_HOMOGENITY);
}

Am I doing something obviously wrong? Or is there an alternative algorithm in OpenCV? My goal is to obtain Entropy and IDM (Homogenity) using this specific algorithm. Any help is much appreciated.

-Chris

Preview: (hide)