use of boofcv.core.image.border.ImageBorder_S32 in project BoofCV by lessthanoptimal.
the class TestGradientTwo0 method compareToConvolve_I8.
@Test
public void compareToConvolve_I8() throws NoSuchMethodException {
CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
validator.setTarget(GradientTwo0.class.getMethod("process", GrayU8.class, GrayS16.class, GrayS16.class, ImageBorder_S32.class));
validator.setKernel(0, GradientTwo0.kernelDeriv_I32, true);
validator.setKernel(1, GradientTwo0.kernelDeriv_I32, false);
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.core.image.border.ImageBorder_S32 in project BoofCV by lessthanoptimal.
the class TestHessianFromGradient method hessianSobel_I8.
@Test
public void hessianSobel_I8() throws NoSuchMethodException {
CompareHessianToConvolution validator = new CompareHessianToConvolution();
validator.setTarget(HessianFromGradient.class.getMethod("hessianSobel", GrayS16.class, GrayS16.class, GrayS16.class, GrayS16.class, GrayS16.class, ImageBorder_S32.class));
validator.setKernel(0, GradientSobel.kernelDerivX_I32);
validator.setKernel(1, GradientSobel.kernelDerivY_I32);
GrayS16 derivX = new GrayS16(width, height);
GrayS16 derivY = new GrayS16(width, height);
ImageMiscOps.fillUniform(derivX, rand, -10, 10);
ImageMiscOps.fillUniform(derivY, rand, -10, 10);
GrayS16 derivXX = new GrayS16(width, height);
GrayS16 derivYY = new GrayS16(width, height);
GrayS16 derivXY = new GrayS16(width, height);
validator.compare(derivX, derivY, derivXX, derivYY, derivXY);
}
use of boofcv.core.image.border.ImageBorder_S32 in project BoofCV by lessthanoptimal.
the class TestHessianThree method compareToConvolve_I8.
// @Test
// public void checkInputShape() {
// GenericDerivativeTests.checkImageDimensionValidation(new HessianThree(), 2);
// }
@Test
public void compareToConvolve_I8() throws NoSuchMethodException {
CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
validator.setTarget(HessianThree.class.getMethod("process", GrayU8.class, GrayS16.class, GrayS16.class, GrayS16.class, ImageBorder_S32.class));
validator.setKernel(0, HessianThree.kernelXXYY_I32, true);
validator.setKernel(1, HessianThree.kernelXXYY_I32, false);
validator.setKernel(2, HessianThree.kernelCross_I32);
GrayU8 input = new GrayU8(width, height);
ImageMiscOps.fillUniform(input, rand, 0, 10);
GrayS16 derivXX = new GrayS16(width, height);
GrayS16 derivYY = new GrayS16(width, height);
GrayS16 derivXY = new GrayS16(width, height);
validator.compare(input, derivXX, derivYY, derivXY);
}
use of boofcv.core.image.border.ImageBorder_S32 in project BoofCV by lessthanoptimal.
the class ImplBilinearPixel_S16 method get_border.
public float get_border(float x, float y) {
float xf = (float) Math.floor(x);
float yf = (float) Math.floor(y);
int xt = (int) xf;
int yt = (int) yf;
float ax = x - xf;
float ay = y - yf;
ImageBorder_S32 border = (ImageBorder_S32) this.border;
// (x,y)
float val = (1.0f - ax) * (1.0f - ay) * border.get(xt, yt);
// (x+1,y)
val += ax * (1.0f - ay) * border.get(xt + 1, yt);
// (x+1,y)
;
// (x+1,y+1)
val += ax * ay * border.get(xt + 1, yt + 1);
// (x+1,y+1)
;
// (x,y+1)
val += (1.0f - ax) * ay * border.get(xt, yt + 1);
// (x,y+1)
;
return val;
}
use of boofcv.core.image.border.ImageBorder_S32 in project BoofCV by lessthanoptimal.
the class ImplPolynomialPixel_I method get_border.
public float get_border(float x, float y) {
int xt = (int) Math.floor(x);
int yt = (int) Math.floor(y);
int x0 = xt - M / 2 + offM;
int y0 = yt - M / 2 + offM;
ImageBorder_S32 border = (ImageBorder_S32) this.border;
interp1D.setInput(horiz, horiz.length);
for (int i = 0; i < M; i++) {
for (int j = 0; j < M; j++) {
horiz[j] = border.get(j + x0, i + y0);
}
vert[i] = interp1D.process(x - x0, 0, M - 1);
}
interp1D.setInput(vert, vert.length);
float ret = interp1D.process(y - y0, 0, M - 1);
// because it is fitting polynomials it can go above or below max or min values.
if (ret > max) {
ret = max;
} else if (ret < min) {
ret = min;
}
return ret;
}
Aggregations