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);
}
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);
}
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);
}
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());
}
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);
}
Aggregations