Search in sources :

Example 6 with IntegralKernel

use of boofcv.alg.transform.ii.IntegralKernel in project BoofCV by lessthanoptimal.

the class ImplIntegralImageFeatureIntensity method hessianNaive.

/**
 * Brute force approach which is easy to validate through visual inspection.
 */
public static void hessianNaive(GrayF32 integral, int skip, int size, GrayF32 intensity) {
    final int w = intensity.width;
    final int h = intensity.height;
    // get convolution kernels for the second order derivatives
    IntegralKernel kerXX = DerivativeIntegralImage.kernelDerivXX(size, null);
    IntegralKernel kerYY = DerivativeIntegralImage.kernelDerivYY(size, null);
    IntegralKernel kerXY = DerivativeIntegralImage.kernelDerivXY(size, null);
    float norm = 1.0f / (size * size);
    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w; x++) {
            int xx = x * skip;
            int yy = y * skip;
            computeHessian(integral, intensity, kerXX, kerYY, kerXY, norm, y, yy, x, xx);
        }
    }
}
Also used : IntegralKernel(boofcv.alg.transform.ii.IntegralKernel)

Example 7 with IntegralKernel

use of boofcv.alg.transform.ii.IntegralKernel in project BoofCV by lessthanoptimal.

the class ImplIntegralImageFeatureIntensity method hessianBorder.

/**
 * Only computes the fast hessian along the border using a brute force approach
 */
public static void hessianBorder(GrayS32 integral, int skip, int size, GrayF32 intensity) {
    final int w = intensity.width;
    final int h = intensity.height;
    // get convolution kernels for the second order derivatives
    IntegralKernel kerXX = DerivativeIntegralImage.kernelDerivXX(size, null);
    IntegralKernel kerYY = DerivativeIntegralImage.kernelDerivYY(size, null);
    IntegralKernel kerXY = DerivativeIntegralImage.kernelDerivXY(size, null);
    int radiusFeature = size / 2;
    final int borderOrig = radiusFeature + 1 + (skip - (radiusFeature + 1) % skip);
    final int border = borderOrig / skip;
    float norm = 1.0f / (size * size);
    for (int y = 0; y < h; y++) {
        int yy = y * skip;
        for (int x = 0; x < border; x++) {
            int xx = x * skip;
            computeHessian(integral, intensity, kerXX, kerYY, kerXY, norm, y, yy, x, xx);
        }
        for (int x = w - border; x < w; x++) {
            int xx = x * skip;
            computeHessian(integral, intensity, kerXX, kerYY, kerXY, norm, y, yy, x, xx);
        }
    }
    for (int x = border; x < w - border; x++) {
        int xx = x * skip;
        for (int y = 0; y < border; y++) {
            int yy = y * skip;
            computeHessian(integral, intensity, kerXX, kerYY, kerXY, norm, y, yy, x, xx);
        }
        for (int y = h - border; y < h; y++) {
            int yy = y * skip;
            computeHessian(integral, intensity, kerXX, kerYY, kerXY, norm, y, yy, x, xx);
        }
    }
}
Also used : IntegralKernel(boofcv.alg.transform.ii.IntegralKernel)

Aggregations

IntegralKernel (boofcv.alg.transform.ii.IntegralKernel)7 FactoryGImageGray (boofcv.core.image.FactoryGImageGray)3 GImageGray (boofcv.core.image.GImageGray)3 ImageRectangle (boofcv.struct.ImageRectangle)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 GrayU8 (boofcv.struct.image.GrayU8)2