1

Does anybody know what algorithm is used here?

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

Thank you.

2
  • 1
    OpenCV is open source. Why not have a look? Commented Jul 8, 2015 at 10:31
  • @RogerRowland yes, I know :) But it would be great to know what algorithm do they use first. What I want to do is to implement this thing in a different language and first I want to know the name of the algorithm (maybe there are libraries that might have it implemented) before porting it to another language. Commented Jul 8, 2015 at 10:34

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Great! Thank you, Roger. Could you, please, refer me where did you find this lines? Because I found only this github.com/Itseez/opencv/blob/…
@warmspringwinds Maybe they removed the comment in later sources - I have 2.4.8 and the body of that function looks the same to me. For example, you can see it here
Thank you :) Now it's much easier for me with this information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.