前面学习了emgucv得安装以及图像类型转换得学习,接下来开始图像基本操作得学习。
1、读取图片;
Image<Bgr, byte> image = new Image<Bgr, byte>("G:\\Emgucv_Project\\image\\dog.jpg");
pictureBox1.Image = image.ToBitmap();
也可以使用openFileDialog来选择打开得图像,代码如下:
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "图像文件(*.png;*.jpg;*.gif;*.bmp)|*.png;*.jpg;*.gif;*.bmp";
if(openFileDialog.ShowDialog()==DialogResult.OK)
{
Image<Bgr, byte> image = new Image<Bgr, byte>(openFileDialog.FileName);
pictureBox1.Image = image.ToBitmap();//在 ImageBox1 控件中显示所创建好的图像
}
同理Bitmap读取也是一样。
Bitmap bt = new Bitmap(open