示例#1
0
 public void ApplyIndicator(int salidas, List <double[, ]> matricesPeso, List <double[]> vectorUmbrales, int capas, int[] neuronasCapa, string[] FACapa, string FASalida)
 {
     for (int i = 0; i < _nRows; i++)
     {
         for (int j = 0; j < _nColumns; j++)
         {
             Color colorPixel = _originalImage.GetPixel(i, j);
             var   red        = (double)colorPixel.R;
             var   green      = (double)colorPixel.G;
             var   blue       = (double)colorPixel.B;
             var   varIndex   = new double[1] {
                 (green - red) / (green + red - blue)
             };
             var varTruncate = new double[1] {
                 (Math.Truncate(10 * varIndex[0]) / 10)
             };
             GetPercentageByColor(varTruncate[0]);
             if (varTruncate[0] > 1)
             {
                 varTruncate[0] = 1;
             }
             else if (varTruncate[0] < -1)
             {
                 varTruncate[0] = -1;
             }
             else if (double.IsNaN(varTruncate[0]))
             {
                 varTruncate[0] = -1;
             }
             double[] finalColor = _backpropagation.Simular(salidas, varTruncate, matricesPeso, vectorUmbrales, capas, neuronasCapa, FACapa, FASalida);
             string   binary     = "";
             for (int k = 0; k < finalColor.Length; k++)
             {
                 binary += finalColor[k].ToString();
             }
             string hexFinalColor = Conversiones.BinaryStringToHexString(binary);
             _originalImage.SetPixel(i, j, Conversiones.HexToColor(hexFinalColor));
             _progresBar.Value = (100 * i + 1) / (_nRows);
         }
     }
 }