use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestImplConvolveBox method createInputParam.
@Override
protected Object[][] createInputParam(Method candidate, Method validation) {
Class[] c = candidate.getParameterTypes();
ImageGray input = GeneralizedImageOps.createSingleBand(c[0], width, height);
ImageGray output = GeneralizedImageOps.createSingleBand(c[1], width, height);
GImageMiscOps.fillUniform(input, rand, 0, 20);
Object[][] ret = new Object[1][];
ret[0] = new Object[] { input, output, kernelRadius };
return ret;
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestImplConvolveBox method compareResults.
@Override
protected void compareResults(Object targetResult, Object[] targetParam, Object validationResult, Object[] validationParam) {
ImageGray expected = (ImageGray) validationParam[2];
ImageGray found = (ImageGray) targetParam[1];
BoofTesting.assertEquals(expected, found, 1e-4);
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestImplAverageDownSample method horizontal_2_to_1.
/**
* Two pixels should be averaged together at a time
*/
@Test
public void horizontal_2_to_1() throws InvocationTargetException, IllegalAccessException {
List<Method> methods = find("horizontal");
for (Method m : methods) {
Class typeSrc = m.getParameterTypes()[0];
Class typeDst = m.getParameterTypes()[1];
ImageGray src = GeneralizedImageOps.createSingleBand(typeSrc, 6, 3);
ImageGray dst = GeneralizedImageOps.createSingleBand(typeDst, 3, 3);
fillHorizontal(src);
m.invoke(null, src, dst);
for (int y = 0; y < src.height; y++) {
assertEquals(0.5f, GeneralizedImageOps.get(dst, 0, y), 1e-4f);
assertEquals(2.5f, GeneralizedImageOps.get(dst, 1, y), 1e-4f);
assertEquals(4.5f, GeneralizedImageOps.get(dst, 2, y), 1e-4f);
}
}
assertEquals(4, methods.size());
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestImplAverageDownSample method horizontal_1_to_1.
/**
* easy case, should be a perfect copy
*/
@Test
public void horizontal_1_to_1() throws InvocationTargetException, IllegalAccessException {
List<Method> methods = find("horizontal");
for (Method m : methods) {
Class typeSrc = m.getParameterTypes()[0];
Class typeDst = m.getParameterTypes()[1];
ImageGray src = GeneralizedImageOps.createSingleBand(typeSrc, 6, 3);
ImageGray dst = GeneralizedImageOps.createSingleBand(typeDst, 6, 3);
fillHorizontal(src);
m.invoke(null, src, dst);
for (int y = 0; y < src.height; y++) {
for (int x = 0; x < src.width; x++) {
double found = GeneralizedImageOps.get(dst, x, y);
assertEquals(x, found, 1e-4f);
}
}
}
assertEquals(4, methods.size());
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestConvolveImageMean method reformatForValidation.
@Override
protected Object[] reformatForValidation(Method m, Object[] targetParam) {
Class<?>[] params = m.getParameterTypes();
int radius = (Integer) targetParam[2];
Object kernel = createTableKernel(params[0], radius);
ImageGray output = (ImageGray) ((ImageGray) targetParam[1]).clone();
return new Object[] { kernel, targetParam[0], output };
}
Aggregations