Beispiel #1
0
        public Dictionary <Point, int> getSectionPixels(Point c, Bitmap orginal, int sectionLeng)
        {
            double angle = localDirectionMap.getDirectionForPixel(c.X, c.Y);

            angle = ImageSupporter.restrictAngle(angle);

            Point p = new Point((int)(c.X - Math.Sin(angle) * sectionLeng + 0.5), (int)(c.Y - Math.Cos(angle) * sectionLeng + 0.5));
            Point k = new Point((int)(c.X + Math.Sin(angle) * sectionLeng + 0.5), (int)(c.Y + Math.Cos(angle) * sectionLeng + 0.5));

            if (ImageSupporter.RadianToDegree(angle) > 80 && ImageSupporter.RadianToDegree(angle) < 100)
            {
                double ck = ImageSupporter.RadianToDegree(angle);
            }
            Dictionary <Point, int> section = new Dictionary <Point, int>();

            foreach (var item in ImageSupporter.EnumerateLineNoDiagonalSteps(p.X, p.Y, k.X, k.Y))
            {
                try
                {
                    section.Add(new Point(item.Item1, item.Item2), orginal.GetPixel(item.Item1, item.Item2).R);
                }
                catch (Exception e)
                {
                }
            }


            return(section);
        }