public void setProgress(int i, string XBianVer, windowType type)
        {
            this.progressBar1.Value = i;

            if (type.Equals(windowType.DOWNLOAD))
                label1.Text = "(1/2) Downloading XBian " + XBianVer + "  -  " + i + "%";
            else
                label1.Text = "(2/2) Installing XBian " + XBianVer + " on your SD card  -  " + i + "%";
        }
        //iter = x,y,weight,getNeightbor 1 or 0
        private void createFocalWindowGLCM(int Width, int Height, windowType WindowType, bool horizontal,out List<int[]> iter)
        {
            iter = new List<int[]>();
            int x = 0;
            int y = 0;
            int h = 0;
            int w = Width;
            if (horizontal)
            {
                w = w - 1;
            }
            else
            {
                h = 1;
            }
            switch (WindowType)
            {
                case windowType.CIRCLE:
                    int radius = ((Width - 1) / 2);
                    for (y = h; y < Height; y++)
                    {
                        for (x = 0; x < w; x++)
                        {
                            double cD = Math.Sqrt(Math.Pow((x - radius), 2) + Math.Pow((y - radius), 2));
                            if (cD <= (radius))
                            {
                                int gN = 0;
                                if(horizontal)
                                {
                                    double cDn = Math.Sqrt(Math.Pow(((x+1) - radius), 2) + Math.Pow((y - radius), 2));
                                    if (cDn <= radius)
                                    {
                                        gN = 1;
                                    }

                                }
                                else
                                {
                                    double cDn = Math.Sqrt(Math.Pow((x - radius), 2) + Math.Pow(((y-1) - radius), 2));
                                    if (cDn <= radius)
                                    {
                                        gN = 1;
                                    }
                                }
                                iter.Add(new int[] { x, y, gN });
                            }

                        }
                    }
                    break;
                default:
                    for (y = h; y < Height; y++)
                    {
                        for (x = 0; x < w; x++)
                        {
                            int gN = 0;
                            if (horizontal)
                            {
                                if ((x+1) <= Width-1)
                                {
                                    gN = 1;
                                }

                            }
                            else
                            {
                                if ((y-1) >= 0)
                                {
                                    gN = 1;
                                }
                            }
                            iter.Add(new int[] { x, y, gN });
                        }
                    }
                    break;
            }
            return;
        }
Ejemplo n.º 3
0
 public static string windowTypeStr(windowType wt)
 {
     return(windowTypeT[(int)wt]);
 }
 private int[,] createFocalWindow(int Width, int Height, windowType WindowType,out List<int[]> iter)
 {
     iter = new List<int[]>();
     int[,] xAr = new int[Width, Height];
     int x = 0;
     int y = 0;
     switch (WindowType)
     {
         case windowType.CIRCLE:
             int radius = ((Width - 1) / 2);
             for (y = 0; y < Height; y++)
             {
                 for (x = 0; x < Width; x++)
                 {
                     double cD = Math.Sqrt(Math.Pow((x - radius), 2) + Math.Pow((y - radius), 2));
                     if (cD <= (radius))
                     {
                         xAr[x, y] = 1;
                         iter.Add(new int[] { x, y });
                     }
                     else
                     {
                         xAr[x, y] = 0;
                     }
                 }
             }
             break;
         default:
             for (y = 0; y < Height; y++)
             {
                 for (x = 0; x < Width; x++)
                 {
                     xAr[x, y] = 1;
                     iter.Add(new int[] { x, y });
                 }
             }
             break;
     }
     return xAr;
 }