| | |
| | | , this.controlsPanel.Size.Height-40); |
| | | processControl.Location |
| | | = new Point(processControl.Size.Width * index, 0); |
| | | if (GlobalVar.dicProcesses[name].GetImage(GlobalVar.dicLayout[i], out _, out HObject RecordImage)) |
| | | if (GlobalVar.dicProcesses[name].GetImage(GlobalVar.dicLayout[i], out _, out HImage RecordImage)) |
| | | { |
| | | dicProcessControls[title].ShowHoImage(RecordImage); |
| | | } |
| | |
| | | dicProcessControls.TryAdd(title, processControl); |
| | | this.controlsPanel.Controls.Add(processControl); |
| | | |
| | | if (GlobalVar.dicProcesses[name].GetImage(GlobalVar.dicLayout[i], out _, out HObject RecordImage)) |
| | | if (GlobalVar.dicProcesses[name].GetImage(GlobalVar.dicLayout[i], out _, out HImage RecordImage)) |
| | | { |
| | | dicProcessControls[title].ShowHoImage(RecordImage); |
| | | } |
| | |
| | | /// 异步显示图片 |
| | | /// </summary> |
| | | /// <param name="ho_image"></param> |
| | | public void ShowHoImage(HObject ho_image) |
| | | public void ShowHoImage(HImage ho_image) |
| | | { |
| | | string str = this.lblTitle.Text; |
| | | UserHSmartWindowControl.hImage = ho_image; |
| | | |
| | | if (this.InvokeRequired) |
| | | { |
| | | this.BeginInvoke(new Action(() => |
| | |
| | | ClearObj(); |
| | | result = Run(out msg); |
| | | |
| | | if (ProcessRunBll.GetImage(_Layout, out _, out HObject RecordImage)) |
| | | if (ProcessRunBll.GetImage(_Layout, out _, out HImage RecordImage)) |
| | | { |
| | | ShowHoImage(RecordImage); |
| | | } |
| | |
| | | ProcessRunBll.LogInfo($"{ProcessRunBll.Name}运行结束,结果为:{msg}" |
| | | , result ? LogInfoType.PASS : LogInfoType.ERROR); |
| | | |
| | | if (ProcessRunBll.GetImage(_Layout, out _, out HObject RecordImage)) |
| | | if (ProcessRunBll.GetImage(_Layout, out _, out HImage RecordImage)) |
| | | { |
| | | ShowHoImage(RecordImage); |
| | | } |
| | |
| | | else |
| | | btn_Run.ButtonType = ReaLTaiizor.Util.HopeButtonType.Danger; |
| | | |
| | | if (ProcessRunBll.GetImage(out _, out HObject RecordImage)) |
| | | if (ProcessRunBll.GetImage(out _, out HImage RecordImage)) |
| | | UserHSmartWindowControl.ShowHoImage(RecordImage); |
| | | } |
| | | |
| | |
| | | LogInfo?.Invoke(string.Format("流程[{0}]运行完成,结果:{1}", this.ProcessRunBll.Name, msg) |
| | | , result ? LogInfoType.PASS : LogInfoType.ERROR); |
| | | |
| | | if (ProcessRunBll.GetImage(out _, out HObject RecordImage)) |
| | | if (ProcessRunBll.GetImage(out _, out HImage RecordImage)) |
| | | UserHSmartWindowControl.ShowHoImage(RecordImage); |
| | | |
| | | if (result) |
| | |
| | | return res; |
| | | } |
| | | |
| | | public bool GetImage(Layout layout, out HImage InputImage, out HObject RecordImage) |
| | | public bool GetImage(Layout layout, out HImage InputImage, out HImage RecordImage) |
| | | { |
| | | InputImage = null; RecordImage = null; |
| | | try |
| | |
| | | else if (o_InputImage != null && o_InputImage is Bitmap) |
| | | { |
| | | //将Mat转换为HObject |
| | | using (HImage ho_RecordImage = TAlgorithm.Bitmap2HObject((Bitmap)o_InputImage)) |
| | | using (HImage ho_RecordImage = TAlgorithm.Bitmap2HImage((Bitmap)o_InputImage)) |
| | | { |
| | | if (ho_RecordImage != null) |
| | | if (ho_RecordImage != null && ho_RecordImage.Key != IntPtr.Zero) |
| | | { |
| | | InputImage = ho_RecordImage.Clone(); |
| | | } |
| | |
| | | else if (o_InputImage != null && o_InputImage is Mat) |
| | | { |
| | | //将Mat转换为HObject |
| | | using (HImage ho_RecordImage = TAlgorithm.Mat2HObject((Mat)o_InputImage)) |
| | | using (HImage ho_RecordImage = TAlgorithm.Mat2HImage((Mat)o_InputImage)) |
| | | { |
| | | if (ho_RecordImage != null) |
| | | if (ho_RecordImage != null && ho_RecordImage.Key != IntPtr.Zero) |
| | | { |
| | | InputImage = ho_RecordImage.Clone(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (InputImage != null && InputImage.IsInitialized()) |
| | | if (InputImage != null && InputImage.Key != IntPtr.Zero && InputImage.IsInitialized()) |
| | | { |
| | | InputImage.GetImageSize(out ho_ImageWidth, out ho_ImageHeight); |
| | | |
| | |
| | | |
| | | if (dicContext.ContainsKey(IndexProcessName)) |
| | | { |
| | | ObjectRecord objectRecord1 = ((IProcess)dicContext[IndexProcessName]).Record; |
| | | if (objectRecord1 != null) |
| | | using (ObjectRecord objectRecord1 = ((IProcess)dicContext[IndexProcessName]).Record) |
| | | { |
| | | objectRecord1.Display(hWindowControl.HalconWindow); |
| | | objectRecord1.Dispose(); |
| | | if (objectRecord1 != null) |
| | | { |
| | | objectRecord1.Display(hWindowControl.HalconWindow); |
| | | objectRecord1.Dispose(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (dicContext.ContainsKey(IndexProcessName)) |
| | | { |
| | | ObjectRecord objectRecord2 = ((IProcess)dicContext[IndexProcessName]).Record; |
| | | if (objectRecord2 != null) |
| | | using (ObjectRecord objectRecord2 = ((IProcess)dicContext[IndexProcessName]).Record) |
| | | { |
| | | objectRecord2.Display(hWindowControl.HalconWindow); |
| | | objectRecord2.Dispose(); |
| | | if (objectRecord2 != null) |
| | | { |
| | | objectRecord2.Display(hWindowControl.HalconWindow); |
| | | objectRecord2.Dispose(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (dicContext.ContainsKey(IndexProcessName)) |
| | | { |
| | | ObjectRecord objectRecord3 = ((IProcess)dicContext[IndexProcessName]).Record; |
| | | if (objectRecord3 != null) |
| | | using (ObjectRecord objectRecord3 = ((IProcess)dicContext[IndexProcessName]).Record) |
| | | { |
| | | objectRecord3.Display(hWindowControl.HalconWindow); |
| | | objectRecord3.Dispose(); |
| | | if (objectRecord3 != null) |
| | | { |
| | | objectRecord3.Display(hWindowControl.HalconWindow); |
| | | objectRecord3.Dispose(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (Result) |
| | | { |
| | | Msg = "运行成功"; |
| | | HOperatorSet.SetColor(hWindowControl.HalconWindow, "green"); |
| | | hWindowControl.HalconWindow.SetColor("green"); |
| | | } |
| | | else |
| | | HOperatorSet.SetColor(hWindowControl.HalconWindow, "red"); |
| | | hWindowControl.HalconWindow.SetColor("red"); |
| | | |
| | | TAlgorithm.DispMsg(Msg, hWindowControl.HalconWindow, Result ? "green" : "red", 0, 0); |
| | | HOperatorSet.DumpWindowImage(out RecordImage, hWindowControl.HalconWindow); |
| | | RecordImage = hWindowControl.HalconWindow.DumpWindowImage(); |
| | | #endregion |
| | | |
| | | return true; |
| | |
| | | /// </summary> |
| | | public double RunTime = 0; |
| | | |
| | | public bool GetImage(Forms.Pages.SettingPage.Layout layout, out HImage InputImage, out HObject RecordImage) |
| | | public bool GetImage(Forms.Pages.SettingPage.Layout layout, out HImage InputImage, out HImage RecordImage) |
| | | { |
| | | return ProcessContext.GetImage(layout, out InputImage, out RecordImage); |
| | | } |
| | | |
| | | public bool GetImage(out HImage InputImage, out HObject RecordImage) |
| | | public bool GetImage(out HImage InputImage, out HImage RecordImage) |
| | | { |
| | | InputImage = null; |
| | | RecordImage = null; |
| | |
| | | } |
| | | // 生成图片并显示到控件中 |
| | | HImage InputImage = null; |
| | | HObject RecordImage = null; |
| | | HImage RecordImage = null; |
| | | |
| | | foreach (var layout in GlobalVar.dicLayout.Values |
| | | .Where(layout => layout.ProcessName == ProcessName) |
| | |
| | | /// </summary> |
| | | public bool bAutoSize = true; |
| | | |
| | | private HObject _hImage = null; |
| | | private HImage _hImage = null; |
| | | /// <summary> |
| | | /// 显示图片(异步) |
| | | /// </summary> |
| | | public HObject hImage |
| | | public HImage hImage |
| | | { |
| | | get |
| | | { |
| | |
| | | /// <param name="ho_image"></param> |
| | | /// <param name="hWindow"></param> |
| | | /// <param name="autoSize"></param> |
| | | public async void ShowHoImageAsync(HObject ho_image, HWindow hWindow, bool autoSize = true) |
| | | public async void ShowHoImageAsync(HImage ho_image, HWindow hWindow, bool autoSize = true) |
| | | { |
| | | if (ho_image == null || !ho_image.IsInitialized()) |
| | | HOperatorSet.ClearWindow(hWindow); |
| | | hWindow.ClearWindow(); |
| | | else |
| | | await ShowImageAsync(hWindow, ho_image, autoSize); |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="ho_image"></param> |
| | | /// <param name="autoSize"></param> |
| | | public void ShowHoImage(HObject ho_image, bool autoSize = true) |
| | | public void ShowHoImage(HImage ho_image, bool autoSize = true) |
| | | { |
| | | _hImage = ho_image; |
| | | HOperatorSet.ClearWindow(hWindowControl.HalconWindow); |
| | | hWindowControl.HalconWindow.ClearWindow(); |
| | | |
| | | if (ho_image == null) |
| | | return; |
| | |
| | | return; |
| | | } |
| | | |
| | | private async Task<bool> ShowImageAsync(HWindow hWindow, HObject ho_image, bool autoSize = true) |
| | | private async Task<bool> ShowImageAsync(HWindow hWindow, HImage ho_image, bool autoSize = true) |
| | | { |
| | | return await Task.Run(() => |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | HOperatorSet.ClearWindow(hWindow); |
| | | hWindow.ClearWindow(); |
| | | } |
| | | catch { return false; } |
| | | return true; |
| | |
| | | |
| | | try |
| | | { |
| | | HOperatorSet.ClearWindow(hWindow); |
| | | hWindow.ClearWindow(); |
| | | |
| | | if (autoSize) |
| | | { |
| | | HOperatorSet.GetImageSize(ho_image, out HTuple imgWidth, out HTuple imgHeight); |
| | | ho_image.GetImageSize(out HTuple imgWidth, out HTuple imgHeight); |
| | | if (imgWidth.Length > 0) |
| | | { |
| | | hWindow.GetWindowExtents(out int winRow, out int winCol, out int winWidth, out int winHeight); |
| | |
| | | } |
| | | } |
| | | |
| | | HOperatorSet.DispObj(ho_image, hWindow); |
| | | hWindow.DispObj(ho_image); |
| | | } |
| | | catch { return false; } |
| | | return true; |
| | |
| | | try |
| | | { |
| | | if (ho_object != null && ho_object.IsInitialized()) |
| | | HOperatorSet.DispObj(ho_object, this.hWindowControl.HalconWindow); |
| | | this.hWindowControl.HalconWindow.DispObj(ho_object); |
| | | } |
| | | catch { } |
| | | } |
| | |
| | | if (ho_object != null && ho_object.IsInitialized()) |
| | | { |
| | | SetColor(color); |
| | | HOperatorSet.DispObj(ho_object, this.hWindowControl.HalconWindow); |
| | | this.hWindowControl.HalconWindow.DispObj(ho_object); |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | { |
| | | string color = result ? "green" : "red"; |
| | | SetColor(color); |
| | | HOperatorSet.DispObj(ho_object, this.hWindowControl.HalconWindow); |
| | | this.hWindowControl.HalconWindow.DispObj(ho_object); |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | |
| | | if (this.color != color) |
| | | { |
| | | HOperatorSet.SetColor(this.hWindowControl.HalconWindow, color); |
| | | this.hWindowControl.HalconWindow.SetColor( color); |
| | | this.color = color; |
| | | } |
| | | } |
| | |
| | | return value; |
| | | } |
| | | |
| | | public static HImage Bitmap2HObject(Bitmap bmp) |
| | | public static HImage Bitmap2HImage(Bitmap bmp) |
| | | { |
| | | BitmapData srcBmpData; |
| | | HImage image = null; |
| | | try |
| | | { |
| | | if (bmp.Tag != null && bmp == null || bmp.Width == 0 || bmp.Height == 0) |
| | | if (bmp.Tag == null || bmp == null || bmp.Width == 0 || bmp.Height == 0) |
| | | { |
| | | image = null; |
| | | return image; |
| | |
| | | } |
| | | } |
| | | |
| | | public static unsafe void HObject2Bitmap(HImage hImage, out Bitmap bmp) |
| | | public static unsafe void HImage2Bitmap(HImage hImage, out Bitmap bmp) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | public static HImage Mat2HObject(Mat mat) |
| | | public static HImage Mat2HImage(Mat mat) |
| | | { |
| | | HImage image = null; |
| | | try |
| | |
| | | return; |
| | | } |
| | | |
| | | if (InputImage is HObject) |
| | | if (InputImage is HImage) |
| | | { |
| | | inputImageHSmartWindowControl.ShowHoImage((HObject)value); |
| | | inputImageHSmartWindowControl.ShowHoImage((HImage)value); |
| | | } |
| | | else if (InputImage is Bitmap) |
| | | { |
| | | using (HImage image = TAlgorithm.Bitmap2HObject((Bitmap)value)) |
| | | using (HImage image = TAlgorithm.Bitmap2HImage((Bitmap)value)) |
| | | { |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | | } |
| | | else if (InputImage is Mat) |
| | | { |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)value)) |
| | | using (HImage image = TAlgorithm.Mat2HImage((Mat)value)) |
| | | { |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | |
| | | stxtInput.Text = Subject.Params.Inputs["输入"].ToString(); |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is HObject) |
| | | inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage); |
| | | inputImageHSmartWindowControl.ShowHoImage((HImage)Subject.InputImage); |
| | | |
| | | Type type = Subject.Params.ROI?.GetType(); |
| | | if (Subject.Params.ROI != null) |
| | |
| | | { |
| | | if (Subject.OutputImage is Mat) |
| | | { |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.OutputImage)) |
| | | using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.OutputImage)) |
| | | { |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | | } |
| | | else if (Subject.OutputImage is Bitmap) |
| | | { |
| | | using (HImage image = TAlgorithm.Bitmap2HObject((Bitmap)Subject.OutputImage)) |
| | | using (HImage image = TAlgorithm.Bitmap2HImage((Bitmap)Subject.OutputImage)) |
| | | { |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | | } |
| | | else if (Subject.OutputImage is HObject) |
| | | else if (Subject.OutputImage is HImage) |
| | | { |
| | | recordImageHSmartWindowControl.ShowHoImage((HObject)Subject.OutputImage); |
| | | recordImageHSmartWindowControl.ShowHoImage((HImage)Subject.OutputImage); |
| | | } |
| | | } |
| | | //先判断子类再判断父类 |
| | |
| | | } |
| | | catch { } |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is HObject) |
| | | inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage); |
| | | if (Subject.InputImage != null && Subject.InputImage is HImage) |
| | | inputImageHSmartWindowControl.ShowHoImage((HImage)Subject.InputImage); |
| | | |
| | | Type type = Subject.Params.ROI?.GetType(); |
| | | if (Subject.Params.ROI != null) |
| | |
| | | UpdataOutputs(); |
| | | imgTabControl.SelectedTab = tabPageRecordImage; |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is HObject) |
| | | if (Subject.InputImage != null && Subject.InputImage is HImage) |
| | | { |
| | | HOperatorSet.GetImageSize((HObject)Subject.InputImage, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage); |
| | | using (HImage hImage = (HImage)Subject.InputImage) |
| | | { |
| | | hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(hImage); |
| | | } |
| | | } |
| | | |
| | | //先判断子类再判断父类 |
| | | if (Subject.Record != null && Subject.Record is MsgRecord msgRecord) |
| | | { |
| | |
| | | dtxtMinCount.Text = Subject.Params.Inputs["MinCount"].ToString(); |
| | | dtxtMaxCount.Text = Subject.Params.Inputs["MaxCount"].ToString(); |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is HObject) |
| | | inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage); |
| | | if (Subject.InputImage != null && Subject.InputImage is HImage) |
| | | { |
| | | using (HImage hImage = (HImage)Subject.InputImage) |
| | | { |
| | | inputImageHSmartWindowControl.ShowHoImage(hImage); |
| | | } |
| | | } |
| | | |
| | | Type type = Subject.Params.ROI?.GetType(); |
| | | if (Subject.Params.ROI != null) |
| | |
| | | UpdataOutputs(); |
| | | imgTabControl.SelectedTab = tabPageRecordImage; |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is HObject) |
| | | if (Subject.InputImage != null && Subject.InputImage is HImage) |
| | | { |
| | | HOperatorSet.GetImageSize((HObject)Subject.InputImage, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage); |
| | | using (HImage hImage= (HImage)Subject.InputImage) |
| | | { |
| | | hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(hImage); |
| | | } |
| | | } |
| | | |
| | | //先判断子类再判断父类 |
| | |
| | | cmbSelect.Text = Subject.Params.Inputs["边缘位置"].ToString(); |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is HObject) |
| | | inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage); |
| | | { |
| | | using (HImage hImage = (HImage)Subject.InputImage) |
| | | { |
| | | //hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | inputImageHSmartWindowControl.ShowHoImage(hImage); |
| | | } |
| | | } |
| | | |
| | | Type type = Subject.Params.ROI?.GetType(); |
| | | if (Subject.Params.ROI != null) |
| | |
| | | UpdataOutputs(); |
| | | imgTabControl.SelectedTab = tabPageRecordImage; |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is HObject) |
| | | if (Subject.InputImage != null && Subject.InputImage is HImage) |
| | | { |
| | | HOperatorSet.GetImageSize((HObject)Subject.InputImage, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage); |
| | | using (HImage hImage = (HImage)Subject.InputImage) |
| | | { |
| | | hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(hImage); |
| | | } |
| | | } |
| | | |
| | | //先判断子类再判断父类 |
| | |
| | | |
| | | inputImageHSmartWindowControl.ClearObj(); |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is HObject) |
| | | inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage); |
| | | if (Subject.InputImage != null && Subject.InputImage is HImage) |
| | | { |
| | | using (HImage hImage = (HImage)Subject.InputImage) |
| | | { |
| | | hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | inputImageHSmartWindowControl.ShowHoImage(hImage); |
| | | } |
| | | } |
| | | |
| | | int hv_Elements = Convert.ToInt16(itxtCaliperCount.Text); |
| | | double hv_DetectHeight = Convert.ToDouble(dtxtCaliperHeight.Text); |
| | |
| | | } |
| | | } |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is HObject) |
| | | inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage); |
| | | if (Subject.InputImage != null && Subject.InputImage is HImage) |
| | | { |
| | | using (HImage hImage = (HImage)Subject.InputImage) |
| | | { |
| | | hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | inputImageHSmartWindowControl.ShowHoImage(hImage); |
| | | } |
| | | |
| | | } |
| | | Type type = Subject.Params.ROI?.GetType(); |
| | | if (Subject.Params.ROI != null) |
| | | { |
| | |
| | | UpdataOutputs(); |
| | | imgTabControl.SelectedTab = tabPageRecordImage; |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is HObject) |
| | | if (Subject.InputImage != null && Subject.InputImage is HImage) |
| | | { |
| | | HOperatorSet.GetImageSize((HObject)Subject.InputImage, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage); |
| | | using (HImage hImage = (HImage)Subject.InputImage) |
| | | { |
| | | hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(hImage); |
| | | } |
| | | } |
| | | |
| | | //先判断子类再判断父类 |
| | |
| | | |
| | | private void btnCreateModel_Click(object sender, EventArgs e) |
| | | { |
| | | if (InputImage != null && InputImage is HObject) |
| | | if (InputImage != null && InputImage is HImage) |
| | | { |
| | | imgTabControl.SelectedTab = tabPageModelImage; |
| | | |
| | | HOperatorSet.GetImageSize((HObject)InputImage, out HTuple hv_imageWidth, out HTuple hv_imageHeight); |
| | | createModelImageHSmartWindowControl.ShowHoImage((HObject)InputImage); |
| | | createModelImageHSmartWindowControl.bAollowDraw = true; |
| | | createModelImageHSmartWindowControl.oRoi = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2 |
| | | , 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | using (HImage hImage = (HImage)Subject.InputImage) |
| | | { |
| | | hImage.GetImageSize(out HTuple hv_imageWidth, out HTuple hv_imageHeight); |
| | | createModelImageHSmartWindowControl.ShowHoImage(hImage); |
| | | createModelImageHSmartWindowControl.bAollowDraw = true; |
| | | createModelImageHSmartWindowControl.oRoi = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2 |
| | | , 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | dtxtMinCount.Text = Subject.Params.Inputs["MinCount"].ToString(); |
| | | dtxtMaxCount.Text = Subject.Params.Inputs["MaxCount"].ToString(); |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is HObject) |
| | | inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage); |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is HImage) |
| | | { |
| | | using (HImage hImage = (HImage)Subject.InputImage) |
| | | { |
| | | hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | inputImageHSmartWindowControl.ShowHoImage(hImage); |
| | | } |
| | | } |
| | | Type type = Subject.Params.ROI?.GetType(); |
| | | if (Subject.Params.ROI != null) |
| | | { |
| | |
| | | UpdataOutputs(); |
| | | imgTabControl.SelectedTab = tabPageRecordImage; |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is HObject) |
| | | if (Subject.InputImage != null && Subject.InputImage is HImage) |
| | | { |
| | | HOperatorSet.GetImageSize((HObject)Subject.InputImage, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage); |
| | | using (HImage hImage = (HImage)Subject.InputImage) |
| | | { |
| | | hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(hImage); |
| | | } |
| | | } |
| | | |
| | | //先判断子类再判断父类 |
| | |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is Mat) |
| | | { |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage)) |
| | | using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.InputImage)) |
| | | { |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is Mat) |
| | | { |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage)) |
| | | using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.InputImage)) |
| | | { |
| | | HOperatorSet.GetImageSize(image, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | |
| | | HTuple hv_imageHeight = 0; |
| | | if (InputImage != null && InputImage is Mat) |
| | | { |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)InputImage)) |
| | | using (HImage image = TAlgorithm.Mat2HImage((Mat)InputImage)) |
| | | { |
| | | image.GetImageSize(out hv_imageWidth, out hv_imageHeight); |
| | | switch (type) |
| | |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is Mat) |
| | | { |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage)) |
| | | using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.InputImage)) |
| | | { |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | Type type = Subject.Params.ROI?.GetType(); |
| | |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is Mat) |
| | | { |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage)) |
| | | using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.InputImage)) |
| | | { |
| | | image.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | |
| | | HTuple hv_imageHeight = 0; |
| | | if (InputImage != null && InputImage is Mat) |
| | | { |
| | | using (HImage image=TAlgorithm.Mat2HObject((Mat)InputImage)) |
| | | using (HImage image=TAlgorithm.Mat2HImage((Mat)InputImage)) |
| | | { |
| | | image.GetImageSize(out hv_imageWidth, out hv_imageHeight); |
| | | switch (type) |
| | |
| | | |
| | | if (InputImage != null && InputImage is Mat) |
| | | { |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)InputImage)) |
| | | using (HImage image = TAlgorithm.Mat2HImage((Mat)InputImage)) |
| | | { |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | int hv_Elements = Convert.ToInt16(itxtCaliperCount.Text); |
| | |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is Mat) |
| | | { |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage)) |
| | | using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.InputImage)) |
| | | { |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | Type type = Subject.Params.ROI?.GetType(); |
| | |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is Mat) |
| | | { |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage)) |
| | | using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.InputImage)) |
| | | { |
| | | image.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | |
| | | HTuple hv_imageHeight = 0; |
| | | if (InputImage != null && InputImage is Mat) |
| | | { |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)InputImage)) |
| | | using (HImage image = TAlgorithm.Mat2HImage((Mat)InputImage)) |
| | | { |
| | | HOperatorSet.GetImageSize(image, out hv_imageWidth, out hv_imageHeight); |
| | | switch (type) |
| | |
| | | if (InputImage != null && InputImage is Mat) |
| | | { |
| | | imgTabControl.SelectedTab = tabPageModelImage; |
| | | using (HImage hoDomainImage = TAlgorithm.Mat2HObject((Mat)InputImage)) |
| | | using (HImage hoDomainImage = TAlgorithm.Mat2HImage((Mat)InputImage)) |
| | | { |
| | | HOperatorSet.GetImageSize(hoDomainImage, out HTuple hv_imageWidth, out HTuple hv_imageHeight); |
| | | createModelImageHSmartWindowControl.ShowHoImage((HObject)hoDomainImage); |
| | | createModelImageHSmartWindowControl.ShowHoImage(hoDomainImage); |
| | | createModelImageHSmartWindowControl.bAollowDraw = true; |
| | | createModelImageHSmartWindowControl.oRoi = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2 |
| | | , 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | |
| | | using (HRegion hRectangle = new HRegion()) |
| | | { |
| | | hRectangle.GenRectangle2(ROI.Row, ROI.Column, ROI.Phi, ROI.SemiLength1, ROI.SemiLength2); |
| | | using (HImage hoDomainImage = TAlgorithm.Mat2HObject((Mat)InputImage)) |
| | | using (HImage hoDomainImage = TAlgorithm.Mat2HImage((Mat)InputImage)) |
| | | { |
| | | HTuple hv_Channels = new HTuple(); |
| | | //判断是否为灰度图 |
| | |
| | | //建模成功导航到子页 |
| | | parasTabControl.SelectedTab = tabPageRunParas; |
| | | //modelImageHSmartWindowControl.ShowHoImage(((HFindModelTool)Subject).ModelID.hoImage); |
| | | using (HImage modelImage = TAlgorithm.Mat2HObject(((FindModelTool)Subject).ModelID.hoImage)) |
| | | using (HImage modelImage = TAlgorithm.Mat2HImage(((FindModelTool)Subject).ModelID.hoImage)) |
| | | { |
| | | modelImageHSmartWindowControl.ShowHoImage(modelImage); |
| | | modelImageHSmartWindowControl.DispObj(ho_ModelContours, false); |
| | |
| | | //HOperatorSet.AffineTransContourXld(ho_ModelContours, out ho_ModelContours, hv_HomMat2D); |
| | | |
| | | modelImageHSmartWindowControl.ClearObj(); |
| | | using (HImage hoImage = TAlgorithm.Mat2HObject(ModelID.hoImage)) |
| | | using (HImage hoImage = TAlgorithm.Mat2HImage(ModelID.hoImage)) |
| | | { |
| | | //modelImageHSmartWindowControl.ShowHoImage(ModelID.hoImage); |
| | | modelImageHSmartWindowControl.ShowHoImage(hoImage); |