Search in sources :

Example 1 with InterleavedU8

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

the class TestConvolveNormalizedNaive_IL method convolve.

/**
 * Check it against one specific type to see if the core algorithm is correct
 */
@Test
void convolve() {
    Kernel2D_S32 kernel = FactoryKernel.random2D_I32(7, 3, 0, 20, rand);
    kernel.offset = 1;
    InterleavedU8 input = new InterleavedU8(width, height, numBands);
    ImageMiscOps.fillUniform(input, rand, 0, 50);
    InterleavedU8 output = new InterleavedU8(width, height, numBands);
    ConvolveNormalizedNaive_IL.convolve(kernel, input, output);
    for (int y = 0; y < output.height; y++) {
        for (int x = 0; x < output.width; x++) {
            for (int band = 0; band < numBands; band++) {
                int expected = convolve(x, y, band, kernel, input);
                int found = output.getBand(x, y, band);
                assertEquals(expected, found);
            }
        }
    }
}
Also used : InterleavedU8(boofcv.struct.image.InterleavedU8) Kernel2D_S32(boofcv.struct.convolve.Kernel2D_S32) Test(org.junit.jupiter.api.Test)

Example 2 with InterleavedU8

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

the class TestConvolveNormalizedNaive_IL method horizontal.

/**
 * Check it against one specific type to see if the core algorithm is correct
 */
@Test
void horizontal() {
    Kernel1D_S32 kernel = new Kernel1D_S32(new int[] { 1, 2, 3, 4, 5, 6 }, 6, 4);
    InterleavedU8 input = new InterleavedU8(width, height, numBands);
    ImageMiscOps.fillUniform(input, rand, 0, 50);
    InterleavedU8 output = new InterleavedU8(width, height, numBands);
    ConvolveNormalizedNaive_IL.horizontal(kernel, input, output);
    for (int y = 0; y < output.height; y++) {
        for (int x = 0; x < output.width; x++) {
            for (int band = 0; band < numBands; band++) {
                int expected = horizontal(x, y, band, kernel, input);
                int found = output.getBand(x, y, band);
                assertEquals(expected, found);
            }
        }
    }
}
Also used : Kernel1D_S32(boofcv.struct.convolve.Kernel1D_S32) InterleavedU8(boofcv.struct.image.InterleavedU8) Test(org.junit.jupiter.api.Test)

Example 3 with InterleavedU8

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

the class FilePreviewChooser method loadVideoPreview.

@Nullable
private BufferedImage loadVideoPreview(String path) {
    BufferedImage full = null;
    try {
        SimpleImageSequence<InterleavedU8> sequence = Objects.requireNonNull(DefaultMediaManager.INSTANCE.openVideo(path, ImageType.IL_U8));
        if (sequence.hasNext()) {
            InterleavedU8 frame = sequence.next();
            full = ConvertBufferedImage.convertTo(frame, null, true);
        }
    } catch (RuntimeException ignore) {
    }
    return full;
}
Also used : InterleavedU8(boofcv.struct.image.InterleavedU8) BufferedImage(java.awt.image.BufferedImage) ConvertBufferedImage(boofcv.io.image.ConvertBufferedImage) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with InterleavedU8

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

the class TestConvolveNormalizedNaive_IL method vertical.

/**
 * Check it against one specific type to see if the core algorithm is correct
 */
@Test
void vertical() {
    Kernel1D_S32 kernel = new Kernel1D_S32(new int[] { 1, 2, 3, 4, 5, 6 }, 6, 4);
    InterleavedU8 input = new InterleavedU8(width, height, numBands);
    ImageMiscOps.fillUniform(input, rand, 0, 50);
    InterleavedU8 output = new InterleavedU8(width, height, numBands);
    ConvolveNormalizedNaive_IL.vertical(kernel, input, output);
    for (int y = 0; y < output.height; y++) {
        for (int x = 0; x < output.width; x++) {
            for (int band = 0; band < numBands; band++) {
                int expected = vertical(x, y, band, kernel, input);
                int found = output.getBand(x, y, band);
                assertEquals(expected, found);
            }
        }
    }
}
Also used : Kernel1D_S32(boofcv.struct.convolve.Kernel1D_S32) InterleavedU8(boofcv.struct.image.InterleavedU8) Test(org.junit.jupiter.api.Test)

Example 5 with InterleavedU8

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

the class TestConvolveNormalizedNaive_IL method vertical2_U16_U8.

/**
 * Check it against one specific type to see if the core algorithm is correct
 */
@Test
void vertical2_U16_U8() {
    Kernel1D_S32 kernelY = new Kernel1D_S32(new int[] { 1, 2, 3, 4, 5, 6 }, 6, 4);
    Kernel1D_S32 kernelX = new Kernel1D_S32(new int[] { 4, 2, 1, 4, 3, 6 }, 5, 2);
    InterleavedU16 input = new InterleavedU16(width, height, numBands);
    ImageMiscOps.fillUniform(input, rand, 0, 80);
    InterleavedU8 output = new InterleavedU8(width, height, numBands);
    ConvolveNormalizedNaive_IL.vertical(kernelX, kernelY, input, output);
    InterleavedU8 alt = new InterleavedU8(width, height, numBands);
    ConvolveImageNoBorder.vertical(kernelY, input, alt, kernelX.computeSum() * kernelY.computeSum());
    for (int y = 0; y < output.height; y++) {
        for (int x = 0; x < output.width; x++) {
            for (int band = 0; band < numBands; band++) {
                int expected = vertical2(x, y, band, kernelX, kernelY, input);
                int found = output.getBand(x, y, band);
                assertEquals(expected, found);
            }
        }
    }
}
Also used : Kernel1D_S32(boofcv.struct.convolve.Kernel1D_S32) InterleavedU8(boofcv.struct.image.InterleavedU8) InterleavedU16(boofcv.struct.image.InterleavedU16) Test(org.junit.jupiter.api.Test)

Aggregations

InterleavedU8 (boofcv.struct.image.InterleavedU8)9 Test (org.junit.jupiter.api.Test)6 Kernel1D_S32 (boofcv.struct.convolve.Kernel1D_S32)3 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)2 LookUpImageFilesByIndex (boofcv.io.image.LookUpImageFilesByIndex)2 GrayU8 (boofcv.struct.image.GrayU8)2 PointCloudViewer (boofcv.visualize.PointCloudViewer)2 Point3D_F64 (georegression.struct.point.Point3D_F64)2 DogArray (org.ddogleg.struct.DogArray)2 DogArray_I32 (org.ddogleg.struct.DogArray_I32)2 BoofVerbose (boofcv.BoofVerbose)1 SceneStructureMetric (boofcv.abst.geo.bundle.SceneStructureMetric)1 PointTrack (boofcv.abst.tracker.PointTrack)1 PointTracker (boofcv.abst.tracker.PointTracker)1 PointCloudReader (boofcv.alg.cloud.PointCloudReader)1 LensDistortionBrown (boofcv.alg.distort.brown.LensDistortionBrown)1 BundlePinholeSimplified (boofcv.alg.geo.bundle.cameras.BundlePinholeSimplified)1 ColorizeMultiViewStereoResults (boofcv.alg.mvs.ColorizeMultiViewStereoResults)1 DisparityParameters (boofcv.alg.mvs.DisparityParameters)1 MultiBaselineStereoIndependent (boofcv.alg.mvs.MultiBaselineStereoIndependent)1