Search in sources :

Example 71 with Point2D_F64

use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.

the class VisOdomQuadPnP method removeUnused.

private void removeUnused(FastQueue<Point2D_F64> loc, FastQueue<TD> desc, boolean[] used, int[] oldToNew) {
    int count = 0;
    for (int i = 0; i < loc.size; i++) {
        if (used[i]) {
            oldToNew[i] = count;
            if (count != i) {
                Point2D_F64 a = loc.data[count];
                loc.data[count] = loc.data[i];
                loc.data[i] = a;
                TD d = desc.data[count];
                desc.data[count] = desc.data[i];
                desc.data[i] = d;
            }
            count++;
        } else {
            oldToNew[i] = -1;
        }
    }
    loc.size = desc.size = count;
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64)

Example 72 with Point2D_F64

use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.

the class CommonDetectCalibrationApp method renderGraph.

protected void renderGraph(Graphics2D g2, double scale) {
    List<List<SquareNode>> graphs = getClusters();
    BasicStroke strokeWide = new BasicStroke(3);
    BasicStroke strokeNarrow = new BasicStroke(2);
    Line2D.Double l = new Line2D.Double();
    g2.setStroke(new BasicStroke(3));
    for (int i = 0; i < graphs.size(); i++) {
        List<SquareNode> graph = graphs.get(i);
        int key = graphs.size() == 1 ? 0 : 255 * i / (graphs.size() - 1);
        int rgb = key << 8 | (255 - key);
        g2.setColor(new Color(rgb));
        List<SquareEdge> edges = new ArrayList<>();
        for (SquareNode n : graph) {
            for (int j = 0; j < n.edges.length; j++) {
                if (n.edges[j] != null && !edges.contains(n.edges[j])) {
                    edges.add(n.edges[j]);
                }
            }
        }
        for (SquareEdge e : edges) {
            Point2D_F64 a = e.a.center;
            Point2D_F64 b = e.b.center;
            l.setLine(a.x * scale, a.y * scale, b.x * scale, b.y * scale);
            g2.setColor(Color.CYAN);
            g2.setStroke(strokeWide);
            g2.draw(l);
            g2.setColor(new Color(rgb));
            g2.setStroke(strokeNarrow);
            g2.draw(l);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) Line2D(java.awt.geom.Line2D) Point2D_F64(georegression.struct.point.Point2D_F64) SquareNode(boofcv.alg.fiducial.calib.squares.SquareNode) SquareEdge(boofcv.alg.fiducial.calib.squares.SquareEdge) ArrayList(java.util.ArrayList) List(java.util.List)

Example 73 with Point2D_F64

use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.

the class CommonDetectCalibrationApp method drawPolygon.

public static void drawPolygon(Polygon2D_F64 polygon, Graphics2D g2, double scale) {
    g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    Line2D.Double l = new Line2D.Double();
    for (int i = 0; i < polygon.size() - 1; i++) {
        Point2D_F64 p0 = polygon.get(i);
        Point2D_F64 p1 = polygon.get(i + 1);
        drawLine(g2, l, p0.x * scale, p0.y * scale, p1.x * scale, p1.y * scale);
    }
    if (polygon.size() > 0) {
        Point2D_F64 p0 = polygon.get(0);
        Point2D_F64 p1 = polygon.get(polygon.size() - 1);
        drawLine(g2, l, p0.x * scale, p0.y * scale, p1.x * scale, p1.y * scale);
    }
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) Line2D(java.awt.geom.Line2D)

Example 74 with Point2D_F64

use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.

the class VideoDetectInterestPoints method updateGUI.

@Override
public void updateGUI(BufferedImage guiImage, T origImage) {
    Graphics2D g2 = guiImage.createGraphics();
    if (orientation != null)
        orientation.setImage(origImage);
    render.reset();
    for (int i = 0; i < detector.getNumberOfFeatures(); i++) {
        Point2D_F64 pt = detector.getLocation(i);
        int radius = (int) Math.round(detector.getRadius(i));
        if (orientation != null) {
            orientation.setObjectRadius(radius);
            double angle = orientation.compute(pt.x, pt.y);
            render.addCircle((int) pt.x, (int) pt.y, radius, Color.red, angle);
        } else {
            render.addCircle((int) pt.x, (int) pt.y, radius);
        }
    }
    render.draw(g2);
    if (panel == null) {
        panel = ShowImages.showWindow(guiImage, "Image Sequence", true);
        addComponent(panel);
    } else {
        panel.setImage(guiImage);
        panel.repaint();
    }
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) FactoryInterestPoint(boofcv.factory.feature.detect.interest.FactoryInterestPoint)

Example 75 with Point2D_F64

use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.

the class CompareConvertedDescriptionsApp method visualize.

public static <TD extends TupleDesc> void visualize(String title, BufferedImage image1, BufferedImage image2, InterestPointDetector<GrayF32> detector, DescribeRegionPoint<GrayF32, TD> describe, ScoreAssociation<TD> scorer) {
    AssociateDescription<TD> assoc = FactoryAssociation.greedy(scorer, Double.MAX_VALUE, false);
    List<Point2D_F64> locationSrc = new ArrayList<>();
    List<Point2D_F64> locationDst = new ArrayList<>();
    GrayF32 input1 = ConvertBufferedImage.convertFrom(image1, (GrayF32) null);
    GrayF32 input2 = ConvertBufferedImage.convertFrom(image2, (GrayF32) null);
    FastQueue<TD> listSrc = describeImage(input1, detector, describe, locationSrc);
    FastQueue<TD> listDst = describeImage(input2, detector, describe, locationDst);
    assoc.setSource(listSrc);
    assoc.setDestination(listDst);
    assoc.associate();
    FastQueue<AssociatedIndex> matches = assoc.getMatches();
    AssociationPanel panel = new AssociationPanel(20);
    panel.setImages(image1, image2);
    panel.setAssociation(locationSrc, locationDst, matches);
    ShowImages.showWindow(panel, title);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Point2D_F64(georegression.struct.point.Point2D_F64) ArrayList(java.util.ArrayList) AssociationPanel(boofcv.gui.feature.AssociationPanel) AssociatedIndex(boofcv.struct.feature.AssociatedIndex)

Aggregations

Point2D_F64 (georegression.struct.point.Point2D_F64)360 Test (org.junit.Test)129 Point3D_F64 (georegression.struct.point.Point3D_F64)85 Se3_F64 (georegression.struct.se.Se3_F64)68 ArrayList (java.util.ArrayList)57 DMatrixRMaj (org.ejml.data.DMatrixRMaj)48 AssociatedPair (boofcv.struct.geo.AssociatedPair)28 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)16 Point2Transform2_F64 (boofcv.struct.distort.Point2Transform2_F64)15 GrayF32 (boofcv.struct.image.GrayF32)13 Vector3D_F64 (georegression.struct.point.Vector3D_F64)13 Polygon2D_F64 (georegression.struct.shapes.Polygon2D_F64)13 Point2D3D (boofcv.struct.geo.Point2D3D)11 GrayU8 (boofcv.struct.image.GrayU8)11 Point2D_I32 (georegression.struct.point.Point2D_I32)11 AssociatedIndex (boofcv.struct.feature.AssociatedIndex)10 EllipseRotated_F64 (georegression.struct.curve.EllipseRotated_F64)9 DescribeRegionPoint (boofcv.abst.feature.describe.DescribeRegionPoint)8 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)8 BufferedImage (java.awt.image.BufferedImage)8