use of boofcv.struct.image.GrayS16 in project BoofCV by lessthanoptimal.
the class DerivativeHelperFunctions method processBorderHorizontal.
public static void processBorderHorizontal(GrayU8 orig, GrayS16 deriv, Kernel1D_S32 kernel, ImageBorder_S32 borderType) {
borderType.setImage(orig);
ConvolveJustBorder_General_SB.horizontal(kernel, borderType, deriv);
GrayU8 origSub;
GrayS16 derivSub;
origSub = orig.subimage(0, 0, orig.width, 2, null);
derivSub = deriv.subimage(0, 0, orig.width, 2, null);
ConvolveImageNoBorder.horizontal(kernel, origSub, derivSub);
origSub = orig.subimage(0, orig.height - 2, orig.width, orig.height, null);
derivSub = deriv.subimage(0, orig.height - 2, orig.width, orig.height, null);
ConvolveImageNoBorder.horizontal(kernel, origSub, derivSub);
}
use of boofcv.struct.image.GrayS16 in project BoofCV by lessthanoptimal.
the class DerivativeHelperFunctions method processBorderVertical.
public static void processBorderVertical(GrayU8 orig, GrayS16 deriv, Kernel1D_S32 kernel, ImageBorder_S32 borderType) {
borderType.setImage(orig);
ConvolveJustBorder_General_SB.vertical(kernel, borderType, deriv);
GrayU8 origSub;
GrayS16 derivSub;
origSub = orig.subimage(0, 0, 2, orig.height, null);
derivSub = deriv.subimage(0, 0, 2, orig.height, null);
ConvolveImageNoBorder.vertical(kernel, origSub, derivSub);
origSub = orig.subimage(orig.width - 2, 0, orig.width, orig.height, null);
derivSub = deriv.subimage(orig.width - 2, 0, orig.width, orig.height, null);
ConvolveImageNoBorder.vertical(kernel, origSub, derivSub);
}
use of boofcv.struct.image.GrayS16 in project BoofCV by lessthanoptimal.
the class TestConvolveNormalizedStandardSparse method checkMethod.
private void checkMethod(Method method, int width, int height, int kernelRadius, Random rand) {
GrayU8 seedImage = new GrayU8(width, height);
ImageMiscOps.fillUniform(seedImage, rand, 0, 255);
// creates a floating point image with integer elements
GrayF32 floatImage = new GrayF32(width, height);
ConvertImage.convert(seedImage, floatImage);
GrayS16 shortImage = new GrayS16(width, height);
ConvertImage.convert(seedImage, shortImage);
kernelI32 = FactoryKernelGaussian.gaussian(Kernel1D_S32.class, -1, kernelRadius);
kernelF32 = FactoryKernelGaussian.gaussian(Kernel1D_F32.class, -1, kernelRadius);
boolean isFloatingKernel = method.getParameterTypes()[0] == Kernel1D_F32.class;
Class<?> imageType = method.getParameterTypes()[2];
ImageGray<?> inputImage;
if (imageType == GrayF32.class) {
inputImage = floatImage;
expectedOutput = computeExpected(floatImage);
} else if (imageType == GrayU8.class) {
inputImage = seedImage;
expectedOutput = computeExpected(seedImage);
} else {
inputImage = shortImage;
expectedOutput = computeExpected(shortImage);
}
Object inputKernel = isFloatingKernel ? kernelF32 : kernelI32;
Object inputStorage = isFloatingKernel ? new float[kernelI32.width] : new int[kernelI32.width];
checkResults(method, inputKernel, inputImage, inputStorage);
}
use of boofcv.struct.image.GrayS16 in project BoofCV by lessthanoptimal.
the class TestGradientPrewitt method compareToConvolve_I8.
@Test
public void compareToConvolve_I8() throws NoSuchMethodException {
CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
validator.setTarget(GradientPrewitt.class.getMethod("process", GrayU8.class, GrayS16.class, GrayS16.class, ImageBorder_S32.class));
validator.setKernel(0, GradientPrewitt.kernelDerivX_I32);
validator.setKernel(1, GradientPrewitt.kernelDerivY_I32);
GrayU8 input = new GrayU8(width, height);
ImageMiscOps.fillUniform(input, rand, 0, 10);
GrayS16 derivX = new GrayS16(width, height);
GrayS16 derivY = new GrayS16(width, height);
validator.compare(input, derivX, derivY);
}
use of boofcv.struct.image.GrayS16 in project BoofCV by lessthanoptimal.
the class TestGradientPrewitt method compareToConvolve_I16.
@Test
public void compareToConvolve_I16() throws NoSuchMethodException {
CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
validator.setTarget(GradientPrewitt.class.getMethod("process", GrayS16.class, GrayS16.class, GrayS16.class, ImageBorder_S32.class));
validator.setKernel(0, GradientPrewitt.kernelDerivX_I32);
validator.setKernel(1, GradientPrewitt.kernelDerivY_I32);
GrayS16 input = new GrayS16(width, height);
ImageMiscOps.fillUniform(input, rand, 0, 10);
GrayS16 derivX = new GrayS16(width, height);
GrayS16 derivY = new GrayS16(width, height);
validator.compare(input, derivX, derivY);
}
Aggregations