Esempio n. 1
0
 public override LearningImage BackProject(LearningImage image)
 {
     int step = FrameIn.Height;
     int height = image.Height * step;
     int width = image.Width * step;
     LearningImage backed = new LearningImage(height, width, image.Plane);
     for (int h = 0; h < height; h++)
     {
         for (int w = 0; w < width; w++)
         {
             var p = image.GetPlane((double)h / (double)step, (double)w / (double)step);
             backed.SetPlane(h, w, p);
         }
     }
     return backed;
 }
        public override LearningImage BackProject(LearningImage i)
        {
            int Scale = this.Scale;
            ListImage li = new ListImage(i.Height * Scale + Height, i.Width * Scale + Width);
            for (int h = 0; h < i.Height; h++)
            {
                for (int w = 0; w < i.Width; w++)
                {
                    LearningImage trimed = i.Trim(new Rectangle(w, h, 1, 1));
                    LearningImage pasting = base.BackProject(trimed);
                    for (int hh = 0; hh < pasting.Height; hh++)
                        for (int ww = 0; ww < pasting.Width; ww++)
                            li.Add(h * Scale + hh, w * Scale + ww, pasting.GetPlane(hh, ww));
                }
            }

            LearningImage o = new LearningImage(i.Height * Scale, i.Width * Scale, this.FrameIn.Plane);
            for (int h = 0; h < o.Height; h++)
                for (int w = 0; w < o.Width; w++)
                    o.SetPlane(h, w, li.Median(h + Height / 2, w + Width / 2));
            return o;
        }
Esempio n. 3
0
 public override LearningImage Project(LearningImage image)
 {
     int step = FrameIn.Height;
     int height = image.Height / step;
     int width = image.Width / step;
     LearningImage projected = new LearningImage(height, width, image.Plane);
     for (int h = 0; h < image.Height; h += step)
     {
         for(int w = 0; w < image.Width; w += step)
         {
             var list = image.GetPlanes(new Rectangle(w, h, step, step));
             var best = list.OrderByDescending(x => x.SpecialEuclidean()).First();
             projected.SetPlane(h / step, w / step, best);
         }
     }
     return projected;
 }