OpenCV partition()底层算法

OpenCV partition() underlying algorithm

有人知道用什么算法吗here

我想实现这个功能来做检测的windows分组。

谢谢。

如果您查看 partition 函数的 OpenCV 源代码,您将看到以下注释:

// 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.
}

这为您提供了源代码和算法参考。

所以,这是第 21 章 in this book