FlannIndex: Fixed size_t matrix allocation error on 64 bits system

This commit is contained in:
matlabbe
2017-10-09 10:51:18 -04:00
parent 49f9a1e8d7
commit 4de2ed767b
4 changed files with 5 additions and 5 deletions

View File

@@ -436,7 +436,7 @@ void FlannIndex::knnSearch(
UERROR("Flann index not yet created!");
return;
}
indices.create(query.rows, knn, CV_32S);
indices.create(query.rows, knn, sizeof(size_t)==8?CV_64F:CV_32S);
dists.create(query.rows, knn, featuresType_ == CV_8UC1?CV_32S:CV_32F);
rtflann::Matrix<size_t> indicesF((size_t*)indices.data, indices.rows, indices.cols);

View File

@@ -760,7 +760,7 @@ std::list<int> VWDictionary::addNewWords(const cv::Mat & descriptorsIn,
for(int j=0; j<dists.cols; ++j)
{
float d = dists.at<float>(i,j);
int id = uValue(_mapIndexId, results.at<int>(i,j));
int id = uValue(_mapIndexId, (int)results.at<size_t>(i,j));
if(d >= 0.0f && id > 0)
{
fullResults.insert(std::pair<float, int>(d, id));
@@ -1108,7 +1108,7 @@ std::vector<int> VWDictionary::findNN(const cv::Mat & queryIn) const
for(int j=0; j<dists.cols; ++j)
{
float d = dists.at<float>(i,j);
int id = uValue(_mapIndexId, results.at<int>(i,j));
int id = uValue(_mapIndexId, (int)results.at<size_t>(i,j));
if(d >= 0.0f && id > 0)
{
fullResults.insert(std::pair<float, int>(d, id));