连接给定图上的点
问题描述:
在给定图表上连接点的最佳或最简单的方法是什么。我想连接点形成一个矩形。这些点最初是蓝色的。
What is the best or easiest way to connect the dots on the given diagram. I would like to connect the dots to form a rectangle. The dots are initially blue color.
答
如果您要创建 tetragon (带4个vertix的形状)而不是强>(具有4个垂直和所有角度等于90度的形状) - i。 e。连接点,人们可以简单地分类为线,最简单的方法是创建具有点坐标的数组,然后应用 cv :: approxPolyDP 或 cv :: convexHull 。
If you want to create tetragon (shape with 4 vertixes) instead of rectangle (shape with 4 vertixes and all angles equal to 90 degrees) - i. e. connect points that human can simply classify as lines, the simplest way is creating array with points coordinates, and then applying cv::approxPolyDP or cv::convexHull.