예제 #1
0
        protected override void changeQueue(Pixel p)
        {
            // recalculate the neighbors
            Pixel[] neighbors = p.Neighbors;
            for (int i = 0, l = neighbors.Length; i < l; i++)
            {
                Pixel pixel = neighbors[i];
                if (pixel.Empty)
                {
                    int r = 0, g = 0, b = 0, n = 0
                        ,rsq = 0, gsq = 0, bsq = 0;
                    Pixel[] pixelNeighbors = pixel.Neighbors;
                    for (int j = 0, jl = pixelNeighbors.Length; j < jl; j++)
                    {
                        Pixel nPixel = pixelNeighbors[j];
                        if (!nPixel.Empty)
                        {
                            int nr = (int)nPixel.Color.R
                                , ng = (int)nPixel.Color.G
                                , nb = (int)nPixel.Color.B;

                            r += nr;
                            g += ng;
                            b += nb;
                            n++;

                            rsq += nr * nr;
                            gsq += ng * ng;
                            bsq += nb * nb;
                        }
                    }

                    AvgInfo avg = new AvgInfo
                    {
                        R = r,
                        G = g,
                        B = b,
                        Rsq = rsq,
                        Gsq = gsq,
                        Bsq = bsq,
                        NeighborCount = n
                    };

                    if (pixel.QueueIndex == -1)
                        queue.Add(pixel);
                    queue.Data[pixel.QueueIndex] = avg;
                }
            }
        }
예제 #2
0
 public AnalizeNasosData()
 {
     StayInfo = new AvgInfo();
     RunInfo  = new AvgInfo();
     VInfo    = new AvgInfo();
 }