//constructeur
 public fctcommunes(Bitmap _im1, Bitmap _im2, int t_bloc, int d_fenetre, double _seuil)
 {
     image1 = _im1;
     image2 = _im2;
     a = new UnsafeBitmap(_im1);
     b = new UnsafeBitmap(_im2);
     taille_bloc = t_bloc;
     deplace_fen = d_fenetre;
     he = image1.Height;
     wi = image1.Width;
     seuil = _seuil;
 }
Exemplo n.º 2
0
        public List<bloc> analyse(List<bloc> liste_bloc1,List<bloc>liste_bloc2)
        {
            a= new UnsafeBitmap(image1);
            b= new UnsafeBitmap(image2);
            bloc rst= new bloc();
            List<bloc> resultat= new List<bloc>();
             //   List<bloc> liste_bloc1= new List<bloc>();
             //   List<bloc> liste_bloc2= new List<bloc>();
             //   liste_bloc1= decoupage(image1);
              //  liste_bloc2= decoupage(image2);
            DateTime start = DateTime.Now;
              //  MessageBox.Show(liste_bloc1.Count.ToString());
            a.LockBitmap();
            b.LockBitmap();
            object o = new object();
            zmp(ref liste_bloc1,ref liste_bloc2);

             //   MessageBox.Show(liste_bloc1.Count.ToString());
            AForge.Parallel.For(0, liste_bloc1.Count, delegate(int i)
            //   for(int i=0;i<liste_bloc1.Count;i++)
            {
                rst = diamond_search(liste_bloc1[i]);

                if (lst_contain(liste_bloc1, rst) == true)
                    lock (o)
                    {
                        if ((rst.x != liste_bloc1[i].x) || (rst.y != liste_bloc1[i].y)) //MessageBox.Show("kifkif");
                            resultat.Add(rst);
            //            sad_moyen += SAD(liste_bloc1[i], rst);
              //          compteur_sad++;
                        // MessageBox.Show(SAD(liste_bloc1[i],rst).ToString());
                        //sad_moyen.Add(SAD(liste_bloc1[i], rst));
                    }
            });

              //  sad_moyen = sad_moyen / compteur_sad;
            //);
            a.UnlockBitmap();
            b.UnlockBitmap();
            //fic_ecr.Close();
            //sady.Close();
            //sadt.Close();
               // MessageBox.Show(sad_moyen.Average().ToString());
            TimeSpan dur = DateTime.Now - start;
              //  MessageBox.Show(dur.ToString());
               return resultat;
        }
Exemplo n.º 3
0
        public PSO(Bitmap _im1, Bitmap _im2, int _tBloc, int _fen, int _nbrgen, int _nbpar, double _seuil)
            : base(_im1,_im2,_tBloc,_fen,_seuil)
        {
            im1 = _im1;
            im2 = _im2;
            taille_bloc = _tBloc;
            fenetre = _fen*2;
            nbgen = _nbrgen;
            nbpar = _nbpar;
            a = new UnsafeBitmap(im1);
            b = new UnsafeBitmap(im2);

            h = im1.Height-1;
            w = im1.Width-1;
            c1 = calcul_c1();
            c_max = calcule_cmax(c1);
        }
Exemplo n.º 4
0
 // StreamWriter fich;
 public genetique(Bitmap _im1, Bitmap _im2, int t_bloc, int d_fenetre, int _nbchro, int _nbgen, double _seuil)
     : base(_im1, _im2, t_bloc, d_fenetre, _seuil)
 {
     // //MessageBox.Show(" cv");
        // fich = new StreamWriter(".\\fich.txt");
     image1 = _im1;
     image2 = _im2;
     ima1 = _im1;
     ima2 = _im2;
     h = image1.Height;
     w = image1.Width;
     a = new UnsafeBitmap(image1);
     b = new UnsafeBitmap(image2);
     //a.LockBitmap();
     //b.LockBitmap();
     taille_bloc = t_bloc;
     deplace_fen = d_fenetre;
     nbchro = _nbchro;
     nbgen = _nbgen;
       //  zm = _im1;
      liste_bloc1 = new List<bloc>();
      liste_bloc2 = new List<bloc>();
 }
 //  object proteger_inc;
 //public static double sad_moyen = 0;
 //public static Binding s;
 //public static List<double> li_sad = new List<double>();
 public class_abeilles(int _m, int _e, int _nbe, int _nba, int _nbgen, int _n, Bitmap im1, Bitmap im2, int _fenetre, int _taille_bloc, double _seuil)
     : base(im1, im2, _taille_bloc, _fenetre, _seuil)
 {
     image1 = im1;
     image2 = im2;
     h = image1.Height;
     w = image1.Width;
     m = _m;
     n = _n;
     e = _e;
     nbe = _nbe;
     nba = _nba;
     nbgen = _nbgen;
     fenetre = _fenetre*2;
     taille_bloc = _taille_bloc;
     a = new UnsafeBitmap(im1);
     b = new UnsafeBitmap(im2);
        // seuil = 255;
     //verif = new List<bloc>();
        // zm = im1;
     proteger_abeille = new object();
       //  proteger_inc = new object();
        // s = new Binding("Text", sad_moyen, "abeilles_vacances.class_abeilles.sad_moyen");
 }