//打开图像处理对话框 private void 图像处理ToolStripMenuItem_Click(object sender, EventArgs e) { imgProcessWin = GenericSingleton <ImageProcess> .CreateInstance(); imgProcessWin.Show(); ShareData.Log = "[msg] 图像处理对话框已打开"; }
//打开立体测量对话框 private void 立体测量ToolStripMenuItem_Click(object sender, EventArgs e) { ShareData.Log = "[msg] 立体测量窗口已打开"; stereoMeasureWin = GenericSingleton <DisparityMeasure> .CreateInstance(); stereoMeasureWin.Show(); }
//打开LogView窗口 private void lOGToolStripMenuItem_Click(object sender, EventArgs e) { logWin = GenericSingleton <LogView> .CreateInstance(); logWin.Show(); ShareData.Log = "[msg] LogView已打开"; }
//选择加载SGBM计算图像 private void ucBtnExt_sgbmLoadImg_BtnClick(object sender, EventArgs e) { //设置标志位 IS_USE_SGBM_FLAG = true; IS_USE_BM_FLAG = false; sgbmImgChooseWin = GenericSingleton <sgbmImgChoose> .CreateInstance(); sgbmImgChooseWin.StartPosition = FormStartPosition.CenterParent; if (sgbmImgChooseWin.ShowDialog() == DialogResult.OK) { //加载显示图像 leftImgpath_sgbm = sgbmImgChooseWin.LeftImgpath; rightImgpath_sgbm = sgbmImgChooseWin.RightImgPath; //读入图像 leftImg_sgbm = Cv2.ImRead(leftImgpath_sgbm, ImreadModes.Color); rightImg_sgbm = Cv2.ImRead(rightImgpath_sgbm, ImreadModes.Color); //图像校正 Cv2.Remap(leftImg_sgbm, leftImg_sgbm_rectify, ShareData.leftMap1, ShareData.leftMap2, InterpolationFlags.Linear); Cv2.Remap(rightImg_sgbm, rightImg_sgbm_rectify, ShareData.rightMap1, ShareData.rightMap2, InterpolationFlags.Linear); //窗体显示校正图像 SGBM_IMG_TYPE_TAG = 1; this.pictureBoxIpl_Img.ImageIpl = leftImg_sgbm_rectify; //释放窗体资源 sgbmImgChooseWin.Close(); } else { ShareData.Log = "[msg] 请选择图片路径"; } }
//打开相机设置选项卡 private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { ShareData.Log = "[msg] Settings窗口已打开"; settingWin = GenericSingleton <Settings> .CreateInstance(); //按照模态窗体方式打开 settingWin.ShowDialog(); }
//加载图像 private void ucBtnExt_load_BtnClick(object sender, EventArgs e) { lloadimg = GenericSingleton <loadimage> .CreateInstance(); if (lloadimg.ShowDialog() == DialogResult.OK) { //获取文件路径 strImgpath = lloadimg.Imgpath; //读取图像 一定要选择校正后的图像 srcImg = Cv2.ImRead(strImgpath, ImreadModes.Color); //备份 srcImg.CopyTo(beifenImg); //显示图像 this.pictureBoxIpl_img.ImageIpl = srcImg; newLog = "[msg] 图像加载成功"; } }