Skip to content

Commit 155f23f

Browse files
committed
contour
1 parent cd4ff36 commit 155f23f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/gab/opencv/Contour.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ public void loadPoints(Point[] pts){
5151
}
5252
}
5353

54+
public boolean containsPoint(int x, int y){
55+
Point p = new Point(x,y);
56+
MatOfPoint2f m = new MatOfPoint2f(pointMat.toArray());
57+
58+
double r = Imgproc.pointPolygonTest(m,p, false);
59+
return r == 1;
60+
}
61+
5462
// The polygonApproximationFactor is used to determine
5563
// how strictly to follow a curvy polygon when converting
5664
// it into a simpler polygon with getPolygonApproximation().

0 commit comments

Comments
 (0)