Search in sources :

Example 76 with Point2D_F64

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

the class DetectPointScaleOriWithNoiseApp method setActiveAlgorithm.

@Override
public synchronized void setActiveAlgorithm(int indexFamily, String name, Object cookie) {
    if (input == null)
        return;
    // corrupt the input image
    corruptPanel.corruptImage(grayImage, corruptImage);
    final InterestPointDetector<T> det = (InterestPointDetector<T>) cookie;
    det.detect(corruptImage);
    render.reset();
    for (int i = 0; i < det.getNumberOfFeatures(); i++) {
        Point2D_F64 p = det.getLocation(i);
        int radius = (int) Math.ceil(det.getRadius(i));
        render.addCircle((int) p.x, (int) p.y, radius);
    }
    SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            ConvertBufferedImage.convertTo(corruptImage, workImage, true);
            Graphics2D g2 = workImage.createGraphics();
            g2.setStroke(new BasicStroke(3));
            render.draw(g2);
            panel.repaint();
        }
    });
}
Also used : InterestPointDetector(boofcv.abst.feature.detect.interest.InterestPointDetector) Point2D_F64(georegression.struct.point.Point2D_F64) FactoryInterestPoint(boofcv.factory.feature.detect.interest.FactoryInterestPoint)

Example 77 with Point2D_F64

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

the class VisualizeHoughPolar method process.

public void process(BufferedImage image) {
    I input = GeneralizedImageOps.createSingleBand(imageType, image.getWidth(), image.getHeight());
    I blur = GeneralizedImageOps.createSingleBand(imageType, image.getWidth(), image.getHeight());
    ConvertBufferedImage.convertFromSingle(image, input, imageType);
    GBlurImageOps.gaussian(input, blur, -1, 2, null);
    DetectLineHoughPolar<I, D> alg = FactoryDetectLineAlgs.houghPolar(new ConfigHoughPolar(5, 10, 2, Math.PI / 180, 25, 10), imageType, derivType);
    List<LineParametric2D_F32> lines = alg.detect(blur);
    ImageLinePanel gui = new ImageLinePanel();
    gui.setBackground(image);
    gui.setLines(lines);
    gui.setPreferredSize(new Dimension(image.getWidth(), image.getHeight()));
    BufferedImage renderedTran = VisualizeImageData.grayMagnitude(alg.getTransform().getTransform(), null, -1);
    BufferedImage renderedBinary = VisualizeBinaryData.renderBinary(alg.getBinary(), false, null);
    // Draw the location of lines onto the magnitude image
    Graphics2D g2 = renderedTran.createGraphics();
    g2.setColor(Color.RED);
    Point2D_F64 location = new Point2D_F64();
    for (LineParametric2D_F32 l : lines) {
        alg.getTransform().lineToCoordinate(l, location);
        int r = 6;
        int w = r * 2 + 1;
        int x = (int) (location.x + 0.5);
        int y = (int) (location.y + 0.5);
        // System.out.println(x+" "+y+"  "+renderedTran.getWidth()+" "+renderedTran.getHeight());
        g2.drawOval(x - r, y - r, w, w);
    }
    ShowImages.showWindow(renderedBinary, "Detected Edges");
    ShowImages.showWindow(renderedTran, "Parameter Space");
    ShowImages.showWindow(gui, "Detected Lines");
}
Also used : ConfigHoughPolar(boofcv.factory.feature.detect.line.ConfigHoughPolar) Point2D_F64(georegression.struct.point.Point2D_F64) ImageLinePanel(boofcv.gui.feature.ImageLinePanel) BufferedImage(java.awt.image.BufferedImage) ConvertBufferedImage(boofcv.io.image.ConvertBufferedImage) LineParametric2D_F32(georegression.struct.line.LineParametric2D_F32)

Example 78 with Point2D_F64

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

the class DdaManagerGeneralPoint method detectFeatures.

@Override
public void detectFeatures(I input, FastQueue<Point2D_F64> locDst, FastQueue<Desc> featDst) {
    // detect features in the image
    detector.detect(input, null);
    describe.setImage(input);
    QueueCorner found = detector.getMaximums();
    // compute descriptors and populate results list
    descriptors.reset();
    locations.reset();
    for (int i = 0; i < found.size; i++) {
        Point2D_I16 p = found.get(i);
        Desc desc = descriptors.grow();
        if (describe.process(p.x, p.y, 0, scale, desc)) {
            Point2D_F64 loc = locations.grow();
            loc.set(p.x, p.y);
            describe.process(loc.x, loc.y, 0, scale, desc);
            featDst.add(desc);
            locDst.add(loc);
        } else {
            descriptors.removeTail();
        }
    }
}
Also used : TupleDesc(boofcv.struct.feature.TupleDesc) Point2D_I16(georegression.struct.point.Point2D_I16) QueueCorner(boofcv.struct.QueueCorner) Point2D_F64(georegression.struct.point.Point2D_F64) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint)

Example 79 with Point2D_F64

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

the class DetectDescribeAssociate method updateTrackState.

/**
 * Update each track's location and description (if configured to do so) mark tracks as being associated.
 */
protected void updateTrackState(FastQueue<AssociatedIndex> matches) {
    // update tracks
    for (int i = 0; i < matches.size; i++) {
        AssociatedIndex indexes = matches.data[i];
        PointTrack track = tracksAll.get(indexes.src);
        Point2D_F64 loc = locDst.data[indexes.dst];
        track.set(loc.x, loc.y);
        tracksActive.add(track);
        // update the description
        if (updateDescription) {
            ((Desc) track.getDescription()).setTo(featDst.get(indexes.dst));
        }
        isAssociated[indexes.src] = true;
    }
}
Also used : TupleDesc(boofcv.struct.feature.TupleDesc) Point2D_F64(georegression.struct.point.Point2D_F64) AssociatedIndex(boofcv.struct.feature.AssociatedIndex)

Example 80 with Point2D_F64

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

the class DetectDescribeAssociateTwoPass method updateTrackLocation.

/**
 * Update each track's location only and not its description.  Update the active list too
 */
protected void updateTrackLocation(FastQueue<AssociatedIndex> matches) {
    tracksActive.clear();
    for (int i = 0; i < matches.size; i++) {
        AssociatedIndex indexes = matches.data[i];
        PointTrack track = tracksAll.get(indexes.src);
        Point2D_F64 loc = locDst.data[indexes.dst];
        track.set(loc.x, loc.y);
        tracksActive.add(track);
    }
    this.matches = matches;
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) 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