Class: OpenCV::CvSeq

Inherits:
Object
  • Object
show all
Defined in:
ext/cvseq.cpp

Overview

Generic Sequence class. CvSeq has the method like Array (push, pop, select, etc…). But, CvSeq cannot store the object of a different class. When storing object in CvSeq, conversion is automatically tried, and the object occurs the error if it cannot be done.

e.g.

seq = CvSeq.new(CvPoint)    # Argument mean "this sequence contain only this class's object"
seq.push(CvPoint.new(0, 0)) # => it's ok
seq.push("hello")           # => try convert "hello" to CvPoint. but can't do it. raise error.

If the sequecne contain object of class A. When storing object(named “obj”) of class B to the sequence.

Try automatically : A.from_B(obj) => object of class A.

CvSeq has the circulation structure internally. That is, when the sequence has three values (“a”,“b”,“c”), seq and seq are same “a”, and seq and seq are same “c”.

The sequence might have another sequence outside. see below. Each sequece has h_prev, h_next, v_prev, v_next method. If the adjoining sequence exists, each method return the adjoining sequence. Otherwise return nil.