Beispiel #1
0
 // 3 Calculate DCT
 /// <summary>
 /// Calculate images DTC
 /// </summary>
 /// <param name="image">Image to be grayscale</param>
 private static int[,] calculateDCT(Bitmap image)
 {
     int[,] pix = new int[N, N];
     for (int i = 0; i < image.Width; i++)
     {
         for (int j = 0; j < image.Height; j++)
         {
             Color c = image.GetPixel(i, j);
             pix[i, j] = c.R;
         }
     }
     int[,] dtcTemp = DTCUtils.DCT(pix);
     int[,] reDtc   = new int[N_DCT, N_DCT];
     for (int i = 0; i < N_DCT; i++)
     {
         for (int j = 0; j < N_DCT; j++)
         {
             reDtc[i, j] = dtcTemp[i, j];
         }
     }
     return(reDtc);
 }
Beispiel #2
0
        /// <summary>
        /// Calculate the Coefficients
        /// </summary>
        /// <param name="imagePath">imagePath to be calculated</param>
        private static Digest CalculateCoefficients(string imagePath)
        {
            Image image = Image.FromFile(imagePath);

            Bitmap bitmap = ResetImageSize(image, N);

            bitmap = ToGray(bitmap);

            float[,] bitPix = new float[bitmap.Height, bitmap.Width];
            for (int i = 0; i < bitmap.Width; i++)
            {
                for (int j = 0; j < bitmap.Height; j++)
                {
                    Color c = bitmap.GetPixel(i, j);
                    bitPix[j, i] = c.G;
                }
            }

            var projs    = Projections.FindRadonProjections(bitPix, DEFAULT_NUMBER_OF_ANGLES);
            var features = Projections.ComputeFeatureVector(projs);

            return(DTCUtils.ComputeDct(features));
        }