Feature Matching; Detection of multiple Object Instances

asked 2017-08-04 09:31:37 -0600

JoeBroesel gravatar image

updated 2017-08-04 09:49:05 -0600

Hello, I would like to implement a feature-matching-approach for multiple object detection. In related questions [http://answers.opencv.org/question/17...] [http://answers.opencv.org/question/45...] a meanshift clustering for the feature points is recommended. In SO a python implementation is given. Is there a c++-equivalent for the approach from V. Gai. Especially the following MeanShift part?

import numpy as np
from sklearn.cluster import MeanShift, estimate_bandwidth

x = np.array([kp2[0].pt])

for i in xrange(len(kp2)):
    x = np.append(x, [kp2[i].pt], axis=0)

x = x[1:len(x)]

bandwidth = estimate_bandwidth(x, quantile=0.1, n_samples=500)

ms = MeanShift(bandwidth=bandwidth, bin_seeding=True, cluster_all=True)
ms.fit(x)
labels = ms.labels_
cluster_centers = ms.cluster_centers_

labels_unique = np.unique(labels)
n_clusters_ = len(labels_unique)
edit retag flag offensive close merge delete