Пример #1
0
        public void clarifySolution(Data.Image image)
        {
            if (swingSharpness == null)
            {
                swingSharpness = new double[image.width(), image.height()];
                for (int x = 0; x < image.width(); x++)
                {
                    for (int y = 0; y < image.height(); y++)
                    {
                        swingSharpness[x, y] = 0;
                    }
                }
                width  = image.width();
                height = image.height();
            }

            List <Data.Point> listPoint   = new List <Data.Point>();
            Bitmap            curentImage = image.image;

            curentImage = changeImage.translateToMonochrome(curentImage);
            matematical.setImage(curentImage);
            for (int x = 0; x < image.width(); x++)
            {
                for (int y = 0; y < image.height(); y++)
                {
                    double gradient = matematical.gradientAtPoint(x, y);
                    if (gradient > swingSharpness[x, y])
                    {
                        listPoint.Add(new Data.Point(x, y));
                        swingSharpness[x, y] = gradient;
                    }
                }
            }
            solution.setValue(listPoint, image);
        }
Пример #2
0
        public void calculateGradientImage(Data.Image image)
        {
            if (swingSharpness == null)
            {
                swingSharpness = new double[image.width(), image.height()];

                /*  for (int x = 0; x < image.width(); x++)
                 *    for (int y = 0; y < image.height(); y++)
                 *        swingSharpness[x, y] = -255;*/
            }

            curentImage = image.image;
            curentImage = changeImage.translateToMonochrome(curentImage);
            matematical.setImage(curentImage);

            /*
             * for (int x = 0; x < image.width(); x++)
             *    for (int y = 0; y < image.height(); y++)
             *    {
             *        double gradient = matematical.gradientAtPoint(x, y);
             *        if (gradient > swingSharpness[x, y])
             *            swingSharpness[x, y] = gradient;
             *    }
             */
            if (step == 0)
            {
                step = (curentImage.Width * curentImage.Height) / 640000;
            }
            Parallel.For(0, 4, calculateGradientImage);
        }
Пример #3
0
 public void addImageAnalysis(Image image)
 {
     matematical3x3.setImage(image.image);
     matematical5x5.setImage(image.image);
     matematical7x7.setImage(image.image);
     foreach (var point in pointAnalysis)
     {
         gradients3x3[point].Add(matematical3x3.gradientAtPoint(point.x, point.y));
         gradients5x5[point].Add(matematical5x5.gradientAtPoint(point.x, point.y));
         gradients7x7[point].Add(matematical7x7.gradientAtPoint(point.x, point.y));
     }
 }