Search in sources :

Example 66 with GrayF32

use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.

the class KernelMath method convertToImage.

public static GrayF32 convertToImage(Kernel2D_F32 kernel) {
    int w = kernel.getWidth();
    GrayF32 ret = new GrayF32(w, w);
    for (int i = 0; i < w; i++) {
        for (int j = 0; j < w; j++) {
            ret.set(j, i, kernel.get(j, i));
        }
    }
    return ret;
}
Also used : GrayF32(boofcv.struct.image.GrayF32)

Example 67 with GrayF32

use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.

the class ImageLocalNormalization method computeOutput.

private void computeOutput(GrayF32 input, float delta, GrayF32 output, GrayF32 adjusted) {
    GrayF32 localMean = (GrayF32) this.localMean;
    GrayF32 localPow2 = (GrayF32) this.localPow2;
    for (int y = 0; y < input.height; y++) {
        int indexIn = y * input.width;
        int indexEnd = indexIn + input.width;
        int indexOut = output.startIndex + y * output.stride;
        while (indexIn < indexEnd) {
            float ave = localMean.data[indexIn];
            float std = (float) Math.sqrt(localPow2.data[indexIn] - ave * ave + delta);
            output.data[indexOut++] = (adjusted.data[indexIn] - ave) / std;
            indexIn++;
        }
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32)

Example 68 with GrayF32

use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.

the class TestPyramidOps method hessian.

@Test
public void hessian() {
    ImageHessian<GrayF32> gradient = FactoryDerivative.hessianThree(GrayF32.class);
    GrayF32[] derivX = new GrayF32[5];
    GrayF32[] derivY = new GrayF32[5];
    GrayF32[] derivXX = new GrayF32[5];
    GrayF32[] derivYY = new GrayF32[5];
    GrayF32[] derivXY = new GrayF32[5];
    for (int i = 0; i < 5; i++) {
        derivX[i] = new GrayF32(20, 30 - i);
        derivY[i] = new GrayF32(20, 30 - i);
        derivXX[i] = new GrayF32(20, 30 - i);
        derivYY[i] = new GrayF32(20, 30 - i);
        derivXY[i] = new GrayF32(20, 30 - i);
        GImageMiscOps.fillUniform(derivX[i], rand, 0, 100);
        GImageMiscOps.fillUniform(derivY[i], rand, 0, 100);
    }
    PyramidOps.hessian(derivX, derivY, gradient, derivXX, derivYY, derivXY);
    for (int i = 0; i < derivX.length; i++) {
        GrayF32 dx = derivX[i];
        GrayF32 dy = derivY[i];
        GrayF32 foundXX = new GrayF32(dx.width, dy.height);
        GrayF32 foundYY = new GrayF32(dx.width, dy.height);
        GrayF32 foundXY = new GrayF32(dx.width, dy.height);
        gradient.process(dx, dy, foundXX, foundYY, foundXY);
        BoofTesting.assertEquals(foundXX, derivXX[i], 1e-4);
        BoofTesting.assertEquals(foundYY, derivYY[i], 1e-4);
        BoofTesting.assertEquals(foundXY, derivXY[i], 1e-4);
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Test(org.junit.Test)

Example 69 with GrayF32

use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.

the class TestUtilWavelet method checkShape_positive.

@Test
public void checkShape_positive() {
    GrayF32 orig = new GrayF32(10, 20);
    GrayF32 transformed = new GrayF32(10, 20);
    UtilWavelet.checkShape(orig, transformed);
    orig = new GrayF32(9, 19);
    UtilWavelet.checkShape(orig, transformed);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Test(org.junit.Test)

Example 70 with GrayF32

use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.

the class TestDerivativeIntegralImage method kernelDerivXX.

@Test
public void kernelDerivXX() {
    GrayF32 orig = new GrayF32(width, height);
    GrayF32 integral = new GrayF32(width, height);
    ImageMiscOps.fillUniform(orig, rand, 0, 20);
    GrayF32 expected = new GrayF32(width, height);
    GrayF32 found = new GrayF32(width, height);
    IntegralImageOps.transform(orig, integral);
    ImageBorder_F32 border = (ImageBorder_F32) FactoryImageBorderAlgs.value(orig, 0);
    for (int i = 1; i <= 5; i += 2) {
        int size = i * 3;
        IntegralKernel kernelI = DerivativeIntegralImage.kernelDerivXX(size, null);
        Kernel2D_F32 kernel = createDerivXX(size);
        ConvolveImage.convolve(kernel, orig, expected, border);
        IntegralImageOps.convolve(integral, kernelI, found);
        BoofTesting.assertEquals(expected, found, 1e-2);
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Kernel2D_F32(boofcv.struct.convolve.Kernel2D_F32) ImageBorder_F32(boofcv.core.image.border.ImageBorder_F32) Test(org.junit.Test)

Aggregations

GrayF32 (boofcv.struct.image.GrayF32)530 Test (org.junit.Test)291 BufferedImage (java.awt.image.BufferedImage)81 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)76 GrayU8 (boofcv.struct.image.GrayU8)49 Planar (boofcv.struct.image.Planar)34 ArrayList (java.util.ArrayList)28 ImageBorder_F32 (boofcv.core.image.border.ImageBorder_F32)20 ImageGray (boofcv.struct.image.ImageGray)20 File (java.io.File)20 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)19 Se3_F64 (georegression.struct.se.Se3_F64)18 TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)17 GrayS8 (boofcv.struct.image.GrayS8)16 ListDisplayPanel (boofcv.gui.ListDisplayPanel)14 PathLabel (boofcv.io.PathLabel)14 Kernel2D_F32 (boofcv.struct.convolve.Kernel2D_F32)13 GrayS16 (boofcv.struct.image.GrayS16)13 GrayS32 (boofcv.struct.image.GrayS32)13 Point2D_F64 (georegression.struct.point.Point2D_F64)13