this.x = x; this.y = y; this.width = width; this.height = height;
}
……
}public class RotatedRect { public Point center; public Size size; public double angle; public RotatedRect() { this.center = new Point(); this.size = new Size(); this.angle = 0; } …… } ```
轮廓多边形
public static void approxPolyDP(MatOfPoint2f curve, MatOfPoint2f approxCurve, double epsilon, boolean closed)
-
参数一:curve,输入轮廓像素点。
-
参数二:approxCurve,多边形逼近结果,包含多边形顶点坐标集。
-
参数三:epsilon,多边形逼近精度,原始曲线与逼近曲线之间的最大距离。
-
参数四:closed,逼近曲线是否闭合的标志,true表示封闭,false,表示不封闭。
该方法使用的是
Douglas-Peucker algorithm(道格拉斯-普克算法)
。