当前位置:网站首页>Detailed explanation of rect class
Detailed explanation of rect class
2022-06-30 08:48:00 【Chasing foot dream】
If you create a Rect object rect(100, 50, 50, 100), that rect There will be the following functions :
rect.area(); // return rect The area of 5000
rect.size(); // return rect The size of the [50 × 100]
rect.tl(); // return rect The coordinates of the upper left vertex of [100, 50]
rect.br(); // return rect The coordinates of the lower right vertex of [150, 150]
rect.width(); // return rect Width 50
rect.height(); // return rect Height 100
rect.x
rect.contains(Point(x, y)); // Returns a boolean variable , Judge rect Does it include Point(x, y) spot
// You can also find the intersection and union of two rectangles
rect = rect1 & rect2;
rect = rect1 | rect2;
// You can also pan and zoom the rectangle
rect = rect + Point(-100, 100); // translation , That is, the top left vertex x coordinate -100,y coordinate +100
rect = rect + Size(-100, 100); // The zoom , Top left vertex unchanged , Width -100, Height +100
// You can also compare rectangles , Returns a boolean variable
rect1 == rect2;
rect1 != rect2;
//OpenCV There seems to be no judgment in rect1 Whether in rect2 The function inside , So write one yourself
bool isInside(Rect rect1, Rect rect2)
{
return (rect1 == (rect1&rect2));
}
//OpenCV It seems that there is no function to obtain the center point of the rectangle , Or write one by yourself
Point getCenterPoint(Rect rect)
{
Point cpt;
cpt.x = rect.x + cvRound(rect.width/2.0);
cpt.y = rect.y + cvRound(rect.height/2.0);
return cpt;
}
// Scale around the center of the rectangle
Rect rectCenterScale(Rect rect, Size size)
{
rect = rect + size;
Point pt;
pt.x = cvRound(size.width/2.0);
pt.y = cvRound(size.height/2.0);
return (rect-pt);
}
边栏推荐
- Is it safe to open an account? How can anyone say that it is not reliable.
- Build a docker image of Henkel database from 0
- Vite project require syntax compatibility problem solving require is not defined
- Sort (simple description)
- Maxiouassigner of mmdet line by line interpretation
- layer.open 当传值为数组或值太长时处理方法
- Pytorch BERT
- C # get the current timestamp
- Interference source current spectrum test of current probe
- [kotlin collaboration process] complete the advanced kotlin collaboration process
猜你喜欢
![[nvme2.0b 14-8] set features (Part 2)](/img/fe/67fd4f935237f9aa835e132e696b98.png)
[nvme2.0b 14-8] set features (Part 2)

Redis design and Implementation (II) | database (deletion strategy & expiration elimination strategy)

Axure make menu bar effect

技术管理进阶——管理者如何进行梯队设计及建设

Summary of common pytoch APIs

一次cpu 跌底排查

Redis设计与实现(一)| 数据结构 & 对象

Graffiti Wi Fi & ble SoC development slide strip

codeforces每日5题(均1700)-第三天

Flink SQL 自定义 Connector
随机推荐
Design specification for smart speakers v1.0
Sort (simple description)
[nvme2.0b 14-7] set features (Part 1)
[untitled]
Comparison of two ways for C to access SQL Server database (SqlDataReader vs SqlDataAdapter)
Build a docker image of Henkel database from 0
Mmdet line by line code interpretation of positive and negative sample sampler
Detailed explanation of pipline of mmdetection
[paid promotion] collection of frequently asked questions, FAQ of recommended list
Detectron2 source code reading 2--- using the configurable decorator to build the dataloader
Qt连接神通数据库
2021-02-27
C#訪問SQL Server數據庫兩種方式的比較(SqlDataReader vs SqlDataAdapter)
增强for循环的增删操作 & 迭代器删除集合元素
el-input 限制只能输数字
Viteproject require Syntax Compatibility Problem Solving require is not defined
Detectron2 source code reading 3-- encapsulating dataset with mapper
C # get the current timestamp
【NVMe2.0b 14】NVMe Admin Command Set
启动jar包报错UnsupportedClassVersionError,如何修复