Search in sources :

Example 31 with ImageRectangle

use of boofcv.struct.ImageRectangle in project BoofCV by lessthanoptimal.

the class ImplIntegralImageOps method convolveSparse.

public static int convolveSparse(GrayS32 integral, IntegralKernel kernel, int x, int y) {
    int ret = 0;
    int N = kernel.getNumBlocks();
    for (int i = 0; i < N; i++) {
        ImageRectangle r = kernel.blocks[i];
        ret += block_zero(integral, x + r.x0, y + r.y0, x + r.x1, y + r.y1) * kernel.scales[i];
    }
    return ret;
}
Also used : ImageRectangle(boofcv.struct.ImageRectangle)

Example 32 with ImageRectangle

use of boofcv.struct.ImageRectangle in project BoofCV by lessthanoptimal.

the class ImplIntegralImageOps method convolveBorder.

public static void convolveBorder(GrayF64 integral, IntegralKernel kernel, GrayF64 output, int borderX, int borderY) {
    for (int x = 0; x < integral.width; x++) {
        for (int y = 0; y < borderY; y++) {
            double total = 0;
            for (int i = 0; i < kernel.blocks.length; i++) {
                ImageRectangle b = kernel.blocks[i];
                total += block_zero(integral, x + b.x0, y + b.y0, x + b.x1, y + b.y1) * kernel.scales[i];
            }
            output.set(x, y, total);
        }
        for (int y = integral.height - borderY; y < integral.height; y++) {
            double total = 0;
            for (int i = 0; i < kernel.blocks.length; i++) {
                ImageRectangle b = kernel.blocks[i];
                total += block_zero(integral, x + b.x0, y + b.y0, x + b.x1, y + b.y1) * kernel.scales[i];
            }
            output.set(x, y, total);
        }
    }
    int endY = integral.height - borderY;
    for (int y = borderY; y < endY; y++) {
        for (int x = 0; x < borderX; x++) {
            double total = 0;
            for (int i = 0; i < kernel.blocks.length; i++) {
                ImageRectangle b = kernel.blocks[i];
                total += block_zero(integral, x + b.x0, y + b.y0, x + b.x1, y + b.y1) * kernel.scales[i];
            }
            output.set(x, y, total);
        }
        for (int x = integral.width - borderX; x < integral.width; x++) {
            double total = 0;
            for (int i = 0; i < kernel.blocks.length; i++) {
                ImageRectangle b = kernel.blocks[i];
                total += block_zero(integral, x + b.x0, y + b.y0, x + b.x1, y + b.y1) * kernel.scales[i];
            }
            output.set(x, y, total);
        }
    }
}
Also used : ImageRectangle(boofcv.struct.ImageRectangle)

Example 33 with ImageRectangle

use of boofcv.struct.ImageRectangle in project BoofCV by lessthanoptimal.

the class ImplIntegralImageOps method convolveBorder.

public static void convolveBorder(GrayS32 integral, IntegralKernel kernel, GrayS32 output, int borderX, int borderY) {
    for (int x = 0; x < integral.width; x++) {
        for (int y = 0; y < borderY; y++) {
            int total = 0;
            for (int i = 0; i < kernel.blocks.length; i++) {
                ImageRectangle b = kernel.blocks[i];
                total += block_zero(integral, x + b.x0, y + b.y0, x + b.x1, y + b.y1) * kernel.scales[i];
            }
            output.set(x, y, total);
        }
        for (int y = integral.height - borderY; y < integral.height; y++) {
            int total = 0;
            for (int i = 0; i < kernel.blocks.length; i++) {
                ImageRectangle b = kernel.blocks[i];
                total += block_zero(integral, x + b.x0, y + b.y0, x + b.x1, y + b.y1) * kernel.scales[i];
            }
            output.set(x, y, total);
        }
    }
    int endY = integral.height - borderY;
    for (int y = borderY; y < endY; y++) {
        for (int x = 0; x < borderX; x++) {
            int total = 0;
            for (int i = 0; i < kernel.blocks.length; i++) {
                ImageRectangle b = kernel.blocks[i];
                total += block_zero(integral, x + b.x0, y + b.y0, x + b.x1, y + b.y1) * kernel.scales[i];
            }
            output.set(x, y, total);
        }
        for (int x = integral.width - borderX; x < integral.width; x++) {
            int total = 0;
            for (int i = 0; i < kernel.blocks.length; i++) {
                ImageRectangle b = kernel.blocks[i];
                total += block_zero(integral, x + b.x0, y + b.y0, x + b.x1, y + b.y1) * kernel.scales[i];
            }
            output.set(x, y, total);
        }
    }
}
Also used : ImageRectangle(boofcv.struct.ImageRectangle)

Example 34 with ImageRectangle

use of boofcv.struct.ImageRectangle in project BoofCV by lessthanoptimal.

the class ImplIntegralImageOps method convolve.

public static void convolve(GrayF64 integral, IntegralKernel kernel, GrayF64 output) {
    for (int y = 0; y < integral.height; y++) {
        for (int x = 0; x < integral.width; x++) {
            double total = 0;
            for (int i = 0; i < kernel.blocks.length; i++) {
                ImageRectangle b = kernel.blocks[i];
                total += block_zero(integral, x + b.x0, y + b.y0, x + b.x1, y + b.y1) * kernel.scales[i];
            }
            output.set(x, y, total);
        }
    }
}
Also used : ImageRectangle(boofcv.struct.ImageRectangle)

Example 35 with ImageRectangle

use of boofcv.struct.ImageRectangle in project BoofCV by lessthanoptimal.

the class ImplIntegralImageOps method convolveSparse.

public static long convolveSparse(GrayS64 integral, IntegralKernel kernel, int x, int y) {
    long ret = 0;
    int N = kernel.getNumBlocks();
    for (int i = 0; i < N; i++) {
        ImageRectangle r = kernel.blocks[i];
        ret += block_zero(integral, x + r.x0, y + r.y0, x + r.x1, y + r.y1) * kernel.scales[i];
    }
    return ret;
}
Also used : ImageRectangle(boofcv.struct.ImageRectangle)

Aggregations

ImageRectangle (boofcv.struct.ImageRectangle)43 Test (org.junit.Test)15 GrayU8 (boofcv.struct.image.GrayU8)10 IntegralKernel (boofcv.alg.transform.ii.IntegralKernel)3 FactoryGImageGray (boofcv.core.image.FactoryGImageGray)3 GImageGray (boofcv.core.image.GImageGray)3 ImageGray (boofcv.struct.image.ImageGray)3 ImageBorder_S32 (boofcv.core.image.border.ImageBorder_S32)2 Kernel2D_S32 (boofcv.struct.convolve.Kernel2D_S32)2 GrayS32 (boofcv.struct.image.GrayS32)2 Point2D_F32 (georegression.struct.point.Point2D_F32)2 Point2D_F64 (georegression.struct.point.Point2D_F64)2 Point2D_I32 (georegression.struct.point.Point2D_I32)2 Polygon2D_F64 (georegression.struct.shapes.Polygon2D_F64)2 Rectangle2D_F64 (georegression.struct.shapes.Rectangle2D_F64)1 FastQueue (org.ddogleg.struct.FastQueue)1 GrowQueue_F64 (org.ddogleg.struct.GrowQueue_F64)1