当前位置:网站首页>Common scenes of vector product in image
Common scenes of vector product in image
2022-04-23 21:57:00 【Three stone orders】
Cross product ( Vector product ) Definition :
1、a×b or a∧b, The result is scalar ;
2、 Vector product |c|=|a×b|=|a||b|sin<a,b>, namely c The length of is numerically equal to a,b, The included angle is θ The area of the parallelogram formed ;
3、a=(x1,y1),b=(x2,y2), be a×b=x1y2-y1x2;
4、a×b Less than 0, vector a Less than 180° Rotate counterclockwise to vector b;a×b Greater than 0, vector a Less than 180° Rotate clockwise to vector b;a×b be equal to 0, vector a Parallel and vector b;
Reference scene 1:
OpenCV in contourArea Contour area algorithm , Suppose that the contour point (A、B、C) Sort clockwise ,O Origin ,OA×OB Is the area of the corresponding parallelogram , Half is a triangle OAB The area of ( Green area )
Then there are ABC The area of =OA×OB×0.5+OB×OC×0.5+OC×OA×0.5, among OC×OA In the opposite direction ;
Reference scene 2:
When a set of points with any distribution is sorted clockwise by bubbling method , You need to determine the direction of the two vectors , Such as OA Rotate to OB Clockwise or counterclockwise .
bool IsAnticlockwise(Point O, Point a, Point b)
{
// If oa Rotate clockwise to ob The angle of is less than 180°, return false, Otherwise return to true
if (a.x >= 0 && b.x < 0)
return true;
if (a.x == 0 && b.x == 0)
return a.y > b.y;
// vector OA Sum vector OB Cross product of
int det = (a.x - O.x) * (b.y - O.y) - (b.x - O.x) * (a.y - O.y);
if (det < 0)
return true;
if (det > 0)
return false;
// vector OA Sum vector OB Collinear , Judge the size by distance
int d1 = (a.x - O.x) * (a.x - O.x) + (a.y - O.y) * (a.y - O.y);
int d2 = (b.x - O.x) * (b.x - O.y) + (b.y - O.y) * (b.y - O.y);
return d1 > d2;
}
Reference scene 3:
Judge whether the line segments intersect by the positive and negative cross product of two vectors ;
https://blog.csdn.net/li1615882553/article/details/80372202
other :
Pay attention to distinguish dot product ( To multiply ), The result is a vector ,v1.v2=|v1|*|v2|*cosθ
版权声明
本文为[Three stone orders]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204200615437236.html
边栏推荐
- [leetcode refers to offer 27. Image of binary tree (simple)]
- JS merge duplicate data in array object
- pytorch 1.7. The model saved by X training cannot be loaded in version 1.4 or earlier
- 2022 - 04 - 24 Daily: Current Progress and Open Challenges of Applied Deep Learning in Biological Sciences
- Pytorch: runtimeerror: an attempt has been made to start a new process Error reporting (resolved)
- The computer is out of power. How did I pass the terrible interview of Tencent cloud?
- Assertionerror: invalid device ID and runtimeerror: CUDA error: invalid device ordinal
- [※ leetcode refers to offer 48. The longest substring without repeated characters (medium)]
- 危机即机遇,远程办公效率为何会提升?
- 如何发挥测试策略的指导性作用
猜你喜欢
![[leetcode refers to the two numbers of offer 57. And S (simple)]](/img/c2/7c1434e3c0bbcc6d6364361c3a3ab4.png)
[leetcode refers to the two numbers of offer 57. And S (simple)]

Deno 1.13.2 发布

Preliminary analysis of Airbase
![[※ leetcode refers to offer 32 - II. Print binary tree II from top to bottom (simple)]](/img/df/2ee25fcc78758e125182b89d3ba8f2.png)
[※ leetcode refers to offer 32 - II. Print binary tree II from top to bottom (simple)]

在线Excel转CSV工具

Database experiment I database definition and data import

Online Excel to CSV tool

Error message: b04access.00f eve'. Read of address 000001B4

Yolov5 NMS source code understanding
![[leetcode refers to offer 27. Image of binary tree (simple)]](/img/65/85e63a8b7916af058d78d72d775530.png)
[leetcode refers to offer 27. Image of binary tree (simple)]
随机推荐
MySQL 回表
[leetcode sword finger offer 28. Symmetric binary tree (simple)]
thinkphp5+数据大屏展示效果
Code cloud download history version process
A solution of C batch query
Thread safe sigleton (singleton mode)
亚马逊和Epic将入驻,微软应用商城向第三方开放
JS merge duplicate data in array object
手撕《Google SRE Book》
[leetcode refers to offer 27. Image of binary tree (simple)]
一文解决浏览器跨域问题
A series of problems of C DataGridView binding list
Sqlserver edits data in the query interface (similar to Oracle's edit and ROWID)
Google 尝试在 Chrome 中使用 Rust
Tensorflow1. X and 2 How does x read those parameters saved in CKPT
Ali has another "against the sky" container framework! This kubernetes advanced manual is too complete
[leetcode refers to offer 18. Delete the node of the linked list (simple)]
2.整理华子面经--2
[leetcode refers to offer 42. Maximum sum of continuous subarrays (simple)]
Introduction to tensorrt