Search in sources :

Example 71 with DogArray_I32

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

the class TestEnhanceImageOps method equalizeLocal.

public void equalizeLocal(GrayI input, GrayI found) {
    GrayI expected = (GrayI) GeneralizedImageOps.createSingleBand(input.getClass(), input.width, input.height);
    GImageMiscOps.fillUniform(input, rand, 0, 9);
    GrowArray<DogArray_I32> workArrays = new GrowArray<>(DogArray_I32::new);
    for (int radius = 1; radius < 11; radius++) {
        BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalNaive", input, radius, histogramLength, expected, workArrays);
        BoofTesting.callStaticMethod(EnhanceImageOps.class, "equalizeLocal", input, radius, found, histogramLength, workArrays);
        BoofTesting.assertEquals(expected, found, 1e-10);
    }
}
Also used : GrowArray(pabeles.concurrency.GrowArray) GrayI(boofcv.struct.image.GrayI) DogArray_I32(org.ddogleg.struct.DogArray_I32)

Example 72 with DogArray_I32

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

the class TestImplEnhanceHistogram method equalizeLocalRow.

public void equalizeLocalRow(GrayI input, GrayI found) {
    GrayI expected = GeneralizedImageOps.createSingleBand(input.getClass(), input.width, input.height);
    GrowArray<DogArray_I32> workArrays = new GrowArray<>(DogArray_I32::new);
    GImageMiscOps.fillUniform(input, rand, 0, 9);
    // check the top row
    for (int radius = 1; radius < 6; radius++) {
        // fill with zeros so it can be tested using checkBorderZero
        GImageMiscOps.fill(found, 0);
        BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalNaive", input, radius, histogramLength, expected, workArrays);
        BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalRow", input, radius, histogramLength, 0, found, workArrays);
        GrayI subExpected = (GrayI) expected.subimage(0, 0, width, radius, null);
        GrayI subFound = (GrayI) found.subimage(0, 0, width, radius, null);
        // check solution
        BoofTesting.assertEquals(subExpected, subFound, 1e-10);
        checkZeroOutsideRows(found, 0, radius);
    }
    // check the bottom row
    for (int radius = 1; radius < 6; radius++) {
        // fill with zeros so it can be tested using checkBorderZero
        GImageMiscOps.fill(found, 0);
        int start = input.height - radius;
        BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalNaive", input, radius, histogramLength, expected, workArrays);
        BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalRow", input, radius, histogramLength, start, found, workArrays);
        GrayI subExpected = (GrayI) expected.subimage(0, start, width, height, null);
        GrayI subFound = (GrayI) found.subimage(0, start, width, height, null);
        // check solution
        BoofTesting.assertEquals(subExpected, subFound, 1e-10);
        checkZeroOutsideRows(found, start, height);
    }
}
Also used : GrowArray(pabeles.concurrency.GrowArray) GrayI(boofcv.struct.image.GrayI) DogArray_I32(org.ddogleg.struct.DogArray_I32)

Example 73 with DogArray_I32

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

the class TestBinaryThinning method findBlackPixels.

private void findBlackPixels(GrayU8 img) {
    DogArray_I32 marked = new DogArray_I32();
    BinaryThinning alg = new BinaryThinning();
    alg.binary = img;
    alg.findOnePixels(marked);
    assertEquals(2, marked.size());
    assertEquals(img.getIndex(4, 1), marked.get(0));
    assertEquals(img.getIndex(2, 3), marked.get(1));
}
Also used : DogArray_I32(org.ddogleg.struct.DogArray_I32)

Example 74 with DogArray_I32

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

the class TestImplCensusTransformInner method sample_IU16.

void sample_IU16(Method m) throws InvocationTargetException, IllegalAccessException {
    Class inputType = m.getParameterTypes()[0];
    ImageGray input = GeneralizedImageOps.createSingleBand(inputType, w, h);
    InterleavedU16 found = new InterleavedU16(w, h, 2);
    InterleavedU16 expected = new InterleavedU16(w, h, 2);
    fillUniform(input);
    DogArray<Point2D_I32> samples5x5 = createSamples(2);
    DogArray_I32 indexes = samplesToIndexes(input, samples5x5);
    m.invoke(null, input, 2, indexes, found);
    CensusNaive.sample(input, samples5x5, expected);
    BoofTesting.assertEqualsInner(expected, found, 0, 2, 2, 2, 2, false);
}
Also used : Point2D_I32(georegression.struct.point.Point2D_I32) DogArray_I32(org.ddogleg.struct.DogArray_I32)

Example 75 with DogArray_I32

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

the class TestImplCensusTransformInner method samplesToIndexes.

public static DogArray_I32 samplesToIndexes(ImageGray input, DogArray<Point2D_I32> samples) {
    DogArray_I32 indexes = new DogArray_I32();
    for (int i = 0; i < samples.size; i++) {
        Point2D_I32 p = samples.get(i);
        indexes.add(p.y * input.stride + p.x);
    }
    return indexes;
}
Also used : Point2D_I32(georegression.struct.point.Point2D_I32) DogArray_I32(org.ddogleg.struct.DogArray_I32)

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