예제 #1
0
        public void MatOfFloatFromArray()
        {
            var array = new float[] { 7, 8, 9 };
            var m     = MatOfFloat.FromArray(array);

            for (int i = 0; i < array.Length; i++)
            {
                Assert.That(m.Get <float>(i), Is.EqualTo(array[i]).Within(1e-6));
            }
        }
예제 #2
0
        public void MatOfFloatFromArray()
        {
            var array = new float[] { 7, 8, 9 };
            var m     = MatOfFloat.FromArray(array);

            var indexer = m.GetIndexer();

            for (int i = 0; i < array.Length; i++)
            {
                Assert.Equal(array[i], m.Get <float>(i), 6);
                Assert.Equal(array[i], indexer[i], 6);
            }
        }
예제 #3
0
        public void MatOfFloatFromRectangularArray()
        {
            var array = new float[, ] {
                { 1, 2 }, { 3, 4 }
            };
            var m = MatOfFloat.FromArray(array);

            var indexer = m.GetIndexer();

            for (int i = 0; i < array.GetLength(0); i++)
            {
                for (int j = 0; j < array.GetLength(1); j++)
                {
                    Assert.Equal(array[i, j], m.Get <float>(i, j), 6);
                    Assert.Equal(array[i, j], indexer[i, j], 6);
                }
            }
        }