Search in sources :

Example 1 with GrayS32

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

the class WaveletTransformInt method transform.

@Override
public GrayS32 transform(T original, GrayS32 transformed) {
    if (transformed == null) {
        ImageDimension d = UtilWavelet.transformDimension(original, numLevels);
        transformed = new GrayS32(d.width, d.height);
    }
    temp.reshape(transformed.width, transformed.height);
    copyInput.reshape(original.width, original.height);
    if (original.getDataType().getDataType() == int.class) {
        copyInput.setTo((GrayS32) original);
    } else {
        GConvertImage.convert(original, copyInput);
    }
    WaveletTransformOps.transformN(desc, copyInput, transformed, temp, numLevels);
    return transformed;
}
Also used : ImageDimension(boofcv.struct.image.ImageDimension) GrayS32(boofcv.struct.image.GrayS32)

Example 2 with GrayS32

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

the class TestBinaryImageOps method labelToBinary_individual_indexes.

@Test
public void labelToBinary_individual_indexes() {
    GrayU8 expected = new GrayU8(13, 8);
    expected.data = TEST;
    GrayU8 found = new GrayU8(13, 8);
    GrayS32 input = new GrayS32(13, 8);
    input.data = EXPECTED8;
    BinaryImageOps.labelToBinary(input, found, 3, 2);
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 13; j++) {
            if (input.get(j, i) == 2) {
                assertEquals(1, found.get(j, i));
            } else {
                assertEquals(0, found.get(j, i));
            }
        }
    }
}
Also used : GrayU8(boofcv.struct.image.GrayU8) GrayS32(boofcv.struct.image.GrayS32) Test(org.junit.Test)

Example 3 with GrayS32

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

the class TestBinaryImageOps method labelToBinary.

@Test
public void labelToBinary() {
    GrayU8 expected = new GrayU8(13, 8);
    expected.data = TEST;
    GrayU8 found = new GrayU8(13, 8);
    GrayS32 input = new GrayS32(13, 8);
    input.data = EXPECTED8;
    BinaryImageOps.labelToBinary(input, found);
    BoofTesting.assertEquals(expected, found, 0);
}
Also used : GrayU8(boofcv.struct.image.GrayU8) GrayS32(boofcv.struct.image.GrayS32) Test(org.junit.Test)

Example 4 with GrayS32

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

the class TestBinaryImageOps method contour.

/**
 * Very crude and not exhaustive check of contour
 */
@Test
public void contour() {
    GrayU8 input = new GrayU8(10, 12);
    ImageMiscOps.fillRectangle(input, 1, 2, 3, 4, 5);
    input.set(9, 11, 1);
    GrayS32 output = new GrayS32(10, 12);
    GrayS32 expected = new GrayS32(10, 12);
    ImageMiscOps.fillRectangle(expected, 1, 2, 3, 4, 5);
    expected.set(9, 11, 2);
    List<Contour> found = BinaryImageOps.contour(input, ConnectRule.FOUR, output);
    assertEquals(2, found.size());
    BoofTesting.assertEquals(expected, output, 0);
}
Also used : GrayU8(boofcv.struct.image.GrayU8) GrayS32(boofcv.struct.image.GrayS32) Test(org.junit.Test)

Example 5 with GrayS32

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

the class TestBinaryImageOps method relabel.

@Test
public void relabel() {
    GrayS32 input = new GrayS32(4, 5);
    input.set(0, 0, 1);
    input.set(1, 1, 2);
    input.set(2, 1, 3);
    int[] convert = { 0, 2, 3, 4 };
    BinaryImageOps.relabel(input, convert);
    assertEquals(0, input.get(0, 1));
    assertEquals(2, input.get(0, 0));
    assertEquals(3, input.get(1, 1));
    assertEquals(4, input.get(2, 1));
}
Also used : GrayS32(boofcv.struct.image.GrayS32) Test(org.junit.Test)

Aggregations

GrayS32 (boofcv.struct.image.GrayS32)102 Test (org.junit.Test)79 GrayU8 (boofcv.struct.image.GrayU8)52 GrayF32 (boofcv.struct.image.GrayF32)13 GrowQueue_I32 (org.ddogleg.struct.GrowQueue_I32)10 Point2D_I32 (georegression.struct.point.Point2D_I32)7 FactoryGImageGray (boofcv.core.image.FactoryGImageGray)4 GImageGray (boofcv.core.image.GImageGray)4 ImageGray (boofcv.struct.image.ImageGray)4 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)3 ImageDimension (boofcv.struct.image.ImageDimension)3 BufferedImage (java.awt.image.BufferedImage)3 FastQueue (org.ddogleg.struct.FastQueue)3 WatershedVincentSoille1991 (boofcv.alg.segmentation.watershed.WatershedVincentSoille1991)2 IntegralKernel (boofcv.alg.transform.ii.IntegralKernel)2 ImageBorder_S32 (boofcv.core.image.border.ImageBorder_S32)2 ListDisplayPanel (boofcv.gui.ListDisplayPanel)2 ImageRectangle (boofcv.struct.ImageRectangle)2 PackedSetsPoint2D_I32 (boofcv.struct.PackedSetsPoint2D_I32)2 Kernel2D_S32 (boofcv.struct.convolve.Kernel2D_S32)2