private void Act_Engine(HImage image) { LM_DP_ProcedureCall.SetInputIconicParamObject("R", image); LM_DP_ProcedureCall.SetInputIconicParamObject("ROI_LuoMuDiePian_T", LM_DP_Region_Affine); LM_DP_ProcedureCall.SetInputCtrlParamTuple("minThreshold", new HTuple(minThreshold)); LM_DP_ProcedureCall.SetInputCtrlParamTuple("filterRadiu", new HTuple(filterRadiu)); LM_DP_ProcedureCall.SetInputCtrlParamTuple("minAreaThreshold", new HTuple(minAreaThread)); LM_DP_ProcedureCall.SetInputCtrlParamTuple("luoMuMaxArea", new HTuple(luoMuMaxArea)); LM_DP_ProcedureCall.SetInputCtrlParamTuple("luoMuWidth", new HTuple(luoMuWidth)); LM_DP_ProcedureCall.Execute(); if (lM_DP_OkNg.Length == 0) { lM_DP_OkNg = (LM_DP_ProcedureCall.GetOutputCtrlParamTuple("luoMuDiePian_OKNG")); lM_DP_Num = (LM_DP_ProcedureCall.GetOutputCtrlParamTuple("lM_DP_Num")); lM_DP_Area = (LM_DP_ProcedureCall.GetOutputCtrlParamTuple("lM_DP_Area")); } else { lM_DP_OkNg = lM_DP_OkNg.TupleConcat(LM_DP_ProcedureCall.GetOutputCtrlParamTuple("luoMuDiePian_OKNG")); lM_DP_Num = lM_DP_Num.TupleConcat(LM_DP_ProcedureCall.GetOutputCtrlParamTuple("lM_DP_Num")); lM_DP_Area = lM_DP_Area.TupleConcat(LM_DP_ProcedureCall.GetOutputCtrlParamTuple("lM_DP_Area")); } HRegion temp = new HRegion(); temp = LM_DP_ProcedureCall.GetOutputIconicParamRegion("Result_Region"); if (temp != null && temp.IsInitialized()) { ResultRegion = ResultRegion.ConcatObj(temp); temp.Dispose(); } }
private void Act_Engine(HImage R, HImage B) { LanQuan_ProcedureCall.SetInputIconicParamObject("R", R); LanQuan_ProcedureCall.SetInputIconicParamObject("B", B); LanQuan_ProcedureCall.SetInputIconicParamObject("ROI_LanQuan_T", LanQuan_Region_Affine); LanQuan_ProcedureCall.SetInputCtrlParamTuple("minThreshold", new HTuple(minThreshold)); LanQuan_ProcedureCall.SetInputCtrlParamTuple("filterRadiu", new HTuple(filterRadiu)); LanQuan_ProcedureCall.SetInputCtrlParamTuple("minArea", new HTuple(minArea)); LanQuan_ProcedureCall.Execute(); if (LanQuan_OkNg.Length == 0) { LanQuan_OkNg = (LanQuan_ProcedureCall.GetOutputCtrlParamTuple("lanQuan_OKNG")); Area = LanQuan_ProcedureCall.GetOutputCtrlParamTuple("Area"); } else { LanQuan_OkNg = LanQuan_OkNg.TupleConcat(LanQuan_ProcedureCall.GetOutputCtrlParamTuple("lanQuan_OKNG")); Area = Area.TupleConcat(LanQuan_ProcedureCall.GetOutputCtrlParamTuple("Area")); } HRegion temp = new HRegion(); temp = LanQuan_ProcedureCall.GetOutputIconicParamRegion("Result_Region"); if (temp != null && temp.IsInitialized()) { ResultRegion = ResultRegion.ConcatObj(temp); temp.Dispose(); } }
public bool Grab_Intervene_Act(HImage image, List <HHomMat2D> Mat2Ds) { try { if (!bIsInitial) { Initial_Grab_Intervene(); } if (Grab_Intervene_Region == null || !Grab_Intervene_Region.IsInitialized()) { return(false); } if (Mat2Ds == null || Mat2Ds.Count() < 1) { return(false); } if (ResultRegion == null) { ResultRegion = new HRegion(); } if (ResultRegion != null && ResultRegion.IsInitialized()) { ResultRegion.Dispose(); } ResultRegion.GenEmptyObj(); grabInterveneOkNg = new HTuple(); if (Grab_Intervene_Region_Affines == null) { Grab_Intervene_Region_Affines = new HRegion(); } if (Grab_Intervene_Region_Affines != null && Grab_Intervene_Region_Affines.IsInitialized()) { Grab_Intervene_Region_Affines.Dispose(); } Grab_Intervene_Region_Affines.GenEmptyObj(); for (int i = 0; i < Mat2Ds.Count(); i++) { if (Grab_Intervene_Region_Affine == null) { Grab_Intervene_Region_Affine = new HRegion(); } if (Grab_Intervene_Region_Affine != null && Grab_Intervene_Region_Affine.IsInitialized()) { Grab_Intervene_Region_Affine.Dispose(); } Grab_Intervene_Region_Affine.GenEmptyObj(); Grab_Intervene_Region_Affine = Mat2Ds[i].AffineTransRegion(Grab_Intervene_Region, "nearest_neighbor"); Grab_Intervene_Region_Affines = Grab_Intervene_Region_Affines.ConcatObj(Grab_Intervene_Region_Affine); Act_Engine(image); } } catch { return(false); } return(true); }
private void Act_Engine(HImage image) { Grab_Intervene_ProcedureCall.SetInputIconicParamObject("G", image); Grab_Intervene_ProcedureCall.SetInputIconicParamObject("ROI_Grab_T", Grab_Intervene_Region_Affine); Grab_Intervene_ProcedureCall.SetInputCtrlParamTuple("minThreshold", new HTuple(minThreshold)); Grab_Intervene_ProcedureCall.SetInputCtrlParamTuple("filterRadiu", new HTuple(filterRadiu)); Grab_Intervene_ProcedureCall.SetInputCtrlParamTuple("minAreaThread", new HTuple(minAreaThread)); Grab_Intervene_ProcedureCall.Execute(); if (grabInterveneOkNg.Length == 0) { grabInterveneOkNg = (Grab_Intervene_ProcedureCall.GetOutputCtrlParamTuple("grabInterveneOkNg")); } else { grabInterveneOkNg = grabInterveneOkNg.TupleConcat(Grab_Intervene_ProcedureCall.GetOutputCtrlParamTuple("grabInterveneOkNg")); } HRegion temp = new HRegion(); temp = Grab_Intervene_ProcedureCall.GetOutputIconicParamRegion("ResultRegion"); if (temp != null && temp.IsInitialized()) { ResultRegion = ResultRegion.ConcatObj(temp); temp.Dispose(); } }
private void Act_Engine(HImage image) { FangDai_ProcedureCall.SetInputIconicParamObject("G", image); FangDai_ProcedureCall.SetInputIconicParamObject("RegionFD_T", FangDai_Region_Affine); FangDai_ProcedureCall.SetInputCtrlParamTuple("minThreshold", new HTuple(minThreshold)); FangDai_ProcedureCall.SetInputCtrlParamTuple("minArea", new HTuple(minArea)); FangDai_ProcedureCall.SetInputCtrlParamTuple("maxArea", new HTuple(maxArea)); FangDai_ProcedureCall.Execute(); if (FangDai_OkNg.Length == 0) { FangDai_OkNg = (FangDai_ProcedureCall.GetOutputCtrlParamTuple("fD_OkNg")); Area = FangDai_ProcedureCall.GetOutputCtrlParamTuple("Area"); } else { FangDai_OkNg = FangDai_OkNg.TupleConcat(FangDai_ProcedureCall.GetOutputCtrlParamTuple("fD_OkNg")); Area = Area.TupleConcat(FangDai_ProcedureCall.GetOutputCtrlParamTuple("Area")); } HRegion temp = new HRegion(); temp = FangDai_ProcedureCall.GetOutputIconicParamRegion("ResultRegion"); if (temp != null && temp.IsInitialized()) { ResultRegion = ResultRegion.ConcatObj(temp); temp.Dispose(); } }
public void GenDetectionRegionResult(HRegion modelRegion) { if (resultRegion == null) { resultRegion = new HRegion(); } if (resultRegion != null && resultRegion.IsInitialized()) { resultRegion.Dispose(); } resultRegion.GenEmptyObj(); HRegion temp = new HRegion(); for (int i = 0; i < row.Length; i++) { HHomMat2D mat1 = new HHomMat2D(); mat1.VectorAngleToRigid( createShapeModel.refCoordinates[0].D, createShapeModel.refCoordinates[1].D, createShapeModel.refCoordinates[2].D, row[i].D, column[i].D, angle[i].D); mat1 = mat1.HomMat2dScale(scale[i].D, scale[i].D, row[i].D, column[i].D); //图像偏移 temp = mat1.AffineTransRegion(modelRegion, "nearest_neighbor"); //获取模板集合 resultRegion = resultRegion.ConcatObj(temp); temp.Dispose(); } }
public override bool Execute() { this.ROI.error = false; if (this.CurrentImage == null || this.ROI == null) { return(false); } try { HImage reduceImage = this.CurrentImage.ReduceDomain(this.ROI.getRegion()); HRegion region = reduceImage.Threshold((double)this.MinThreshold, this.MaxThreshold); HRegion connectRegion = region.Connection(); HRegion selectRegionTmp, selectRegion; selectRegion = new HRegion(); selectRegion.GenEmptyRegion(); for (int i = 1; i < connectRegion.CountObj(); i++) { selectRegionTmp = connectRegion[i].SelectShape("area", "and", (double)this.MinArea, (double)this.MaxArea); if (selectRegionTmp != null) { selectRegion = selectRegion.ConcatObj(selectRegionTmp); } } HRegion fillRegion; if (this.Filled) { fillRegion = selectRegion.FillUp(); } else { fillRegion = selectRegion; } if (fillRegion.CountObj() > 0) { double areaMax = fillRegion.Area.TupleMax(); int areaIndex = fillRegion.Area.TupleFind(areaMax); this.ResultRegion = fillRegion[areaIndex + 1]; } else { this.ResultRegion = fillRegion; } if (this.ResultRegion.Area > 0) { return(true); } else { this.ROI.error = true; return(false); } } catch { this.ROI.error = true; return(false); } }
public bool LanQuan_Act(HImage R, HImage B, List <HHomMat2D> Mat2Ds) { try { if (!bIsInitial) { Initial_LanQuan(); } if (LanQuan_Region == null || !LanQuan_Region.IsInitialized()) { return(false); } if (Mat2Ds == null || Mat2Ds.Count() < 1) { return(false); } if (ResultRegion == null) { ResultRegion = new HRegion(); } if (ResultRegion != null && ResultRegion.IsInitialized()) { ResultRegion.Dispose(); } ResultRegion.GenEmptyObj(); LanQuan_OkNg = new HTuple(); Area = new HTuple(); if (LanQuan_Region_Affines == null) { LanQuan_Region_Affines = new HRegion(); } if (LanQuan_Region_Affines != null && LanQuan_Region_Affines.IsInitialized()) { LanQuan_Region_Affines.Dispose(); } LanQuan_Region_Affines.GenEmptyObj(); for (int i = 0; i < Mat2Ds.Count(); i++) { if (LanQuan_Region_Affine == null) { LanQuan_Region_Affine = new HRegion(); } if (LanQuan_Region_Affine != null && LanQuan_Region_Affine.IsInitialized()) { LanQuan_Region_Affine.Dispose(); } LanQuan_Region_Affine.GenEmptyObj(); LanQuan_Region_Affine = Mat2Ds[i].AffineTransRegion(LanQuan_Region, "nearest_neighbor"); LanQuan_Region_Affines = LanQuan_Region_Affines.ConcatObj(LanQuan_Region_Affine); Act_Engine(R, B); } } catch { return(false); } return(true); }
public bool FangDai_Act(HImage image, List <HHomMat2D> Mat2Ds) { try { //if (!bIsInitial) //{ // Initial_FangDai(); //} if (FangDai_Region == null || !FangDai_Region.IsInitialized()) { return(false); } if (Mat2Ds == null || Mat2Ds.Count() < 1) { return(false); } if (ResultRegion == null) { ResultRegion = new HRegion(); } if (ResultRegion != null && ResultRegion.IsInitialized()) { ResultRegion.Dispose(); } ResultRegion.GenEmptyObj(); FangDai_OkNg = new HTuple(); Area = new HTuple(); if (FangDai_Region_Affines == null) { FangDai_Region_Affines = new HRegion(); } if (FangDai_Region_Affines != null && FangDai_Region_Affines.IsInitialized()) { FangDai_Region_Affines.Dispose(); } FangDai_Region_Affines.GenEmptyObj(); for (int i = 0; i < Mat2Ds.Count(); i++) { if (FangDai_Region_Affine == null) { FangDai_Region_Affine = new HRegion(); } if (FangDai_Region_Affine != null && FangDai_Region_Affine.IsInitialized()) { FangDai_Region_Affine.Dispose(); } FangDai_Region_Affine.GenEmptyObj(); FangDai_Region_Affine = Mat2Ds[i].AffineTransRegion(FangDai_Region, "nearest_neighbor"); FangDai_Region_Affines = FangDai_Region_Affines.ConcatObj(FangDai_Region_Affine); //Act_Engine(image); HImage roi_image = image.ReduceDomain(FangDai_Region_Affines); HRegion judge_region = roi_image.Threshold(new HTuple(minThreshold), new HTuple(255)); int area = judge_region.Area; if (judge_region != null && judge_region.IsInitialized()) { ResultRegion = ResultRegion.ConcatObj(judge_region); judge_region.Dispose(); } roi_image.Dispose(); if (area >= minArea && area <= maxArea) { if (FangDai_OkNg.Length == 0) { FangDai_OkNg = new HTuple(1); Area = new HTuple(area); } else { FangDai_OkNg = FangDai_OkNg.TupleConcat(new HTuple(1)); Area = Area.TupleConcat(new HTuple(area)); } } else { if (FangDai_OkNg.Length == 0) { FangDai_OkNg = new HTuple(0); Area = new HTuple(area); } else { FangDai_OkNg = FangDai_OkNg.TupleConcat(new HTuple(1)); Area = Area.TupleConcat(new HTuple(area)); } } } } catch { return(false); } return(true); }
public bool FangDai_Act(HImage image, List <HHomMat2D> Mat2Ds) { try { if (!bIsInitial) { Initial_FangDai(); } if (FangDai_Region == null || !FangDai_Region.IsInitialized()) { return(false); } if (Mat2Ds == null || Mat2Ds.Count() < 1) { return(false); } if (ResultRegion == null) { ResultRegion = new HRegion(); } if (ResultRegion != null && ResultRegion.IsInitialized()) { ResultRegion.Dispose(); } ResultRegion.GenEmptyObj(); FangDai_OkNg = new HTuple(); Area = new HTuple(); if (FangDai_Region_Affines == null) { FangDai_Region_Affines = new HRegion(); } if (FangDai_Region_Affines != null && FangDai_Region_Affines.IsInitialized()) { FangDai_Region_Affines.Dispose(); } FangDai_Region_Affines.GenEmptyObj(); for (int i = 0; i < Mat2Ds.Count(); i++) { if (FangDai_Region_Affine == null) { FangDai_Region_Affine = new HRegion(); } if (FangDai_Region_Affine != null && FangDai_Region_Affine.IsInitialized()) { FangDai_Region_Affine.Dispose(); } FangDai_Region_Affine.GenEmptyObj(); FangDai_Region_Affine = Mat2Ds[i].AffineTransRegion(FangDai_Region, "nearest_neighbor"); FangDai_Region_Affines = FangDai_Region_Affines.ConcatObj(FangDai_Region_Affine); Act_Engine(image); } } catch { return(false); } return(true); }