Reproduced:
The Rect_ class has some meanings, the member variable x, y, width, height, respectively, the coordinates of the upper-left corner and the width and height of the rectangle. Commonly used member functions have a size () return value of one Size,area () returns the area of the rectangle, contains (point) is used to determine whether the dot is within the rectangle, the inside (Rect) function determines whether the rectangle is within the rectangle, and the TL () returns the upper-left point coordinate, BR () Returns the point coordinate of the lower right corner. It is worth noting that if you want to find the intersection of two rectangles, and set, you can use the following format
[CPP] view plain copy
- Rect rect = rect1 & rect2;
- Rect rect = Rect1 | Rect2;
If you want the rectangle to pan, the zoom operation can even be written like this
[CPP] view plain copy
- Rect rectshift = rect + point;
- Rect rectscale = rect + size;
OpenCV in Rect class