Jim
Jim

Reputation: 4669

Is it possible to use OpenCV's K-Means implementation with arbitrary objects?

I have a set of objects that don't intuitively fit into a cv::Mat, and I want to cluster them. I have a distance function defined between any two objects, and I'm already including OpenCV into my project, so it seems convenient to use its implementation.

So, my question is, given a defined distance function, can I use OpenCV's k-means clustering implementation when the objects aren't intuitively cv::Mat compatible?

Upvotes: 2

Views: 804

Answers (1)

Sam
Sam

Reputation: 20058

Unfortunately OpenCV's KMeans is hardcoded to handle only floatig point, single precision values. Anything else must be converted, if possible, to be used inside KMeans.

It should not be something impossible to send a distance function to a generic KMeans algorithm, but the current implementation does not allow it. All it can handle are multi-dimensional floating point feature spaces, stored in cv::Mat

Upvotes: 1

Related Questions