use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestPixelMath method testDividePixel.
private void testDividePixel(Method m) throws InvocationTargetException, IllegalAccessException {
Class[] paramTypes = m.getParameterTypes();
ImageGray inputA = GeneralizedImageOps.createSingleBand(paramTypes[0], width, height);
ImageGray inputB = GeneralizedImageOps.createSingleBand(paramTypes[1], width, height);
ImageGray output = GeneralizedImageOps.createSingleBand(paramTypes[2], width, height);
GImageMiscOps.fillUniform(inputA, rand, -20, 20);
GImageMiscOps.fillUniform(inputB, rand, -20, 20);
m.invoke(null, inputA, inputB, output);
GImageGray a = FactoryGImageGray.wrap(inputA);
GImageGray b = FactoryGImageGray.wrap(inputB);
GImageGray o = FactoryGImageGray.wrap(output);
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
assertEquals(a.get(j, i).doubleValue() / b.get(j, i).doubleValue(), o.get(j, i).doubleValue(), 1e-4);
}
}
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestPixelMath method testSqrt.
private void testSqrt(Method m) throws InvocationTargetException, IllegalAccessException {
Class[] paramTypes = m.getParameterTypes();
ImageGray inputA = GeneralizedImageOps.createSingleBand(paramTypes[0], width, height);
ImageGray inputB = GeneralizedImageOps.createSingleBand(paramTypes[1], width, height);
GImageMiscOps.fillUniform(inputA, rand, -20, 20);
GImageMiscOps.fillUniform(inputB, rand, -20, 20);
m.invoke(null, inputA, inputB);
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
double a = GeneralizedImageOps.get(inputA, j, i);
double b = GeneralizedImageOps.get(inputB, j, i);
assertEquals(Math.sqrt(a), b, 1e-4);
}
}
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestPixelMath method testLog.
private void testLog(Method m) throws InvocationTargetException, IllegalAccessException {
Class[] paramTypes = m.getParameterTypes();
ImageGray inputA = GeneralizedImageOps.createSingleBand(paramTypes[0], width, height);
ImageGray inputB = GeneralizedImageOps.createSingleBand(paramTypes[1], width, height);
GImageMiscOps.fillUniform(inputA, rand, -20, 20);
GImageMiscOps.fillUniform(inputB, rand, -20, 20);
m.invoke(null, inputA, inputB);
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
double a = GeneralizedImageOps.get(inputA, j, i);
double b = GeneralizedImageOps.get(inputB, j, i);
assertEquals(Math.log(1 + a), b, 1e-4);
}
}
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestImplIntegralImageOps method block_unsafe.
public void block_unsafe(Method m) throws InvocationTargetException, IllegalAccessException {
Class[] paramType = m.getParameterTypes();
Class inputType = paramType[0];
Class origType = inputType == GrayS32.class ? GrayU8.class : inputType;
ImageGray input = GeneralizedImageOps.createSingleBand(origType, width, height);
ImageGray integral = GeneralizedImageOps.createSingleBand(inputType, width, height);
GImageMiscOps.fill(input, 1);
GIntegralImageOps.transform(input, integral);
double found0 = ((Number) m.invoke(null, integral, 4, 5, 8, 8)).doubleValue();
assertEquals(12, found0, 1e-4f);
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestImplIntegralImageOps method transform.
public void transform(Method m) {
Class[] paramType = m.getParameterTypes();
Class inputType = paramType[0];
Class outputType = paramType[1];
ImageGray input = GeneralizedImageOps.createSingleBand(inputType, width, height);
ImageGray integral = GeneralizedImageOps.createSingleBand(outputType, width, height);
GImageMiscOps.fillUniform(input, rand, 0, 100);
BoofTesting.checkSubImage(this, "checkTransformResults", true, m, input, integral);
}
Aggregations