问题描述
遗留函数 GLCM 在 opencv2 中尚未执行.我使用以下代码:
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);
我已经尝试使用命名空间 cv::CvGLCM* glcm = cv::cvCreateGLCM(grayIm,.... -- 但没有改变 :/
I tried already to use the namespace cv::CvGLCM* glcm = cv::cvCreateGLCM(grayIm,.... -- but no change :/
非常感谢您对此的任何帮助!
Any help on this is very much appreciated !
推荐答案
最终帮助的是 Alexander Shishkov 的答案:link1
What helped finally was the answer from Alexander Shishkov posted here: link1
我确实交换了 texture.cpp 代码并再次编译了我的 opencv 框架(解释如下:link2:特别是我重做了三步中的最后一步……)
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...).
完成所有这些后,我的 glcm 代码无一例外地执行并为每个 glcm 方法提供两个数字.
Doing all that, my glcm-code performs without exception and delivers two numbers per glcm-method.
这篇关于opencv2 中的 GLCM(灰度共生矩阵)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!