コード例 #1
0
        public void ContructFrom1dInput_Vertical()
        {
            var kernelLength = Kernels.Short.Sobel.yHorizontal.Length;
            var sY           = new Kernel2D <short>(Kernels.Short.Sobel.yVertical, false, Allocator.Temp);

            sY.Print();
            Assert.AreEqual(1, sY.Width);
            Assert.AreEqual(kernelLength, sY.Height);
            Assert.AreEqual(kernelLength, sY.Weights.Length);
            sY.Dispose();
        }
コード例 #2
0
        public void VerifyGetBounds_SquareKernels(int size, Vector2Int nBound, Vector2Int pBound)
        {
            var count  = size * size;
            var kernel = new Kernel2D <short>(size, size, Allocator.Temp);

            Assert.AreEqual(count, kernel.Weights.Length);

            Debug.Log(kernel.Bounds);
            Assert.AreEqual(nBound, kernel.Bounds.negative);
            Assert.AreEqual(pBound, kernel.Bounds.positive);
            kernel.Dispose();
        }
コード例 #3
0
        public void ContructFrom2dInput()
        {
            var sY = new Kernel2D <short>(Kernels.Short.Sobel.X, Allocator.Temp);

            sY.Print();
            AssertFlatRepresentationValid(Kernels.Short.Sobel.X, sY.Weights);
            sY.Dispose();

            var sX = new Kernel2D <short>(Kernels.Short.Sobel.Y, Allocator.Temp);

            sX.Print();
            AssertFlatRepresentationValid(Kernels.Short.Sobel.Y, sX.Weights);
            sX.Dispose();
        }