OpenCV 2.4.5:FLANN和hierarchicalClustering [英] OpenCV 2.4.5: FLANN and hierarchicalClustering

查看:179
本文介绍了OpenCV 2.4.5:FLANN和hierarchicalClustering的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始将应用程序移植到运行OpenCV 2.4.5的新平台上.

I have recently started porting an application to a new platform which runs OpenCV 2.4.5.

使用OpenCV的FLANN实现进行分层群集的部分代码不再编译.

Part of my code which uses OpenCV's implementation of FLANN to do hierarchical clustering no longer compiles.

代码如下:

cv::Mat mergedFeatures = cvCreateMat(descriptorTotal, descriptorDims, CV_32F);

int counter = 0;
for (uint j = 0; j < ImageFeatures.size(); j++) {
    cv::Mat features = ImageFeatures[j];
    for (int k = 0; k < features.rows; k++) {
        cv::Mat roi = mergedFeatures.row(counter);
        features.row(k).copyTo(roi);
        counter++;
    }
}

cv::Mat centers = cvCreateMat(1000, descriptorDims, CV_32FC1);
cv::flann::KMeansIndexParams k_params = cv::flann::KMeansIndexParams();
cv::flann::AutotunedIndexParams atp = cv::flann::AutotunedIndexParams();
int numClusters = cv::flann::hierarchicalClustering<float, float>(mergedFeatures, centers, k_params);

(在Eclipse中)我得到的错误是cv :: flann :: hierarchicalClustering具有无效的参数,并且没有满足该函数的任何候选条件.

The error that I am getting (in Eclipse) is that cv::flann::hierarchicalClustering has invalid arguments and that neither of the candidates for this function are met.

有人可以解释一下我似乎突然错误地调用了此方法吗?

Can someone explain how I suddenly seem to be calling this method incorrectly?

非常感谢您的帮助.

推荐答案

我自己解决了这个问题.

I fixed the problem myself.

而不是接受:

cv::flann::KMeansIndexParams k_params

hierarchicalClustering函数实际上需要:

the hierarchicalClustering function actually needs:

cvflann::KMeansIndexParams k_params

与OpenCV中的FLANN库相比,这是一个令人困惑的命名空间约定,我只是忽略了编译器错误告诉我的命名空间差异.

It is rather a confusing namespace convention with the FLANN library in OpenCV and I had just overlooked the namespace difference in what the compiler error was telling me.

现在一切正常.这两个名称空间中都存在KMeansIndexParams类型,我想这是从OpenCV 2.3到2.4.5的hierarchyClustering方法已经发生了很小的变化.

It is all working now. The KMeansIndexParams type is present in both namespaces and I guess that the hierarchicalClustering method has changed very slightly from OpenCV 2.3 to 2.4.5.

这篇关于OpenCV 2.4.5:FLANN和hierarchicalClustering的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆