Open CV Coding Part 2 TYWu Cv Seq

  • Slides: 9
Download presentation
Open. CV Coding (Part 2) TYWu

Open. CV Coding (Part 2) TYWu

Cv. Seq • The structure Cv. Seq is a base for all of Open.

Cv. Seq • The structure Cv. Seq is a base for all of Open. CV dynamic data structures. • There are two types of sequences - dense and sparse. • The base type for dense sequences is Cv. Seq and such sequences are used to represent growable 1 d arrays - vectors, stacks, queues, and deques. They have no gaps in the middle - if an element is removed from the middle or inserted into the middle of the sequence, the elements from the closer end are shifted.

Cv. Seq • Example Cv. Seq* lines = 0; : lines = cv. Hough.

Cv. Seq • Example Cv. Seq* lines = 0; : lines = cv. Hough. Lines 2( dst, storage, CV_HOUGH_PROBABILISTIC, 1, CV_PI/180, 50, 4 );

Cv. Point • struct Cv. Point – 2 D point with integer coordinates (usually

Cv. Point • struct Cv. Point – 2 D point with integer coordinates (usually zero -based). – e. g Cv. Point* line = ( Cv. Point* )cv. Get. Seq. Elem( lines, 0 );

cv. Get. Seq. Elem • Returns a pointer to a sequence element according to

cv. Get. Seq. Elem • Returns a pointer to a sequence element according to its index. • C: schar* cv. Get. Seq. Elem(const Cv. Seq* seq, int index) – Parameters: – seq – Sequence – index – Index of element

cv. Line • void cv. Line(Cv. Arr* img, Cv. Point pt 1, Cv. Point

cv. Line • void cv. Line(Cv. Arr* img, Cv. Point pt 1, Cv. Point pt 2, Cv. Scalar color, int thickness=1, int line_type=8, int shift=0 ) • e. g. cv. Line( color_dst, line[0], line[1], CV_RGB( 255, 0, 0 ), 2 ); line[1] line[0]

cv. Circle • void cv. Circle(Cv. Arr* img, Cv. Point center, int radius, Cv.

cv. Circle • void cv. Circle(Cv. Arr* img, Cv. Point center, int radius, Cv. Scalar color, int thickness=1, int line_type=8, int shift=0 ) • • • img – Image where the circle is drawn. center – Center of the circle. radius – Radius of the circle. color – Circle color. thickness – Thickness of the circle outline, if positive. Negative thickness means that a filled circle is to be drawn. • line. Type – Type of the circle boundary. See the line() description. • shift – Number of fractional bits in the coordinates of the center and in the radius value. • E. g. – cv. Circle(color_dst, pt, cv. Round( p[2] ), cv. Scalar(0, 0, 255), 4);

cv. Round • Rounds floating-point number to the nearest integer • int cv. Round(double

cv. Round • Rounds floating-point number to the nearest integer • int cv. Round(double value)

Cv. Point • Cv. Point cv. Point(int x, int y) – constructs Cv. Point

Cv. Point • Cv. Point cv. Point(int x, int y) – constructs Cv. Point structure