private void button3_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         MessageBox.Show(this, "Every CLUSTER will be in a specific color", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
         label8.Visible = true;
         //System.Threading.Thread.Sleep(20);
         this.Update();
         ReadImage  r    = new ReadImage(@openFileDialog1.FileName);
         double[][] data = r.getData;
         double[][] res;
         bool[][]   mim;
         CLUSTER    c = new CLUSTER(data, clustersNumber, exp, eps);
         if (algoType == 0)
         {
             res = c.ClusterMyDataByC_Mean();
         }
         else
         {
             res = c.clusterByGK(P);
         }
         mim = c.cluster_BY_data();
         //System.
         pictureBox2.BackgroundImage = r.IMAGE.Bitmap;
         UnsafeBitmap temp = new UnsafeBitmap(r.IMAGE.Width, r.IMAGE.Height);
         temp.LockBitmap();
         for (int x = 0; x < mim[0].Length; x++)
         {
             for (int y = 0; y < mim.Length; y++)
             {
                 if (mim[y][x])
                 {
                     temp.SetPixel(x % temp.Width, x / temp.Width, new PixelData(COLORS[y].R, COLORS[y].G, COLORS[y].B));
                     break;
                 }
             }
         }
         pictureBox3.BackgroundImage = temp.Bitmap;
         temp.UnlockBitmap();
         r.IMAGE.UnlockBitmap();
     }
     label8.Visible = false;
 }
        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show(this, "Every group of points which belongs to the same CLUSTER will be in the same color", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            double[][] data = new double[po.Count][];
            double[][] res;
            for (int f = 0; f < data.Length; f++)
            {
                data[f]    = new double[2];
                data[f][0] = po[f].X;
                data[f][1] = po[f].Y;
            }
            CLUSTER c = new CLUSTER(data, clustersNumber, exp, eps);

            if (algoType == 0)
            {
                res = c.ClusterMyDataByC_Mean();
            }
            else
            {
                res = c.clusterByGK(P);
            }
            gr.Clear(Color.WhiteSmoke);
            bool[][] cl = c.cluster_BY_data();
            for (int p = 0; p < data.Length; p++)
            {
                for (int q = 0; q < cl.Length; q++)
                {
                    if (cl[q][p])
                    {
                        gr.FillEllipse(new SolidBrush(COLORS[q]), (float)data[p][0], (float)data[p][1], 4.0f, 4.0f);
                        break;
                    }
                }
            }
            button1.Enabled = false;
            po.Clear();
            ii = 0;
        }