Search in sources :

Example 86 with DogArray_I32

use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.

the class ExampleAssociateThreeView method detectFeatures.

/**
 * Detects and saves features in the specified image
 */
public void detectFeatures(GrayU8 gray, int which) {
    DogArray<Point2D_F64> locations = listLocations.get(which);
    DogArray<TupleDesc_F64> features = listFeatures.get(which);
    DogArray_I32 featureSet = listFeatureSets.get(which);
    detDesc.detect(gray);
    for (int i = 0; i < detDesc.getNumberOfFeatures(); i++) {
        Point2D_F64 pixel = detDesc.getLocation(i);
        locations.grow().setTo(pixel.x, pixel.y);
        features.grow().setTo(detDesc.getDescription(i));
        featureSet.add(detDesc.getSet(i));
    }
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Point2D_F64(georegression.struct.point.Point2D_F64) DogArray_I32(org.ddogleg.struct.DogArray_I32) DetectDescribePoint(boofcv.abst.feature.detdesc.DetectDescribePoint)

Example 87 with DogArray_I32

use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.

the class CompareTwoImagePanel method findBestPoints.

private void findBestPoints(int x, int y, List<Point2D_F64> pts, List<Integer> selected) {
    double bestDist = clickDistance * clickDistance;
    DogArray_I32 bestIndexes = new DogArray_I32(20);
    for (int i = 0; i < pts.size(); i++) {
        if (!isValidPoint(i))
            continue;
        Point2D_F64 p = pts.get(i);
        double d = UtilPoint2D_F64.distanceSq(p.x, p.y, x, y);
        if (d < bestDist) {
            bestDist = d;
            bestIndexes.reset();
            bestIndexes.add(i);
        } else if (Math.abs(d - bestDist) < 0.01) {
            bestIndexes.add(i);
        }
    }
    for (int i = 0; i < bestIndexes.size(); i++) {
        selected.add(bestIndexes.get(i));
    }
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) UtilPoint2D_F64(georegression.geometry.UtilPoint2D_F64) DogArray_I32(org.ddogleg.struct.DogArray_I32)

Example 88 with DogArray_I32

use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.

the class SplitMergeLineFitLoop method mergeSegments.

/**
 * Merges lines together if the common corner is close to a common line
 *
 * @return true the list being changed
 */
protected boolean mergeSegments() {
    // See if merging will cause a degenerate case
    if (splits.size() <= 3)
        return false;
    boolean change = false;
    work.reset();
    for (int i = 0; i < splits.size; i++) {
        int start = splits.data[i];
        int end = splits.data[(i + 2) % splits.size];
        if (selectSplitOffset(start, circularDistance(start, end)) < 0) {
            // merge the two lines by not adding it
            change = true;
        } else {
            work.add(splits.data[(i + 1) % splits.size]);
        }
    }
    // swap the two lists
    DogArray_I32 tmp = work;
    work = splits;
    splits = tmp;
    return change;
}
Also used : DogArray_I32(org.ddogleg.struct.DogArray_I32)

Example 89 with DogArray_I32

use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.

the class SplitMergeLineFitLoop method splitSegments.

/**
 * Splits a line in two if there is a point that is too far away
 *
 * @return true for change
 */
protected boolean splitSegments() {
    boolean change = false;
    work.reset();
    for (int i = 0; i < splits.size - 1; i++) {
        change |= checkSplit(change, i, i + 1);
    }
    change |= checkSplit(change, splits.size - 1, 0);
    // swap the two lists
    DogArray_I32 tmp = work;
    work = splits;
    splits = tmp;
    return change;
}
Also used : DogArray_I32(org.ddogleg.struct.DogArray_I32)

Example 90 with DogArray_I32

use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.

the class DetectDescribeAssociateTracker method spawnTracks.

/**
 * Takes the current crop of detected features and makes them the keyframe
 */
public void spawnTracks() {
    // in an undefined state
    if (tracksAll.size == 0) {
        for (int i = 0; i < dstDesc.size; i++) {
            Point2D_F64 loc = dstPixels.get(i);
            addNewTrack(dstSet.get(i), loc.x, loc.y, dstDesc.get(i));
        }
        return;
    }
    // create new tracks from latest unassociated detected features
    DogArray_I32 unassociated = associate.getUnassociatedDestination();
    for (int i = 0; i < unassociated.size; i++) {
        int indexDst = unassociated.get(i);
        Point2D_F64 loc = dstPixels.get(indexDst);
        addNewTrack(dstSet.get(i), loc.x, loc.y, dstDesc.get(indexDst));
    }
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) DogArray_I32(org.ddogleg.struct.DogArray_I32) DetectDescribePoint(boofcv.abst.feature.detdesc.DetectDescribePoint)

Aggregations

DogArray_I32 (org.ddogleg.struct.DogArray_I32)192 Test (org.junit.jupiter.api.Test)73 Point2D_I32 (georegression.struct.point.Point2D_I32)24 ArrayList (java.util.ArrayList)21 Point2D_F64 (georegression.struct.point.Point2D_F64)17 DogArray (org.ddogleg.struct.DogArray)17 TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)15 GrayS32 (boofcv.struct.image.GrayS32)10 VerbosePrint (org.ddogleg.struct.VerbosePrint)7 View (boofcv.alg.structure.PairwiseImageGraph.View)6 AssociatedIndex (boofcv.struct.feature.AssociatedIndex)6 GrayI (boofcv.struct.image.GrayI)5 Point3D_F64 (georegression.struct.point.Point3D_F64)5 GrowArray (pabeles.concurrency.GrowArray)5 DetectDescribePoint (boofcv.abst.feature.detdesc.DetectDescribePoint)4 BTrack (boofcv.alg.sfm.d3.structure.VisOdomBundleAdjustment.BTrack)4 AssociatedTripleIndex (boofcv.struct.feature.AssociatedTripleIndex)4 SceneObservations (boofcv.abst.geo.bundle.SceneObservations)3 SceneWorkingGraph (boofcv.alg.structure.SceneWorkingGraph)3 ConfigAssociateGreedy (boofcv.factory.feature.associate.ConfigAssociateGreedy)3