当前位置:网站首页>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);
}
边栏推荐
- Opencv learning notes -day1 (image reading display imread, imshow, namedwindow)
- Introduction to the runner of mmcv
- Gilbert Strang's course notes on linear algebra - Lesson 1
- Mmdet line by line deltaxywhbboxcoder
- Detectron2 source code reading 2--- using the configurable decorator to build the dataloader
- VIM from dislike to dependence (21) -- cross file search
- Swagger use
- Implementing custom drawer component in quick application
- 【kotlin 协程】万字协程 一篇完成kotlin 协程进阶
- Qt连接神通数据库
猜你喜欢

我们如何拿到自己满意的薪资呢?这些套路还是需要掌握的

【NVMe2.0b 14-3】Doorbell Buffer Config command、Device Self-test command
![[untitled]](/img/45/368c41a74bf0738369c58c5963fca0.jpg)
[untitled]

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

Flink SQL 自定义 Connector

Bind threads to run on a specific CPU logical kernel

自制GIF动态图-gifcam
![[kotlin collaboration process] complete the advanced kotlin collaboration process](/img/43/9c4b337caf406537e317dea2ed5f17.png)
[kotlin collaboration process] complete the advanced kotlin collaboration process

Redis design and Implementation (VII) | publish & subscribe

技术管理进阶——管理者如何进行梯队设计及建设
随机推荐
[paid promotion] collection of frequently asked questions, FAQ of recommended list
电流探头电路分析
挖财开户安全吗?怎么有人说不靠谱。
Implementing custom drawer component in quick application
Map,String,Json之間轉換
How can we get a satisfactory salary? These routines still need to be mastered
Axure make menu bar effect
Gilbert Strang's course notes on linear algebra - Lesson 3
Enhance the add / delete operation of for loop & iterator delete collection elements
codeforces每日5题(均1700)-第三天
Maxiouassigner of mmdet line by line interpretation
从0开始构建一个瀚高数据库Docker镜像
Redis design and Implementation (VI) | cluster (sharding)
Summary of common pytoch APIs
QT downloading files through URL
Interpretation of source code demand:a rotation equivariant detector for aerial object detection
Does the oscilloscope probe affect the measurement of capacitive load?
将线程绑定在某个具体的CPU逻辑内核上运行
Flink Exception -- No ExecutorFactory found to execute the application
我们如何拿到自己满意的薪资呢?这些套路还是需要掌握的