Search in sources :

Example 6 with TupleDesc_F32

use of boofcv.struct.feature.TupleDesc_F32 in project BoofCV by lessthanoptimal.

the class TestConvertTupleDesc_F64_F32 method convert.

@Test
void convert() {
    var alg = new ConvertTupleDesc_F64_F32(5);
    var input = new TupleDesc_F64(5);
    input.data = new double[] { 2.5, 3, 20, -43.45, 2.123 };
    TupleDesc_F32 found = alg.createOutput();
    alg.convert(input, found);
    for (int i = 0; i < 5; i++) {
        assertEquals(input.data[i], found.data[i], UtilEjml.TEST_F32);
    }
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) TupleDesc_F32(boofcv.struct.feature.TupleDesc_F32) Test(org.junit.jupiter.api.Test)

Example 7 with TupleDesc_F32

use of boofcv.struct.feature.TupleDesc_F32 in project BoofCV by lessthanoptimal.

the class TestImplDescribePointPixelRegion_F32 method checkInner.

public void checkInner(GrayF32 image, int c_x, int c_y, int w, int h) {
    ImplDescribePointPixelRegion_F32 alg = new ImplDescribePointPixelRegion_F32(w, h);
    TupleDesc_F32 desc = new TupleDesc_F32(alg.getDescriptorLength());
    alg.setImage(image);
    alg.process(c_x, c_y, desc);
    int index = 0;
    int y0 = c_y - h / 2;
    int x0 = c_x - w / 2;
    for (int y = y0; y < y0 + h; y++) {
        for (int x = x0; x < x0 + w; x++, index++) {
            assertEquals(image.get(x, y), desc.data[index], 1e-4);
        }
    }
}
Also used : TupleDesc_F32(boofcv.struct.feature.TupleDesc_F32)

Example 8 with TupleDesc_F32

use of boofcv.struct.feature.TupleDesc_F32 in project BoofCV by lessthanoptimal.

the class TestSimilarImagesSceneRecognition method createFullyLoaded.

/**
 * Populates internal data structures with a scene. Used when checking contract of accessors
 */
@Override
public <T extends LookUpSimilarImages> T createFullyLoaded() {
    var config = new ConfigSimilarImagesSceneRecognition();
    // Needed to do this because the default assumes a certain number of image features
    config.minimumSimilar.setRelative(0.1, 0.0);
    // Create the algorithm from a factory since it's so much easier
    SimilarImagesSceneRecognition<GrayU8, TupleDesc_F32> alg = FactorySceneReconstruction.createSimilarImages(config, ImageType.SB_U8);
    alg.recognizer = new HelperRecognizer(numViews);
    alg.asscociator = new AssociateDescriptionHashSets<>(new HelperAssociate(numFeaturesPerView));
    alg.imageFeatureStartIndexes.resize(numViews * 2);
    for (int viewIdx = 0; viewIdx < numViews; viewIdx++) {
        for (int i = 0; i < numFeaturesPerView; i++) {
            alg.pixels.append(new Point2D_F64(1, 1));
            // encode the view into the descriptor so that the recognition helper knows which images to return
            TupleDesc_F32 desc = alg.detector.createDescription();
            desc.data[0] = viewIdx;
            alg.descriptions.append(desc);
        }
        alg.imageFeatureStartIndexes.data[viewIdx * 2] = numFeaturesPerView * viewIdx;
        alg.imageFeatureStartIndexes.data[viewIdx * 2 + 1] = numFeaturesPerView;
        alg.imageIDs.add(viewIdx + "");
        alg.imageToIndex.put(viewIdx + "", viewIdx);
    }
    return (T) alg;
}
Also used : TupleDesc_F32(boofcv.struct.feature.TupleDesc_F32) Point2D_F64(georegression.struct.point.Point2D_F64) GrayU8(boofcv.struct.image.GrayU8)

Aggregations

TupleDesc_F32 (boofcv.struct.feature.TupleDesc_F32)8 Test (org.junit.jupiter.api.Test)3 GrayU8 (boofcv.struct.image.GrayU8)2 Point2D_F64 (georegression.struct.point.Point2D_F64)2 Test (org.junit.Test)2 AssociatedIndex (boofcv.struct.feature.AssociatedIndex)1 TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)1 ArrayList (java.util.ArrayList)1 DogArray (org.ddogleg.struct.DogArray)1 DogArray_I32 (org.ddogleg.struct.DogArray_I32)1