use of boofcv.core.image.GImageMultiBand in project BoofCV by lessthanoptimal.
the class GeneralBilinearPixelMultiChecks method compute.
@Override
protected void compute(T _img, float x, float y, float[] pixel) {
ImageBorder<T> imgB = FactoryImageBorder.wrap(BorderType.EXTENDED, _img);
GImageMultiBand img = FactoryGImageMultiBand.wrap(imgB);
float[] X0Y0 = new float[_img.getNumBands()];
float[] X1Y0 = new float[_img.getNumBands()];
float[] X1Y1 = new float[_img.getNumBands()];
float[] X0Y1 = new float[_img.getNumBands()];
int gX = (int) x;
int gY = (int) y;
img.get(gX, gY, X0Y0);
img.get(gX + 1, gY, X1Y0);
img.get(gX, gY + 1, X0Y1);
img.get(gX + 1, gY + 1, X1Y1);
for (int i = 0; i < _img.getNumBands(); i++) {
float v0 = X0Y0[i];
float v1 = X1Y0[i];
float v2 = X0Y1[i];
float v3 = X1Y1[i];
x %= 1f;
y %= 1f;
float a = 1f - x;
float b = 1f - y;
pixel[i] = a * b * v0 + x * b * v1 + a * y * v2 + x * y * v3;
}
}
Aggregations