Search in sources :

Example 1 with TupleDesc_S8

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

the class TestTestConvertReal_F64_S8 method createOutput.

@Test
public void createOutput() {
    ConvertReal_F64_S8 alg = new ConvertReal_F64_S8(5);
    TupleDesc_S8 found = alg.createOutput();
    assertTrue(5 == found.value.length);
}
Also used : TupleDesc_S8(boofcv.struct.feature.TupleDesc_S8) Test(org.junit.Test)

Example 2 with TupleDesc_S8

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

the class TestTestConvertReal_F64_S8 method convert.

@Test
public void convert() {
    ConvertReal_F64_S8 alg = new ConvertReal_F64_S8(5);
    TupleDesc_F64 input = new TupleDesc_F64(5);
    input.value = new double[] { -2.5, 3, 20, -243.45 };
    TupleDesc_S8 found = alg.createOutput();
    alg.convert(input, found);
    TupleDesc_S8 expected = alg.createOutput();
    ConvertDescriptors.real(input, expected);
    for (int i = 0; i < 5; i++) {
        assertEquals(expected.value[i], found.value[i]);
    }
}
Also used : TupleDesc_S8(boofcv.struct.feature.TupleDesc_S8) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 3 with TupleDesc_S8

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

the class CompareConvertedDescriptionsApp method main.

public static void main(String[] args) {
    String file1 = UtilIO.pathExample("stitch/kayak_01.jpg");
    String file2 = UtilIO.pathExample("stitch/kayak_02.jpg");
    InterestPointDetector<GrayF32> detector = FactoryInterestPoint.fastHessian(new ConfigFastHessian(1, 10, -1, 2, 9, 4, 4));
    DescribeRegionPoint<GrayF32, TupleDesc_F64> describeA = (DescribeRegionPoint) FactoryDescribeRegionPoint.surfStable(null, GrayF32.class);
    ConvertTupleDesc<TupleDesc_F64, TupleDesc_S8> converter = FactoryConvertTupleDesc.real_F64_S8(describeA.createDescription().size());
    DescribeRegionPoint<GrayF32, TupleDesc_S8> describeB = new DescribeRegionPointConvert<>(describeA, converter);
    ScoreAssociation<TupleDesc_F64> scoreA = FactoryAssociation.scoreSad(TupleDesc_F64.class);
    ScoreAssociation<TupleDesc_S8> scoreB = FactoryAssociation.scoreSad(TupleDesc_S8.class);
    BufferedImage image1 = UtilImageIO.loadImage(file1);
    BufferedImage image2 = UtilImageIO.loadImage(file2);
    visualize("Original", image1, image2, detector, describeA, scoreA);
    visualize("Modified", image1, image2, detector, describeB, scoreB);
    System.out.println("Done");
}
Also used : TupleDesc_S8(boofcv.struct.feature.TupleDesc_S8) ConfigFastHessian(boofcv.abst.feature.detect.interest.ConfigFastHessian) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) FactoryDescribeRegionPoint(boofcv.factory.feature.describe.FactoryDescribeRegionPoint) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint) BufferedImage(java.awt.image.BufferedImage) ConvertBufferedImage(boofcv.io.image.ConvertBufferedImage) DescribeRegionPointConvert(boofcv.abst.feature.describe.DescribeRegionPointConvert) GrayF32(boofcv.struct.image.GrayF32)

Example 4 with TupleDesc_S8

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

the class TestConvertDescriptors method real_F64.

/**
 * General test with a known output
 */
@Test
public void real_F64() {
    TupleDesc_F64 input = new TupleDesc_F64(4);
    input.value = new double[] { 1, -2, 3, -4 };
    TupleDesc_S8 output = new TupleDesc_S8(4);
    ConvertDescriptors.real(input, output);
    assertEquals((int) (1 * 127.0 / 4.0), output.value[0]);
    assertEquals((int) (-2 * 127.0 / 4.0), output.value[1]);
    assertEquals((int) (3 * 127.0 / 4.0), output.value[2]);
    assertEquals((int) (-4 * 127.0 / 4.0), output.value[3]);
}
Also used : TupleDesc_S8(boofcv.struct.feature.TupleDesc_S8) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 5 with TupleDesc_S8

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

the class TestConvertDescriptors method real_F64_zeros.

/**
 * Test pathological case where the input is all zeros
 */
@Test
public void real_F64_zeros() {
    TupleDesc_F64 input = new TupleDesc_F64(4);
    TupleDesc_S8 output = new TupleDesc_S8(4);
    ConvertDescriptors.real(input, output);
    for (int i = 0; i < 4; i++) assertEquals(0, output.value[0]);
}
Also used : TupleDesc_S8(boofcv.struct.feature.TupleDesc_S8) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Aggregations

TupleDesc_S8 (boofcv.struct.feature.TupleDesc_S8)7 Test (org.junit.Test)6 TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)5 GrayF32 (boofcv.struct.image.GrayF32)2 DescribeRegionPoint (boofcv.abst.feature.describe.DescribeRegionPoint)1 DescribeRegionPointConvert (boofcv.abst.feature.describe.DescribeRegionPointConvert)1 ConfigFastHessian (boofcv.abst.feature.detect.interest.ConfigFastHessian)1 FactoryDescribeRegionPoint (boofcv.factory.feature.describe.FactoryDescribeRegionPoint)1 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)1 BufferedImage (java.awt.image.BufferedImage)1