use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestConvolveImageBox 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 TestConvolveImageBox 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 TestImplEnhanceFilter method sharpenBorder4.
/**
* Compare the sharpen filter to a bounded convolution
*/
@Test
public void sharpenBorder4() {
int numFound = 0;
Method[] methods = ImplEnhanceFilter.class.getMethods();
for (int i = 0; i < methods.length; i++) {
if (methods[i].getName().compareTo("sharpenBorder4") != 0)
continue;
numFound++;
Class imageType = methods[i].getParameterTypes()[0];
ImageGray input = GeneralizedImageOps.createSingleBand(imageType, width, height);
ImageGray output = GeneralizedImageOps.createSingleBand(imageType, width, height);
sharpenBorder4(input, output);
BoofTesting.checkSubImage(this, "sharpenBorder4", true, input, output);
}
assertEquals(2, numFound);
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestImplEnhanceFilter method sharpenBorder4.
public void sharpenBorder4(ImageGray input, ImageGray output) {
ImageGray expected;
GImageMiscOps.fillUniform(input, rand, 0, 10);
if (input.getDataType().isInteger()) {
BoofTesting.callStaticMethod(ImplEnhanceFilter.class, "sharpenBorder4", input, output, 0, 255);
expected = new GrayS16(input.width, input.height);
ImageBorder_S32 border = BoofDefaults.borderDerivative_I32();
border.setImage(input);
ConvolveJustBorder_General_SB.convolve(ImplEnhanceFilter.kernelEnhance4_I32, border, (GrayS16) expected);
GPixelMath.boundImage(expected, 0, 255);
} else {
BoofTesting.callStaticMethod(ImplEnhanceFilter.class, "sharpenBorder4", input, output, 0f, 255f);
expected = new GrayF32(input.width, input.height);
ImageBorder_F32 border = BoofDefaults.borderDerivative_F32();
border.setImage((GrayF32) input);
ConvolveJustBorder_General_SB.convolve(ImplEnhanceFilter.kernelEnhance4_F32, border, (GrayF32) expected);
GPixelMath.boundImage(expected, 0, 255);
}
BoofTesting.assertEquals(expected, output, 1e-5);
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestImplEnhanceFilter method sharpenBorder8.
public void sharpenBorder8(ImageGray input, ImageGray output) {
ImageGray expected;
GImageMiscOps.fillUniform(input, rand, 0, 10);
if (input.getDataType().isInteger()) {
BoofTesting.callStaticMethod(ImplEnhanceFilter.class, "sharpenBorder8", input, output, 0, 255);
expected = new GrayS16(input.width, input.height);
ImageBorder_S32 border = BoofDefaults.borderDerivative_I32();
border.setImage(input);
ConvolveJustBorder_General_SB.convolve(ImplEnhanceFilter.kernelEnhance8_I32, border, (GrayS16) expected);
GPixelMath.boundImage(expected, 0, 255);
} else {
BoofTesting.callStaticMethod(ImplEnhanceFilter.class, "sharpenBorder8", input, output, 0f, 255f);
expected = new GrayF32(input.width, input.height);
ImageBorder_F32 border = BoofDefaults.borderDerivative_F32();
border.setImage((GrayF32) input);
ConvolveJustBorder_General_SB.convolve(ImplEnhanceFilter.kernelEnhance8_F32, border, (GrayF32) expected);
GPixelMath.boundImage(expected, 0, 255);
}
BoofTesting.assertEquals(expected, output, 1e-5);
}
Aggregations