Search in sources :

Example 51 with ImageGray

use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.

the class TestImplGradientToEdgeFeatures method direction2.

public void direction2(Method m) throws InvocationTargetException, IllegalAccessException {
    Class derivType = m.getParameterTypes()[0];
    ImageGray derivX = GeneralizedImageOps.createSingleBand(derivType, width, height);
    ImageGray derivY = GeneralizedImageOps.createSingleBand(derivType, width, height);
    GImageMiscOps.fillUniform(derivX, rand, -20, 20);
    GImageMiscOps.fillUniform(derivY, rand, -20, 20);
    GrayF32 angle = new GrayF32(width, height);
    BoofTesting.checkSubImage(this, "direction2", false, m, derivX, derivY, angle);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) ImageGray(boofcv.struct.image.ImageGray)

Example 52 with ImageGray

use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.

the class TestImplGradientToEdgeFeatures method intensityAbs.

public void intensityAbs(Method m) throws InvocationTargetException, IllegalAccessException {
    Class derivType = m.getParameterTypes()[0];
    ImageGray derivX = GeneralizedImageOps.createSingleBand(derivType, width, height);
    ImageGray derivY = GeneralizedImageOps.createSingleBand(derivType, width, height);
    GImageMiscOps.fillUniform(derivX, rand, -20, 20);
    GImageMiscOps.fillUniform(derivY, rand, -20, 20);
    GrayF32 intensity = new GrayF32(width, height);
    BoofTesting.checkSubImage(this, "intensityAbs", false, m, derivX, derivY, intensity);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) ImageGray(boofcv.struct.image.ImageGray)

Example 53 with ImageGray

use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.

the class TestImplGradientToEdgeFeatures method direction.

public void direction(Method m) throws InvocationTargetException, IllegalAccessException {
    Class derivType = m.getParameterTypes()[0];
    ImageGray derivX = GeneralizedImageOps.createSingleBand(derivType, width, height);
    ImageGray derivY = GeneralizedImageOps.createSingleBand(derivType, width, height);
    GImageMiscOps.fillUniform(derivX, rand, -20, 20);
    GImageMiscOps.fillUniform(derivY, rand, -20, 20);
    GrayF32 angle = new GrayF32(width, height);
    BoofTesting.checkSubImage(this, "direction", false, m, derivX, derivY, angle);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) ImageGray(boofcv.struct.image.ImageGray)

Example 54 with ImageGray

use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.

the class TestGHistogramFeatureOps method histogram_sb.

@Test
public void histogram_sb() {
    for (Class type : supported) {
        ImageGray image = GeneralizedImageOps.createSingleBand(type, width, height);
        GImageMiscOps.fillUniform(image, rand, 0, 200);
        TupleDesc_F64 found = new TupleDesc_F64(200);
        TupleDesc_F64 expected = new TupleDesc_F64(200);
        GHistogramFeatureOps.histogram(image, 0, 200, found);
        if (type == GrayF32.class) {
            HistogramFeatureOps.histogram((GrayF32) image, 0, 200, expected);
        } else {
            HistogramFeatureOps.histogram((GrayU8) image, 200, expected);
        }
        assertEquals(0, DescriptorDistance.euclidean(expected, found), 1e-8);
    }
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) ImageGray(boofcv.struct.image.ImageGray) Test(org.junit.Test)

Example 55 with ImageGray

use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.

the class TestGlobalOtsuBinaryFilter method compare.

@Test
public void compare() {
    Class[] imageTypes = new Class[] { GrayU8.class, GrayF32.class };
    for (Class type : imageTypes) {
        ImageGray input = GeneralizedImageOps.createSingleBand(type, 30, 40);
        GrayU8 found = new GrayU8(30, 40);
        GrayU8 expected = new GrayU8(30, 40);
        GImageMiscOps.fillUniform(input, rand, 0, 200);
        GlobalOtsuBinaryFilter alg = new GlobalOtsuBinaryFilter(0, 255, true, ImageType.single(type));
        alg.process(input, found);
        double threshold = GThresholdImageOps.computeOtsu(input, 0, 255);
        GThresholdImageOps.threshold(input, expected, threshold, true);
        BoofTesting.assertEquals(found, expected, 0);
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) GrayU8(boofcv.struct.image.GrayU8) ImageGray(boofcv.struct.image.ImageGray) Test(org.junit.Test)

Aggregations

ImageGray (boofcv.struct.image.ImageGray)110 FactoryGImageGray (boofcv.core.image.FactoryGImageGray)43 GImageGray (boofcv.core.image.GImageGray)43 Test (org.junit.Test)26 GrayF32 (boofcv.struct.image.GrayF32)20 Method (java.lang.reflect.Method)17 GrayU8 (boofcv.struct.image.GrayU8)15 Bitmap (android.graphics.Bitmap)4 ImageBorder_S32 (boofcv.core.image.border.ImageBorder_S32)4 GrayS16 (boofcv.struct.image.GrayS16)4 GrayS32 (boofcv.struct.image.GrayS32)4 Planar (boofcv.struct.image.Planar)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 IntegralKernel (boofcv.alg.transform.ii.IntegralKernel)3 ImageRectangle (boofcv.struct.ImageRectangle)3 FDistort (boofcv.abst.distort.FDistort)2 ImageBorder_F32 (boofcv.core.image.border.ImageBorder_F32)2 FactoryDescribeImageDense (boofcv.factory.feature.dense.FactoryDescribeImageDense)2 Kernel2D_S32 (boofcv.struct.convolve.Kernel2D_S32)2 TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)2