private List<MatOfPoint> elementToPoints(Element element) { List<Point> points = new ArrayList<>(); points.add(new Point(element.x, element.y)); points.add(new Point(element.x + element.w, element.y)); points.add(new Point(element.x + element.w, element.y + element.h)); points.add(new Point(element.x, element.y + element.h)); MatOfPoint mPoints = new MatOfPoint(); mPoints.fromList(points); List<MatOfPoint> finalPoints = new ArrayList<MatOfPoint>(); finalPoints.add(mPoints); return finalPoints; }
public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave, int _class_id) { pt = new Point(x, y); size = _size; angle = _angle; response = _response; octave = _octave; class_id = _class_id; }
public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave, int _class_id) { pt = new Point(x, y); size = _size; angle = _angle; response = _response; octave = _octave; class_id = _class_id; }
public Point getVertex(int vertex, int[] firstEdge) { double[] firstEdge_out = new double[1]; Point retVal = new Point(getVertex_0(nativeObj, vertex, firstEdge_out)); if(firstEdge!=null) firstEdge[0] = (int)firstEdge_out[0]; return retVal; }
public RotatedRect() { this.center = new Point(); this.size = new Size(); this.angle = 0; }
public static Point phaseCorrelate(Mat src1, Mat src2, Mat window, double[] response) { double[] response_out = new double[1]; Point retVal = new Point(phaseCorrelate_0(src1.nativeObj, src2.nativeObj, window.nativeObj, response_out)); if(response!=null) response[0] = (double)response_out[0]; return retVal; }
public static Point phaseCorrelate(Mat src1, Mat src2) { Point retVal = new Point(phaseCorrelate_1(src1.nativeObj, src2.nativeObj)); return retVal; }
public Point calculateShift(Mat img0, Mat img1) { Point retVal = new Point(calculateShift_0(nativeObj, img0.nativeObj, img1.nativeObj)); return retVal; }
public Point getVertex(int vertex) { Point retVal = new Point(getVertex_1(nativeObj, vertex)); return retVal; }
public Point calculateShift(Mat img0, Mat img1) { Point retVal = new Point(calculateShift_0(nativeObj, img0.nativeObj, img1.nativeObj)); return retVal; }
public Point getVertex(int vertex) { Point retVal = new Point(getVertex_1(nativeObj, vertex)); return retVal; }
public Point calculateShift(Mat img0, Mat img1) { Point retVal = new Point(calculateShift_0(nativeObj, img0.nativeObj, img1.nativeObj)); return retVal; }
public FluentCv convertCirclesToPoints(List<Point> points) { for (int i = 0; i < mat.cols(); i++) { double[] circle = mat.get(0, i); double x = circle[0]; double y = circle[1]; points.add(new Point(x, y)); } return this; }
public Point[] toArray() { int num = (int) total(); Point[] ap = new Point[num]; if(num == 0) return ap; float buff[] = new float[num * _channels]; get(0, 0, buff); //TODO: check ret val! for(int i=0; i<num; i++) ap[i] = new Point(buff[i*_channels], buff[i*_channels+1]); return ap; }
public Point[] toArray() { int num = (int) total(); Point[] ap = new Point[num]; if(num == 0) return ap; int buff[] = new int[num * _channels]; get(0, 0, buff); //TODO: check ret val! for(int i=0; i<num; i++) ap[i] = new Point(buff[i*_channels], buff[i*_channels+1]); return ap; }
public Point[] toArray() { int num = (int) total(); Point[] ap = new Point[num]; if(num == 0) return ap; int buff[] = new int[num * _channels]; get(0, 0, buff); //TODO: check ret val! for(int i=0; i<num; i++) ap[i] = new Point(buff[i*_channels], buff[i*_channels+1]); return ap; }
private void drawCircles(Mat mat, List<CvStage.Result.Circle> circles, int numToDraw, Color color) { Color centerColor = new HslColor(color).getComplementary(); numToDraw = (numToDraw <= circles.size()) ? numToDraw : circles.size(); for (int i=0; i<numToDraw; i++) { CvStage.Result.Circle circle = circles.get(i); double x = circle.x; double y = circle.y; double radius = circle.diameter / 2.0; Imgproc.circle(mat, new Point(x, y), (int) radius, FluentCv.colorToScalar(color), 2); Imgproc.circle(mat, new Point(x, y), 1, FluentCv.colorToScalar(centerColor), 2); } }
public static Mat drawCircles(Mat mat, Mat circles) { for (int i = 0; i < circles.cols(); i++) { double[] circle = circles.get(0, i); double x = circle[0]; double y = circle[1]; double radius = circle[2]; Imgproc.circle(mat, new Point(x, y), (int) radius, new Scalar(0, 0, 255, 255), 2); Imgproc.circle(mat, new Point(x, y), 1, new Scalar(0, 255, 0, 255), 2); } return mat; }