Example #1
0
        public void ConvolutionWithIdentityKernel_OutputEqualsInput_3x3()
        {
            var kernel      = new Kernel2D <short>(Kernels.Short.Identity3x3);
            var convolution = new Convolution2D <short>(kernel, 1, 1);

            convolution.Convolve(m_InputImage, m_IntermediateImage);
            // TODO - iterate through, check padding ?
            convolution.Dispose();
        }
Example #2
0
        public void ConvolutionWithIdentityKernel_OutputEqualsInput_1x1()
        {
            var kernel      = new Kernel2D <short>(Kernels.Short.Identity1x1);
            var convolution = new Convolution2D <short>(kernel, 1, 0);

            convolution.Convolve(m_InputImage, m_IntermediateImage);
            m_InputImage.Buffer.AssertDeepEqual(m_IntermediateImage.Buffer);
            convolution.Dispose();
        }
Example #3
0
        public void ConvolutionWith_1x1Stride_1x1Pad(int width, int height,
                                                     float[,] kernelInput, float[] input, float[] expectedInput)
        {
            var kernel      = new Kernel2D <float>(kernelInput, Allocator.Temp);
            var convolution = new Convolution2D <float>(kernel, 1, 1);

            var image = new Image <float>(input, width, height, Allocator.Temp);

            var outWidth  = width - convolution.Padding.x * 2;
            var outHeight = height - convolution.Padding.y * 2;
            var expected  = new Image <float>(expectedInput, width, height, Allocator.Temp);
            var output    = new Image <float>(outWidth, outHeight, Allocator.Temp);

            convolution.Convolve(image, output);
            output.Print();

            expected.AssertEqualWithin(output);

            convolution.Dispose();
            image.Dispose();
            output.Dispose();
            expected.Dispose();
        }
 public void Dispose()
 {
     Convolution.Dispose();
     Input.Dispose();
     Output.Dispose();
 }
Example #5
0
 void OnDestroy()
 {
     m_GrayscaleInput.Dispose();
     m_Convolution.Dispose();
 }
 void OnDestroy()
 {
     m_GaussianBlur3x3.Dispose();
     m_Sobel?.Dispose();
 }