Exemplo n.º 1
0
        // 計算Otsu's thresholding
        private void btnOtsu_Click(object sender, EventArgs e)
        {
            pcxAfter = new ImgPcx(pcxGray);
            // Otsu's threshold值
            int threshold = pcxAfter.OtsuThreshold();

            trackBar1.Value   = threshold;
            textBox1.Text     = threshold.ToString();
            pictureBox2.Image = pcxAfter.pcxImg;
            // 顯示SNR值 (到小數後2位)
            textBox2.Text = pcxGray.GetSNR(pcxGray, pcxAfter).ToString("f2");
        }
Exemplo n.º 2
0
        private void FormComponent_Load(object sender, EventArgs e)
        {
            // 先將原圖用Otsu's threshold處理成二值圖
            pcxBinary = new ImgPcx(pcxGray);
            // Otsu's threshold值
            int threshold = pcxBinary.OtsuThreshold();

            pictureBox1.Image = pcxBinary.pcxImg;

            // Connected Component Analysis
            label2.Text      += pcxBinary.Component();
            pictureBox2.Image = pcxBinary.pcxImg;
        }