Search in sources :

Example 31 with GImageGray

use of boofcv.core.image.GImageGray in project BoofCV by lessthanoptimal.

the class TestGradientToEdgeFeatures method direction.

public void direction(Method m, ImageGray derivX, ImageGray derivY, GrayF32 direction) throws InvocationTargetException, IllegalAccessException {
    m.invoke(null, derivX, derivY, direction);
    GImageGray a = FactoryGImageGray.wrap(derivX);
    GImageGray b = FactoryGImageGray.wrap(derivY);
    float expected = (float) Math.atan(b.get(1, 2).floatValue() / a.get(1, 2).floatValue());
    assertEquals(expected, direction.get(1, 2), 1e-4);
}
Also used : GImageGray(boofcv.core.image.GImageGray) FactoryGImageGray(boofcv.core.image.FactoryGImageGray)

Example 32 with GImageGray

use of boofcv.core.image.GImageGray in project BoofCV by lessthanoptimal.

the class TestImplHessianBlobIntensity method performDeterminant.

public void performDeterminant(Method m, GrayF32 intensity, ImageGray derivXX, ImageGray derivYY, ImageGray derivXY) throws InvocationTargetException, IllegalAccessException {
    m.invoke(null, intensity, derivXX, derivYY, derivXY);
    GImageGray xx = FactoryGImageGray.wrap(derivXX);
    GImageGray yy = FactoryGImageGray.wrap(derivYY);
    GImageGray xy = FactoryGImageGray.wrap(derivXY);
    float expected = xx.get(5, 6).floatValue() * yy.get(5, 6).floatValue() - xy.get(5, 6).floatValue() * xy.get(5, 6).floatValue();
    assertEquals(expected, intensity.get(5, 6), 1e-4);
}
Also used : FactoryGImageGray(boofcv.core.image.FactoryGImageGray) GImageGray(boofcv.core.image.GImageGray)

Example 33 with GImageGray

use of boofcv.core.image.GImageGray in project BoofCV by lessthanoptimal.

the class TestImplHessianBlobIntensity method performTrace.

public void performTrace(Method m, GrayF32 intensity, ImageGray derivXX, ImageGray derivYY) throws InvocationTargetException, IllegalAccessException {
    m.invoke(null, intensity, derivXX, derivYY);
    GImageGray xx = FactoryGImageGray.wrap(derivXX);
    GImageGray yy = FactoryGImageGray.wrap(derivYY);
    float expected = xx.get(5, 6).floatValue() + yy.get(5, 6).floatValue();
    assertEquals(expected, intensity.get(5, 6), 1e-4);
}
Also used : FactoryGImageGray(boofcv.core.image.FactoryGImageGray) GImageGray(boofcv.core.image.GImageGray)

Example 34 with GImageGray

use of boofcv.core.image.GImageGray in project BoofCV by lessthanoptimal.

the class TestImplMedianSortNaive method trivialTest.

public void trivialTest(Method m, ImageGray _image, ImageGray _found) {
    try {
        m.invoke(null, _image, _found, 1, null);
    } catch (IllegalAccessException | InvocationTargetException e) {
        throw new RuntimeException(e);
    }
    GImageGray found = FactoryGImageGray.wrap(_found);
    assertEquals(5, found.get(1, 1).intValue());
    assertEquals(6, found.get(2, 1).intValue());
    assertEquals(9, found.get(1, 2).intValue());
    assertEquals(10, found.get(2, 2).intValue());
    // check the edges
    assertEquals(4, found.get(0, 0).intValue());
    assertEquals(5, found.get(2, 0).intValue());
    assertEquals(13, found.get(2, 3).intValue());
}
Also used : FactoryGImageGray(boofcv.core.image.FactoryGImageGray) GImageGray(boofcv.core.image.GImageGray) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 35 with GImageGray

use of boofcv.core.image.GImageGray in project BoofCV by lessthanoptimal.

the class TestImplGrayImageOps method brighten.

public void brighten(Method m) throws InvocationTargetException, IllegalAccessException {
    Class[] param = m.getParameterTypes();
    ImageGray input = GeneralizedImageOps.createSingleBand(param[0], width, height);
    ImageGray output = GeneralizedImageOps.createSingleBand(param[0], width, height);
    GImageMiscOps.fill(input, 23);
    m.invoke(null, input, 10, 255, output);
    GImageGray b = FactoryGImageGray.wrap(output);
    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            assertEquals(33, b.get(x, y).doubleValue(), 1e-4);
        }
    }
    // check to see how well it sets the ceiling
    m.invoke(null, input, 240, 255, output);
    assertEquals(255, b.get(5, 6).doubleValue(), 1e-4);
    // check it flooring to zero
    m.invoke(null, input, -50, 255, output);
    assertEquals(0, b.get(5, 6).doubleValue(), 1e-4);
}
Also used : FactoryGImageGray(boofcv.core.image.FactoryGImageGray) GImageGray(boofcv.core.image.GImageGray) FactoryGImageGray(boofcv.core.image.FactoryGImageGray) ImageGray(boofcv.struct.image.ImageGray) GImageGray(boofcv.core.image.GImageGray)

Aggregations

FactoryGImageGray (boofcv.core.image.FactoryGImageGray)35 GImageGray (boofcv.core.image.GImageGray)35 ImageGray (boofcv.struct.image.ImageGray)17 Test (org.junit.Test)5 Bitmap (android.graphics.Bitmap)3 TupleDesc_B (boofcv.struct.feature.TupleDesc_B)2 Point2D_I32 (georegression.struct.point.Point2D_I32)2 IntegralKernel (boofcv.alg.transform.ii.IntegralKernel)1 ImageRectangle (boofcv.struct.ImageRectangle)1 GrayF32 (boofcv.struct.image.GrayF32)1 GrayU8 (boofcv.struct.image.GrayU8)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1