Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do you use the legacy GLCM?

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

How do you use the legacy GLCM?

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