示例#1
0
        private void btnSoSanh_Click(object sender, EventArgs e)
        {
            var    tapAnh   = LayBitMapChu();
            string path     = "F:/C#/BaiTap1/ChuyenDoiMauAnh/DataImg";
            var    datapath = Directory.GetFiles(path);

            foreach (var item in tapAnh)
            {
                var lb = new LockBitImage(item);

                var sosanh = new CopareImg(lb.GetByteBit());
                lb.UnLockBit();

                foreach (string fileName in datapath)
                {
                    var locbit = new LockBitImage(new Bitmap(fileName));
                    if (sosanh.Compare(locbit.GetByteBit()))
                    {
                        txtText.Text += Path.GetFileName(fileName).Trim().Split('.')[0].Split('-')[0];

                        locbit.UnLockBit();

                        MessageBox.Show("ok");
                        break;
                    }
                    else
                    {
                        locbit.UnLockBit();
                    }
                }
            }
        }
示例#2
0
 //thực hiện khi bấm open
 private void KhoiTaoImg(OpenFileDialog open)
 {
     pictureBox1.Image = Image.FromFile(open.FileName);
     path        = open.FileName;
     lockbit     = new LockBitImage(new Bitmap(path));
     lockbit.Arr = lockbit.GetByteBit();
 }
示例#3
0
 //thực hiện khi bấn xử lý
 private void ThucHienThuatToan()
 {
     foreach (var item in ThuatToan)
     {
         item.ConvertImage(lockbit.Arr);
     }
     ThuatToan = new List <IXuLyAnh>();
     lockbit.SetByteToBitMap(lockbit.Arr);
     listBox1.Items.Clear();
     pictureBox2.Image = lockbit.Bitmap;
     lockbit           = new LockBitImage(new Bitmap(path));
     lockbit.Arr       = lockbit.GetByteBit();
 }