Explanation of cvSeqPartition()?
I have no idea what this does could someone explain this to me in SIMPLE terms? Please 开发者_Python百科don't give me complicated mathematical answers or something too technical, just its general purpose Thanks
// This function splits the input sequence or set into one or more equivalence classes.
// is_equal(a,b,...) returns non-zero if the two sequence elements
// belong to the same class. The function returns sequence of integers -
// 0-based class indexes for each element.
//
// The algorithm is described in "Introduction to Algorithms"
// by Cormen, Leiserson and Rivest, chapter "Data structures for disjoint sets"
CV_IMPL int
cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels,
CvCmpFunc is_equal, void* userdata )
What part requires more detailed explanation?
Update:
Foe example, consider the following sequence of integers:
{9,5,7,5,9,9}
When is_equal
function just tests for integer equality, cvSeqPartition
will find 3 classes:
{9,9,9} {5,5} {7}
so cvSeqPartition
output will be
{0,1,2,1,0,0}
where each number is index of the element class.
精彩评论