Search in sources :

Example 11 with Line

use of com.disnodeteam.dogecv.math.Line in project Relic_Main by TeamOverdrive.

the class Lines method getMeanPoint.

public static Point getMeanPoint(List<Line> lines) {
    if (lines.size() == 0)
        return null;
    double x = 0;
    double y = 0;
    for (Line line : lines) {
        x += line.center().x;
        y += line.center().y;
    }
    return new Point(x / lines.size(), y / lines.size());
}
Also used : Line(com.disnodeteam.dogecv.math.Line) Point(org.opencv.core.Point)

Example 12 with Line

use of com.disnodeteam.dogecv.math.Line in project Relic_Main by TeamOverdrive.

the class Lines method getPerpindicularDistance.

public static double getPerpindicularDistance(Line line1, Point point) {
    Line perp = Lines.getPerpindicular(line1, Lines.crossSign(line1, point));
    Line joint = new Line(line1.center(), point);
    return Math.cos(Lines.getAngularDistance(perp, joint) * Math.PI / 180) * joint.length();
}
Also used : Line(com.disnodeteam.dogecv.math.Line)

Aggregations

Line (com.disnodeteam.dogecv.math.Line)12 Point (org.opencv.core.Point)8 ArrayList (java.util.ArrayList)4 List (java.util.List)2 Mat (org.opencv.core.Mat)2 Size (org.opencv.core.Size)2 MatOfPoint (org.opencv.core.MatOfPoint)1 Scalar (org.opencv.core.Scalar)1