imgBox.FunctionalMode = Emgu.CV.UI.ImageBox.FunctionalModeOption.RightClickMenu;
//改变图像显示方式
imgBox.SizeMode = PictureBoxSizeMode.Zoom;
Minimun:鼠标在图像上的任何操作失效
RightClickMenu:仅鼠标右键有效
PanAndZoom:仅鼠标滚轮缩放有效
Everything:鼠标滚轮、左键框选、右键功能均生效。
打开文件并显示
private void btn_loadPicture_Click(object sender, EventArgs e)
{
OpenFileDialog op = new OpenFileDialog();
//op.InitialDirectory = @"C:\Users\Public\Pictures"; //设置默认路径
op.Filter = "jpg图片|*.jpg|jpeg图片|*.jpeg|bmp图片|*.bmp|png图片|*.png|pdf文件|*.pdf";
if (op.ShowDialog() == DialogResult.OK)
{
//Mat scr = new Mat(op.FileName, Emgu.CV.CvEnum.LoadImageType.AnyColor);
Image<Bgr, byte> img = new Image<Bgr, byte>(op.FileName);
imgBox.Image = img;
}
}