Ejemplo n.º 1
0
        private void button22_Click(object sender, EventArgs e)
        {
            //сперва посчитать СВ
            //static public double[] averange_img = null;
            //public static double[,] eigenfaces = null; //[ размерность фотки , число фоток]
            coefficient += 5;
            int counter1 = PCA_for_images.averange_img.GetLength(0);
            int counter2 = PCA_for_images.eigenfaces.GetLength(1);

            double[,] result_img = new double[counter1, 1];

            for (int i = 0; i < counter1; i++)
            {
                result_img[i, 0] = PCA_for_images.averange_img[i] + coefficient * PCA_for_images.eigenfaces[i, num_of_PC];
            }
            Bitmap[] btm = PCA_for_images.ByteToBitmap(result_img);
            pictureBox2.Image = PCA_for_images.ChangeBitmapSize(btm[0], 160, 190);
        }
Ejemplo n.º 2
0
        private void button23_Click(object sender, EventArgs e)
        {
            //сперва посчитать СВ
            int counter1 = PCA_for_images.averange_img.GetLength(0);
            int counter2 = PCA_for_images.eigenfaces.GetLength(1);

            double[,] result_img = new double[counter1, 1];
            double sum;

            for (int i = 0; i < counter1; i++)
            {
                sum = 0;
                for (int j = 0; j < counter2; j++)
                {
                    sum += Math.Abs(PCA_for_images.eigenfaces[i, j]);
                }
                result_img[i, 0] = sum < 127.5 * counter2 ? 255 : 0;  // из-за растяжения у меня ноль на 127,5
            }
            Bitmap[] btm = PCA_for_images.ByteToBitmap(result_img);
            pictureBox3.Image = PCA_for_images.ChangeBitmapSize(btm[0], 160, 190);
        }