Common Data Structures and Color Spaces
OpenCV common data structures:
1) Point class
The Point class data structure represents a point in a two-dimensional coordinate system, a 2D point specified by coordinates x, y, such as:
Point pt; pt.x = 20; pt.y = 10; C++ other types
Use tuples (x, y) directly in Python
2) Rect class
The Rect class is used to represent a rectangle, and its members include x, y, width, height
Use tuples (x, y, w, h) directly in Python
3) Size class
Size represents the size of the area, and the common constructor Size(intwidth, int height) directly uses the tuple (width, height) in Python
4) Scalar class
Scalar 0 means an array with four elements, which is mostly used to transfer pixel values, such as the general form of RGB color: Scalar(double B, double Gdouble R, double Alpha) if the fourth one is not used, it means Scalar(B, G, R), where: B represents the blue component, G represents the green component, R represents the red component, and Alpha represents the transparency Note: Scalar represents the color sequence as BGR Scalar (255, 0, 0) represents
pure blue Scalar (0 , 255, 0) means pure green
Scalar (0