List of usage examples for org.opencv.core Point Point
public Point(double x, double y)
From source file:org.lasarobotics.vision.detection.objects.Contour.java
License:Open Source License
public Point bottomRight() { return new Point(right(), bottom()); }
From source file:org.lasarobotics.vision.detection.objects.Contour.java
License:Open Source License
/** * Offset the object, translating it by a specific offset point * * @param offset Point to offset by, e.g. (1, 0) would move object 1 px right *///from www .ja v a2 s .c om @Override public void offset(Point offset) { Point[] points = this.getPoints(); for (int i = 0; i < points.length; i++) points[i] = new Point(points[i].x + offset.x, points[i].y + offset.y); mat.fromArray(points); }
From source file:org.lasarobotics.vision.detection.objects.Detectable.java
License:Open Source License
/** * Get the top-left point of the object * * @return Top-left point of the object */ public Point topLeft() { return new Point(left(), top()); }
From source file:org.lasarobotics.vision.detection.objects.Detectable.java
License:Open Source License
/** * Get the bottom right point of the object * * @return Bottom right point of the object *///from w ww .j av a2s. c om public Point bottomRight() { return new Point(right(), bottom()); }
From source file:org.lasarobotics.vision.detection.objects.Ellipse.java
License:Open Source License
/** * Offset the object, translating it by a specific offset point * * @param offset Point to offset by, e.g. (1, 0) would move object 1 px right *//*from w w w . ja va2 s .co m*/ @Override public void offset(Point offset) { this.rect = new RotatedRect(new Point(rect.center.x + offset.x, rect.center.y + offset.y), rect.size, rect.angle); }
From source file:org.lasarobotics.vision.detection.objects.Ellipse.java
License:Open Source License
/** * Transpose this rectangle so that x becomes y and vice versa * * @return Transposed rectangle instance *//*from w w w.j a va 2 s.com*/ @SuppressWarnings("SuspiciousNameCombination") public Ellipse transpose() { return new Ellipse(new RotatedRect(new Point(rect.center.y, rect.center.x), new Size(rect.size.height, rect.size.width), rect.angle)); }
From source file:org.lasarobotics.vision.detection.objects.Rectangle.java
License:Open Source License
/** * Create a rectangle bounded by four positions * * @param top Top-most Y value//from w ww . j av a 2 s . com * @param left Left-most X value * @param bottom Bottom-most Y value * @param right Right-most X value */ public Rectangle(double top, double left, double bottom, double right) { double width = Math.abs(right - left); double height = Math.abs(bottom - top); Point center = new Point(left + (width / 2.0), top + (height / 2.0)); setRect(new Rect((int) (center.x - (width / 2)), (int) (center.y - (height / 2)), (int) width, (int) height)); }
From source file:org.lasarobotics.vision.detection.objects.Rectangle.java
License:Open Source License
/** * Create a rectangle based on a set of points * * @param points Set of points (at least 4) defining the rectangle *///from w w w .jav a2 s . c o m public Rectangle(Point[] points) { //Find top-left and bottom-right Point min = new Point(Double.MAX_VALUE, Double.MAX_VALUE); Point max = new Point(Double.MIN_VALUE, Double.MIN_VALUE); for (Point p : points) { if (p.x < min.x) { min.x = p.x; } if (p.y < min.y) { min.y = p.y; } if (p.x > max.x) { max.x = p.x; } if (p.y > max.y) { max.y = p.y; } } setRect(new Rect(min, max)); }
From source file:org.lasarobotics.vision.detection.objects.Rectangle.java
License:Open Source License
private void setRect(Rect rect) { this.rect = new RotatedRect( new Point(rect.tl().x + rect.size().width / 2, rect.tl().y + rect.size().height / 2), rect.size(), 0.0);/*w w w. java 2 s .com*/ }
From source file:org.lasarobotics.vision.detection.objects.Rectangle.java
License:Open Source License
/** * Transpose this rectangle so that x becomes y and vice versa * * @return Transposed rectangle instance *///from www. j a v a2 s .c o m @SuppressWarnings("SuspiciousNameCombination") public Rectangle transpose() { return new Rectangle(new Point(rect.center.y, rect.center.x), rect.size.height, rect.size.width); }