Ejemplo n.º 1
0
        public void GetMatrixFromImageNormalTest()
        {
            PCA p = new PCA();

            byte[] matrixArr = new byte[16]
            {
                10, 20, 59, 223,
                24, 80, 99, 31,
                54, 113, 215, 70,
                167, 131, 200, 101
            };

            double[,] expectation = new double[1, 16]
            {
                { 5130, 28982, 0, 0,
                  57147, 18135, 0, 0,
                  20504, 33703, 0, 0,
                  8035, 26056, 0, 0 }
            };

            List <UShortArrayAsImage> img = new List <UShortArrayAsImage>();

            img.Add(new UShortArrayAsImage(matrixArr, 4, 4));

            double[,] imgDoubles = PCA.GetMatrixFromImage(img);

            CollectionAssert.AreEqual(expectation,
                                      imgDoubles,
                                      new Comparer(floatingPointTolerance));
        }