コード例 #1
0
 private void sharpenedLaplacToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (sbm != null)
     {
         int pixel;
         groupBox3.Text                           = "Ảnh qua Sharpened Laplac Filter";
         groupBox4.Text                           = "Histogram của ảnh qua Sharpened Laplac Filter";
         int[,] MaTranAnhGoc                      = cv.ConvertBitmapToMatrixGray(sbm);
         int[,] MaTranAnhQuaLaplacFilter          = SpatialFiltering.LaplacFilter(sbm, cv);
         int[,] MaTranAnhQuaSharpenedLaplacFilter = new int[sbm.Height, sbm.Width];
         for (int i = 0; i < MaTranAnhGoc.GetLength(0) - 2; i++)
         {
             for (int j = 0; j < MaTranAnhGoc.GetLength(1) - 2; j++)
             {
                 pixel = MaTranAnhGoc[i, j] - MaTranAnhQuaLaplacFilter[i, j];
                 if (pixel < 0)
                 {
                     pixel = 0;
                 }
                 else if (pixel > 255)
                 {
                     pixel = 255;
                 }
                 MaTranAnhQuaSharpenedLaplacFilter[i, j] = pixel;
             }
         }
         picBox_AnhDaXuLy.Image = cv.ConvertMatrixToBitmap(MaTranAnhQuaSharpenedLaplacFilter);
         int[] HistogramAnhQuaSharpenedLaplacFilter = cv.ConvertMatrixToHistogram(MaTranAnhQuaSharpenedLaplacFilter);
         mChart.ChartBar(HistogramAnhQuaSharpenedLaplacFilter, zedGraphControl2);
     }
     else
     {
         MessageBox.Show("Vui lòng chọn ảnh", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #2
0
        private void button_spatialFiltering_Click(object sender, EventArgs e)
        {
            string str = comboBox_spatialFiltering.Text;

            // string str2 = comboBox1.Text;
            img_stack.Push(img);
            img = SpatialFiltering.Transform(img, str);
            pictureBox_result.Image = img;
            label_result_size.Text  = img.Width.ToString() + " X " + img.Height.ToString();
            showBand_res(img);
        }
コード例 #3
0
 private void sobelToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (sbm != null)
     {
         groupBox3.Text = "Ảnh qua Sobel Filter";
         groupBox4.Text = "Histogram của ảnh qua Sobel Filter";
         int[,] MaTranAnhQuaSobelFilter = SpatialFiltering.SobelFilter(sbm, cv);
         int[] HistogramAnhQuaSobelFilter = cv.ConvertMatrixToHistogram(MaTranAnhQuaSobelFilter);
         picBox_AnhDaXuLy.Image = cv.ConvertMatrixToBitmap(MaTranAnhQuaSobelFilter);
         mChart.ChartBar(HistogramAnhQuaSobelFilter, zedGraphControl2);
     }
     else
     {
         MessageBox.Show("Vui lòng chọn ảnh", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }