Ask Your Question

Revision history [back]

FLANN with Hierarchical Clustering Index

Hi guys,

I am implementing a FLANN based matcher with ORB. For this I want to use the Hierarchical Clustering, since it can be used for binary feature matching.

My Code for initializing FLANN:

    index_params=dict(algorithm=5, branching = 32, centers_init = 0, trees = 4, leaf_max_size = 100)
    search_params = dict(checks=50)
    flann = cv2.FlannBasedMatcher(index_params, search_params)
    matches = flann.knnMatch(des_frame, des_train, k=2)

But I receive the following error:

matches = flann.knnMatch(des_frame, des_train, k=2) cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\flann\src\miniflann.cpp:315: error: (-210:Unsupported format or combination of formats) in function 'cv::flann::buildIndex_'> type=0>

The parameters are according to the FLANN manual: https://www.cs.ubc.ca/research/flann/uploads/FLANN/flann_manual-1.8.4.pdf

Manual Page 10:

struct HierarchicalClusteringIndexParams : public IndexParams{
HierarchicalClusteringIndexParams(
int branching = 32,flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM,int trees = 4, 
int leaf_max_size = 100)}

I hope you can help me with this problem. thx

click to hide/show revision 2
None

updated 2020-05-05 10:28:54 -0600

berak gravatar image

FLANN with Hierarchical Clustering Index

Hi guys,

I am implementing a FLANN based matcher with ORB. For this I want to use the Hierarchical Clustering, since it can be used for binary feature matching.

My Code for initializing FLANN:

    index_params=dict(algorithm=5, branching = 32, centers_init = 0, trees = 4, leaf_max_size = 100)
    search_params = dict(checks=50)
    flann = cv2.FlannBasedMatcher(index_params, search_params)
    matches = flann.knnMatch(des_frame, des_train, k=2)

But I receive the following error:

matches = flann.knnMatch(des_frame, des_train, k=2)
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\flann\src\miniflann.cpp:315: error: (-210:Unsupported format or combination of formats) in function 'cv::flann::buildIndex_'> type=0>

type=0>

The parameters are according to the FLANN manual: https://www.cs.ubc.ca/research/flann/uploads/FLANN/flann_manual-1.8.4.pdf

Manual Page 10:

struct HierarchicalClusteringIndexParams : public IndexParams{
HierarchicalClusteringIndexParams(
int branching = 32,flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM,int trees = 4, 
int leaf_max_size = 100)}

I hope you can help me with this problem. thx