Skip to content

Commit c90e824

Browse files
Merge pull request opencv#17639 from pemmanuelviel:pev--binary-kmeans
Pev binary kmeans * Ongoing work transposing kmeans clustering method for bitfields: the computeClustering method Ongoing work transposing kmeans clustering method for bitfields: interface computeBitfieldClustering Fix genericity of computeNodeStatistics Ongoing work transposing kmeans clustering method for bitfields: adapt computeNodeStatistics() Ongoing work transposing kmeans clustering method for bitfields: adapt findNN() method Ongoing work transposing kmeans clustering method for bitfields: allow kmeans with Hamming distance Ongoing work transposing kmeans clustering method for bitfields: adapt distances code Ongoing work transposing kmeans clustering method for bitfields: adapt load/save code Ongoing work transposing kmeans clustering method for bitfields: adapt kmeans hierarchicalClustring() PivotType -> CentersType Renaming Fix type casting for ARM SIMD implementation of Hamming Fix warnings with Win32 compilation Fix warnings with Win64 compilation Fix wrong parenthesis position on rounding * Ensure proper rounding when CentersType is integral
1 parent 749bd80 commit c90e824

File tree

5 files changed

+605
-94
lines changed

5 files changed

+605
-94
lines changed

modules/flann/include/opencv2/flann.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ class Index_
536536
@param features The points to be clustered. The matrix must have elements of type
537537
Distance::ElementType.
538538
@param centers The centers of the clusters obtained. The matrix must have type
539-
Distance::ResultType. The number of rows in this matrix represents the number of clusters desired,
539+
Distance::CentersType. The number of rows in this matrix represents the number of clusters desired,
540540
however, because of the way the cut in the hierarchical tree is chosen, the number of clusters
541541
computed will be the highest number of the form (branching-1)\*k+1 that's lower than the number of
542542
clusters desired, where branching is the tree's branching factor (see description of the
@@ -553,15 +553,15 @@ int hierarchicalClustering(const Mat& features, Mat& centers, const ::cvflann::K
553553
Distance d = Distance())
554554
{
555555
typedef typename Distance::ElementType ElementType;
556-
typedef typename Distance::ResultType DistanceType;
556+
typedef typename Distance::CentersType CentersType;
557557

558558
CV_Assert(features.type() == CvType<ElementType>::type());
559559
CV_Assert(features.isContinuous());
560560
::cvflann::Matrix<ElementType> m_features((ElementType*)features.ptr<ElementType>(0), features.rows, features.cols);
561561

562-
CV_Assert(centers.type() == CvType<DistanceType>::type());
562+
CV_Assert(centers.type() == CvType<CentersType>::type());
563563
CV_Assert(centers.isContinuous());
564-
::cvflann::Matrix<DistanceType> m_centers((DistanceType*)centers.ptr<DistanceType>(0), centers.rows, centers.cols);
564+
::cvflann::Matrix<CentersType> m_centers((CentersType*)centers.ptr<CentersType>(0), centers.rows, centers.cols);
565565

566566
return ::cvflann::hierarchicalClustering<Distance>(m_features, m_centers, params, d);
567567
}

modules/flann/include/opencv2/flann/all_indices.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ struct index_creator<False,False,Distance>
130130
case FLANN_INDEX_LINEAR:
131131
nnIndex = new LinearIndex<Distance>(dataset, params, distance);
132132
break;
133+
case FLANN_INDEX_KMEANS:
134+
nnIndex = new KMeansIndex<Distance>(dataset, params, distance);
135+
break;
133136
case FLANN_INDEX_HIERARCHICAL:
134137
nnIndex = new HierarchicalClusteringIndex<Distance>(dataset, params, distance);
135138
break;

0 commit comments

Comments
 (0)