EMGU - Image的畫面縮放

EMGU其實就是 C#的OPENCV   這篇講解一下畫面怎麼縮放

 

在這之前,讓我安麗一下文章:   EMGU 與 Visual studio 的裝設方法 (範例為 x64 / Release ) 

請先看一下這篇,不過有點舊了到時候再寫改成 4.5版的,也可以自己找找一下 EMGU的文章先瞭解的大鋼

 

目標很簡單,將Image縮放倍率

共兩步驟: 
1. 讀取畫面
2. 畫面縮放

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1. 讀取畫面

private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog filename = new OpenFileDialog();
            if (filename.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = filename.FileName;
                Image<Gray, byte> LoadImage = new Image<Gray, byte>(filename.FileName);
                imageBox1.Image = LoadImage;
                imageBox1.FunctionalMode = ImageBox.FunctionalModeOption.Minimum;
            }
        }

 

 

2. 畫面縮放

private void button_Resize_Click(object sender, EventArgs e)
        {
            
            Image<Gray, byte> LoadImage = new Image<Gray, byte>(textBox1.Text);
            Image<Gray, byte> OutImage = LoadImage.Resize(
                (int)(LoadImage.Width * (double.Parse(textBox_W.Text))),
                (int)(LoadImage.Height * (double.Parse(textBox_H.Text))),
                Inter.Linear) ;

           
            imageBox1.FunctionalMode = ImageBox.FunctionalModeOption.Minimum;

            imageBox1.Image = OutImage;


        }