Examples of MatOfPoint


Examples of org.opencv.core.MatOfPoint

  }
 
  public Contour(PApplet parent, MatOfPoint2f mat){
    polygonApproximationFactor = mat.size().height * 0.01;
    this.parent = parent;
    this.pointMat = new MatOfPoint(mat.toArray());
   
    Rect r = Imgproc.minAreaRect(mat).boundingRect();
    boundingBox = new Rectangle(r.x, r.y, r.width, r.height);
    loadPoints(mat.toArray());     
  }
View Full Code Here

Examples of org.opencv.core.MatOfPoint

   *
   * @return Contour
   */
  public Contour getConvexHull(){
      MatOfInt hull = new MatOfInt();
      MatOfPoint points = new MatOfPoint(pointMat);
     
     
      Imgproc.convexHull(points, hull);
      Point[] hp = new Point[hull.height()];
     
      for(int i = 0; i < hull.height(); i++){
        int index = (int)hull.get(i,0)[0];
        hp[i] = new Point(pointMat.get(index,0));
      }
      MatOfPoint hullPoints = new MatOfPoint();
      hullPoints.fromArray(hp);

      return new Contour(parent, hullPoints);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.