当前位置:网站首页>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 
边栏推荐
- Getting started with detectron2
- Introduce structured concurrency and release swift 5.5!
- Tensorflow and pytorch middle note feature map size adjustment to achieve up sampling
- Tensorflow1. X and 2 How does x read those parameters saved in CKPT
- Pytorch preserves different forms of pre training models
- DW basic course (II)
- Code cloud download history version process
- [leetcode sword finger offer 58 - I. flip word order (simple)]
- Sharpness difference (SD) calculation method of image reconstruction and generation domain index
- Tensorflow realizes gradient accumulation, and then returns
猜你喜欢
 - C winfrom DataGridView click on the column header can not automatically sort the problem 
 - Database Experiment 3 data update experiment 
 - 2.整理华子面经--2 
 - C, print the source program of beautiful bell triangle 
 - Two Stage Detection 
 - DeNO 1.13.2 release 
 - Problem brushing plan -- dynamic programming (III) 
 - Pycharm Chinese plug-in 
 - 一文解决浏览器跨域问题 
 - Question brushing plan - depth first search (II) 
随机推荐
- How to use the project that created SVN for the first time 
- [leetcode refers to offer 47. Maximum value of gift (medium)] 
- Problem brushing plan -- dynamic programming (III) 
- Keras. Layers introduction to various layers 
- Flomo software recommendation 
- 2022-04-24日报:在生物科学领域应用深度学习的当前进展和开放挑战 
- [leetcode refers to offer 22. The penultimate node in the linked list (simple)] 
- DeNO 1.13.2 release 
- Ubutnu20 installer centernet 
- Pytorch preserves different forms of pre training models 
- C#,打印漂亮的贝尔三角形(Bell Triangle)的源程序 
- 2022-04-24日報:在生物科學領域應用深度學習的當前進展和開放挑戰 
- What if Jenkins forgot his password 
- Xiaomi mobile phone has abandoned the "Mi" brand all over the world and switched to the full name brand of "Xiaomi" 
- 2.整理华子面经--2 
- [leetcode refers to offer 21. Adjust the array order so that odd numbers precede even numbers (simple)] 
- Chrome 94 引入具有争议的 Idle Detection API,苹果和Mozilla反对 
- Detailed explanation of basic assembly instructions of x86 architecture 
- DW basic course (II) 
- Database experiment VI integrity language experiment