warmspringwinds
warmspringwinds

Reputation: 1177

OpenCV partition() underlying algorithm

Does anybody know what algorithm is used here?

I want to implement this function to do detection's windows grouping.

Thank you.

Upvotes: 1

Views: 1659

Answers (1)

Roger Rowland
Roger Rowland

Reputation: 26259

If you look at the OpenCV source code for the partition function, you will see the following comments:

// This function splits the input sequence or set into one or more equivalence classes and
// returns the vector of labels - 0-based class indexes for each element.
// predicate(a,b) returns true if the two sequence elements certainly belong to the same class.
//
// The algorithm is described in "Introduction to Algorithms"
// by Cormen, Leiserson and Rivest, the chapter "Data structures for disjoint sets"
template<typename _Tp, class _EqPredicate> int partition( const vector<_Tp>& _vec, vector<int>& labels, _EqPredicate predicate=_EqPredicate())
{
    // ... etc.
}

This gives you both the source code, and the reference for the algorithm.

So, that's Chapter 21 in this book.

Upvotes: 2

Related Questions