当前位置:网站首页>Opencv daily function structure analysis and shape descriptor (7) finding polygon (contour) / rotating rectangle intersection

Opencv daily function structure analysis and shape descriptor (7) finding polygon (contour) / rotating rectangle intersection

2022-06-24 08:52:00 Sit and watch the clouds rise

One 、intersectConvexConvex function

1、 The function prototype

         Find the intersection of two convex polygons . Returns the absolute value of the area of an intersecting polygon .intersectConvexConvex Do not confirm that both polygons are convex , If not , Invalid results will be returned .

float 	cv::intersectConvexConvex (InputArray p1, InputArray p2, OutputArray p12, bool handleNested=true)

2、 Parameters,

p1 The first outline
p2 Second profile
p12 The output polygon that describes the intersection area
handleNested When it's true , If one polygon is completely contained in another , Then find an intersection . If false, The intersection cannot be found . If a polygon shares an edge or the vertex of one polygon is on the edge of another polygon , Then they are not considered nested , No matter what handleNested What's the value of , Will find the intersection .

Two 、rotatedRectangleIntersection function

1、 The function prototype

        This function finds out if there is any intersection between two rotating rectangles . If there is , The vertices of the intersecting region are also returned .

int 	cv::rotatedRectangleIntersection (const RotatedRect &rect1, const RotatedRect &rect2, OutputArray intersectingRegion)

2、 Parameters,

rect1 The first rectangle
rect2 The second rectangle
intersectingRegion The output array of the vertices of the intersecting region . It returns... At most 8 vertices . Stored as std::vector<cv::Point2f> or cv::Mat As CV_32FC2 Type of Mx1.

3、 Schematic image

         Here are some examples of possible intersections . The shaded pattern represents the intersection area , The red vertex is returned by the function .

Examples of intersections

 

原网站

版权声明
本文为[Sit and watch the clouds rise]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206240627534799.html