Ejemplo n.º 1
0
 static void initRun(string path1, string path2)
 {
     loadImages(path1, path2);
     height = image1.Height;
     width  = image1.Width;
     if (image1Local == null)
     {
         storeImagesLocally();
     }
     if (!checkImageSizes())
     {
         return;
     }
     //calc means
     mean1 = calcMean(image1);
     mean2 = calcMean(image2);
 }
Ejemplo n.º 2
0
        static MeanRGB calcMean(Bitmap bitmap)
        {
            int sumR = 0, sumG = 0, sumB = 0;

            for (int i = 0; i < bitmap.Width; i++)
            {
                for (int j = 0; j < bitmap.Height; j++)
                {
                    Color pix = bitmap.GetPixel(i, j);
                    sumR += pix.R;
                    sumG += pix.G;
                    sumB += pix.B;
                }
            }
            //Console.WriteLine("Size:" + bitmap.Height * bitmap.Width);
            int meanR = sumR / (bitmap.Width * bitmap.Height);
            int meanG = sumG / (bitmap.Width * bitmap.Height);
            int meanB = sumB / (bitmap.Width * bitmap.Height);
            //Console.WriteLine("Sums: " + sumR + " " + sumG + " " + sumB);
            //Console.WriteLine("Means: " + meanR + " " + meanG + " " + meanB);
            MeanRGB result = new MeanRGB(meanR, meanG, meanB);

            return(result);
        }
Ejemplo n.º 3
0
 void initMeans()
 {
     mean1 = calcMean(image1);
     mean2 = calcMean(image2);
 }