public void do_inspect(HObject ho_Image, HTuple hv_BoxModelPath, out HTuple hv_outport_result) { // Local control variables HTuple hv_Width, hv_Height, hv_BoxModelID; HTuple hv_BoxModelRow, hv_BoxModelColumn, hv_BoxModelAngle; HTuple hv_BoxModelScore; // Initialize local and output iconic variables hv_outport_result = new HTuple(); //read_image (Image, fileName) HOperatorSet.GetImageSize(ho_Image, out hv_Width, out hv_Height); HOperatorSet.ReadNccModel(hv_BoxModelPath, out hv_BoxModelID); HOperatorSet.FindNccModel(ho_Image, hv_BoxModelID, 0, 0, 0.5, 1, 0.5, "true", 0, out hv_BoxModelRow, out hv_BoxModelColumn, out hv_BoxModelAngle, out hv_BoxModelScore); if ((int)((new HTuple((new HTuple(hv_BoxModelScore.TupleLength())).TupleEqual( 0))).TupleOr(new HTuple(((hv_BoxModelScore.TupleSelect(0))).TupleLess(0.75)))) != 0) { hv_outport_result = new HTuple(); hv_outport_result[0] = 0; hv_outport_result[1] = 0; hv_outport_result[2] = 0; } else { hv_outport_result[0] = 1; hv_outport_result[1] = ((hv_BoxModelRow.TupleSelect(0))).TupleInt(); hv_outport_result[2] = ((hv_BoxModelColumn.TupleSelect(0))).TupleInt(); } HOperatorSet.ClearNccModel(hv_BoxModelID); return; }
public void do_inspect3(HObject ho_Image, HTuple hv_testNumPath, HTuple hv_testTimePath, out HTuple hv_outportResult) { // Local control variables HTuple hv_testNumModelID, hv_testTimeModelID; HTuple hv_testNumModelRow, hv_testNumModelColumn, hv_testNumModelAngle; HTuple hv_testNumModelScore, hv_testTimeModelRow, hv_testTimeModelColumn; HTuple hv_testTimeModelAngle, hv_testTimeModelScore; // Initialize local and output iconic variables hv_outportResult = new HTuple(); HOperatorSet.ReadNccModel(hv_testNumPath, out hv_testNumModelID); HOperatorSet.ReadNccModel(hv_testTimePath, out hv_testTimeModelID); HOperatorSet.FindNccModel(ho_Image, hv_testNumModelID, 0, 0, 0.5, 1, 0.5, "true", 0, out hv_testNumModelRow, out hv_testNumModelColumn, out hv_testNumModelAngle, out hv_testNumModelScore); HOperatorSet.FindNccModel(ho_Image, hv_testTimeModelID, 0, 0, 0.5, 1, 0.5, "true", 0, out hv_testTimeModelRow, out hv_testTimeModelColumn, out hv_testTimeModelAngle, out hv_testTimeModelScore); if ((int)((new HTuple((new HTuple((new HTuple((new HTuple(hv_testNumModelScore.TupleLength() )).TupleEqual(1))).TupleAnd(new HTuple(hv_testNumModelScore.TupleGreater( 0.75))))).TupleAnd(new HTuple((new HTuple(hv_testTimeModelScore.TupleLength() )).TupleEqual(1))))).TupleAnd(new HTuple(hv_testTimeModelScore.TupleGreater( 0.75)))) != 0) { hv_outportResult = new HTuple(); hv_outportResult[0] = 1; hv_outportResult[1] = 1; hv_outportResult[2] = 1; } else { hv_outportResult = new HTuple(); hv_outportResult[0] = 0; hv_outportResult[1] = 0; hv_outportResult[2] = 0; } HOperatorSet.ClearNccModel(hv_testNumModelID); HOperatorSet.ClearNccModel(hv_testTimeModelID); return; }
public void do_inspect(HObject ho_Image, HTuple hv_lightBoxModelPath, HTuple hv_resetModelPath, HTuple hv_cancelLightBoxPath, out HTuple hv_outport_result) { // Local control variables HTuple hv_lightModelID, hv_resetModelID, hv_cancelModelID; HTuple hv_lightModelRow, hv_lightModelColumn, hv_lightModelAngle; HTuple hv_lightModelScore, hv_resetModelRow, hv_resetModelColumn; HTuple hv_resetModelAngle, hv_resetModelScore, hv_cancelModelRow; HTuple hv_cancelModelColumn, hv_cancelModelAngle, hv_cancelModelScore; // Initialize local and output iconic variables hv_outport_result = new HTuple(); //read_image (Image, fileName) HOperatorSet.ReadNccModel(hv_lightBoxModelPath, out hv_lightModelID); HOperatorSet.ReadNccModel(hv_resetModelPath, out hv_resetModelID); HOperatorSet.ReadNccModel(hv_cancelLightBoxPath, out hv_cancelModelID); HOperatorSet.FindNccModel(ho_Image, hv_lightModelID, 0, 0, 0.5, 1, 0.5, "true", 0, out hv_lightModelRow, out hv_lightModelColumn, out hv_lightModelAngle, out hv_lightModelScore); HOperatorSet.FindNccModel(ho_Image, hv_resetModelID, 0, 0, 0.5, 1, 0.5, "true", 0, out hv_resetModelRow, out hv_resetModelColumn, out hv_resetModelAngle, out hv_resetModelScore); HOperatorSet.FindNccModel(ho_Image, hv_cancelModelID, 0, 0, 0.5, 1, 0.5, "true", 0, out hv_cancelModelRow, out hv_cancelModelColumn, out hv_cancelModelAngle, out hv_cancelModelScore); if ((int)((new HTuple((new HTuple(hv_lightModelScore.TupleLength())).TupleEqual( 1))).TupleAnd(new HTuple(hv_lightModelScore.TupleGreater(0.75)))) != 0) { if ((int)((new HTuple((new HTuple(hv_cancelModelScore.TupleLength())).TupleEqual( 1))).TupleAnd(new HTuple(hv_cancelModelScore.TupleGreater(0.75)))) != 0) { hv_outport_result[0] = 2; hv_outport_result[1] = ((hv_lightModelRow.TupleSelect(0))).TupleInt(); hv_outport_result[2] = ((hv_lightModelColumn.TupleSelect(0))).TupleInt(); hv_outport_result[3] = ((hv_cancelModelRow.TupleSelect(0))).TupleInt(); hv_outport_result[4] = ((hv_cancelModelColumn.TupleSelect(0))).TupleInt() ; } else { hv_outport_result = new HTuple(); hv_outport_result[0] = 3; hv_outport_result[1] = 3; hv_outport_result[2] = 3; } } else if ((int)((new HTuple((new HTuple(hv_resetModelScore.TupleLength() )).TupleEqual(1))).TupleAnd(new HTuple(hv_resetModelScore.TupleGreater(0.75)))) != 0) { hv_outport_result = new HTuple(); hv_outport_result[0] = 1; hv_outport_result[1] = 1; hv_outport_result[2] = 1; } else { hv_outport_result = new HTuple(); hv_outport_result[0] = 0; hv_outport_result[1] = 0; hv_outport_result[2] = 0; } HOperatorSet.ClearNccModel(hv_lightModelID); HOperatorSet.ClearNccModel(hv_resetModelID); HOperatorSet.ClearNccModel(hv_cancelModelID); return; }
public void do_inspect1(HObject ho_Image, HTuple hv_okPath, HTuple hv_notokPath, HTuple hv_testingPath, HTuple hv_startingPath, out HTuple hv_outport_result) { // Local control variables HTuple hv_Width, hv_Height, hv_okModelID, hv_notokModelID; HTuple hv_testingModelID, hv_startingModelID, hv_okModelRow; HTuple hv_okModelColumn, hv_okModelAngle, hv_okModelScore; HTuple hv_notokModelRow, hv_notokModelColumn, hv_notokModelAngle; HTuple hv_notokModelScore, hv_testingModelRow, hv_testingModelColumn; HTuple hv_testingModelAngle, hv_testingModelScore, hv_startingModelRow; HTuple hv_startingModelColumn, hv_startingModelAngle, hv_startingModelScore; // Initialize local and output iconic variables hv_outport_result = new HTuple(); //read_image (Image, fileName) HOperatorSet.GetImageSize(ho_Image, out hv_Width, out hv_Height); HOperatorSet.ReadNccModel(hv_okPath, out hv_okModelID); HOperatorSet.ReadNccModel(hv_notokPath, out hv_notokModelID); HOperatorSet.ReadNccModel(hv_testingPath, out hv_testingModelID); HOperatorSet.ReadNccModel(hv_startingPath, out hv_startingModelID); HOperatorSet.FindNccModel(ho_Image, hv_okModelID, 0, 0, 0.5, 1, 0.5, "true", 0, out hv_okModelRow, out hv_okModelColumn, out hv_okModelAngle, out hv_okModelScore); HOperatorSet.FindNccModel(ho_Image, hv_notokModelID, 0, 0, 0.5, 1, 0.5, "true", 0, out hv_notokModelRow, out hv_notokModelColumn, out hv_notokModelAngle, out hv_notokModelScore); HOperatorSet.FindNccModel(ho_Image, hv_testingModelID, 0, 0, 0.5, 1, 0.5, "true", 0, out hv_testingModelRow, out hv_testingModelColumn, out hv_testingModelAngle, out hv_testingModelScore); HOperatorSet.FindNccModel(ho_Image, hv_startingModelID, 0, 0, 0.5, 1, 0.5, "true", 0, out hv_startingModelRow, out hv_startingModelColumn, out hv_startingModelAngle, out hv_startingModelScore); if ((int)((new HTuple((new HTuple(hv_okModelScore.TupleLength())).TupleEqual( 1))).TupleAnd(new HTuple(hv_okModelScore.TupleGreater(0.75)))) != 0) { hv_outport_result[0] = 2; } else if ((int)((new HTuple((new HTuple(hv_notokModelScore.TupleLength() )).TupleEqual(1))).TupleAnd(new HTuple(hv_notokModelScore.TupleGreater(0.75)))) != 0) { hv_outport_result[0] = 3; } else if ((int)((new HTuple((new HTuple(hv_testingModelScore.TupleLength() )).TupleEqual(1))).TupleAnd(new HTuple(hv_testingModelScore.TupleGreater( 0.75)))) != 0) { hv_outport_result[0] = 1; } else if ((int)((new HTuple((new HTuple(hv_startingModelScore.TupleLength() )).TupleEqual(1))).TupleAnd(new HTuple(hv_startingModelScore.TupleGreater( 0.75)))) != 0) { hv_outport_result[0] = 0; } else { hv_outport_result[0] = 1; } HOperatorSet.ClearNccModel(hv_okModelID); HOperatorSet.ClearNccModel(hv_notokModelID); HOperatorSet.ClearNccModel(hv_testingModelID); HOperatorSet.ClearNccModel(hv_startingModelID); return; }
public void do_inspect1(HObject ho_Image, HTuple hv_countPath, HTuple hv_startPath, HTuple hv_pausePath, HTuple hv_stopPath, out HTuple hv_outport_result) { // Local iconic variables HObject ho_rightRectangle = null, ho_leftRectangle = null; HObject ho_GrayImage = null, ho_rightImageReduced = null, ho_leftImageReduced = null; HObject ho_leftBlueRegions = null, ho_rightBlueRegions = null; HObject ho_leftRedRegions = null, ho_rightRedRegions = null; HObject ho_leftYellowRegions = null, ho_rightYellowRegions = null; HObject ho_leftGreenRegions = null, ho_rightGreenRegions = null; // Local control variables HTuple hv_TestModelID, hv_testRow, hv_testColumn; HTuple hv_testAngle, hv_testScore, hv_rightBlueArea = new HTuple(); HTuple hv_Row = new HTuple(), hv_Column = new HTuple(), hv_leftBlueArea = new HTuple(); HTuple hv_rightRedArea = new HTuple(), hv_leftRedArea = new HTuple(); HTuple hv_rightYellowArea = new HTuple(), hv_leftYellowArea = new HTuple(); HTuple hv_rightGreenArea = new HTuple(), hv_leftGreenArea = new HTuple(); // Initialize local and output iconic variables HOperatorSet.GenEmptyObj(out ho_rightRectangle); HOperatorSet.GenEmptyObj(out ho_leftRectangle); HOperatorSet.GenEmptyObj(out ho_GrayImage); HOperatorSet.GenEmptyObj(out ho_rightImageReduced); HOperatorSet.GenEmptyObj(out ho_leftImageReduced); HOperatorSet.GenEmptyObj(out ho_leftBlueRegions); HOperatorSet.GenEmptyObj(out ho_rightBlueRegions); HOperatorSet.GenEmptyObj(out ho_leftRedRegions); HOperatorSet.GenEmptyObj(out ho_rightRedRegions); HOperatorSet.GenEmptyObj(out ho_leftYellowRegions); HOperatorSet.GenEmptyObj(out ho_rightYellowRegions); HOperatorSet.GenEmptyObj(out ho_leftGreenRegions); HOperatorSet.GenEmptyObj(out ho_rightGreenRegions); hv_outport_result = new HTuple(); HOperatorSet.ReadNccModel(hv_countPath, out hv_TestModelID); HOperatorSet.FindNccModel(ho_Image, hv_TestModelID, -0.39, 0.78, 0.5, 2, 0.5, "true", 3, out hv_testRow, out hv_testColumn, out hv_testAngle, out hv_testScore); if ((int)((new HTuple((new HTuple(hv_testScore.TupleLength())).TupleEqual(2))).TupleAnd( new HTuple(((hv_testScore.TupleSelect(1))).TupleGreater(0.75)))) != 0) { if ((int)(new HTuple(((hv_testColumn.TupleSelect(0))).TupleGreater(hv_testColumn.TupleSelect( 1)))) != 0) { ho_rightRectangle.Dispose(); HOperatorSet.GenRectangle1(out ho_rightRectangle, (hv_testRow.TupleSelect( 0)) - 12, (hv_testColumn.TupleSelect(0)) - (((hv_testColumn.TupleSelect(0)) - (hv_testColumn.TupleSelect( 1))) - 120), (hv_testRow.TupleSelect(0)) + 38, (hv_testColumn.TupleSelect( 0)) - 30); ho_leftRectangle.Dispose(); HOperatorSet.GenRectangle1(out ho_leftRectangle, (hv_testRow.TupleSelect( 1)) - 12, (hv_testColumn.TupleSelect(1)) - (((hv_testColumn.TupleSelect(0)) - (hv_testColumn.TupleSelect( 1))) - 120), (hv_testRow.TupleSelect(1)) + 38, (hv_testColumn.TupleSelect( 1)) - 30); } else { ho_rightRectangle.Dispose(); HOperatorSet.GenRectangle1(out ho_rightRectangle, (hv_testRow.TupleSelect( 1)) - 12, (hv_testColumn.TupleSelect(1)) - (((hv_testColumn.TupleSelect(1)) - (hv_testColumn.TupleSelect( 0))) - 120), (hv_testRow.TupleSelect(1)) + 38, (hv_testColumn.TupleSelect( 1)) - 30); ho_leftRectangle.Dispose(); HOperatorSet.GenRectangle1(out ho_leftRectangle, (hv_testRow.TupleSelect( 0)) - 12, (hv_testColumn.TupleSelect(0)) - (((hv_testColumn.TupleSelect(1)) - (hv_testColumn.TupleSelect( 0))) - 120), (hv_testRow.TupleSelect(0)) + 38, (hv_testColumn.TupleSelect( 0)) - 30); } ho_GrayImage.Dispose(); HOperatorSet.Rgb1ToGray(ho_Image, out ho_GrayImage); ho_rightImageReduced.Dispose(); HOperatorSet.ReduceDomain(ho_GrayImage, ho_rightRectangle, out ho_rightImageReduced ); ho_leftImageReduced.Dispose(); HOperatorSet.ReduceDomain(ho_GrayImage, ho_leftRectangle, out ho_leftImageReduced ); //À¶É«start ho_leftBlueRegions.Dispose(); HOperatorSet.Threshold(ho_leftImageReduced, out ho_leftBlueRegions, 29, 29); ho_rightBlueRegions.Dispose(); HOperatorSet.Threshold(ho_rightImageReduced, out ho_rightBlueRegions, 29, 29); HOperatorSet.AreaCenter(ho_rightBlueRegions, out hv_rightBlueArea, out hv_Row, out hv_Column); HOperatorSet.AreaCenter(ho_leftBlueRegions, out hv_leftBlueArea, out hv_Row, out hv_Column); //ºìÉ«fail ho_leftRedRegions.Dispose(); HOperatorSet.Threshold(ho_leftImageReduced, out ho_leftRedRegions, 76, 76); ho_rightRedRegions.Dispose(); HOperatorSet.Threshold(ho_rightImageReduced, out ho_rightRedRegions, 76, 76); HOperatorSet.AreaCenter(ho_rightRedRegions, out hv_rightRedArea, out hv_Row, out hv_Column); HOperatorSet.AreaCenter(ho_leftRedRegions, out hv_leftRedArea, out hv_Row, out hv_Column); //»ÆÉ«test ho_leftYellowRegions.Dispose(); HOperatorSet.Threshold(ho_leftImageReduced, out ho_leftYellowRegions, 226, 226); ho_rightYellowRegions.Dispose(); HOperatorSet.Threshold(ho_rightImageReduced, out ho_rightYellowRegions, 226, 226); HOperatorSet.AreaCenter(ho_rightYellowRegions, out hv_rightYellowArea, out hv_Row, out hv_Column); HOperatorSet.AreaCenter(ho_leftYellowRegions, out hv_leftYellowArea, out hv_Row, out hv_Column); //ÂÌÉ«pass ho_leftGreenRegions.Dispose(); HOperatorSet.Threshold(ho_leftImageReduced, out ho_leftGreenRegions, 150, 150); ho_rightGreenRegions.Dispose(); HOperatorSet.Threshold(ho_rightImageReduced, out ho_rightGreenRegions, 150, 150); HOperatorSet.AreaCenter(ho_rightGreenRegions, out hv_rightGreenArea, out hv_Row, out hv_Column); HOperatorSet.AreaCenter(ho_leftGreenRegions, out hv_leftGreenArea, out hv_Row, out hv_Column); hv_outport_result[0] = 5; //left if ((int)((new HTuple((new HTuple(hv_leftGreenArea.TupleLength())).TupleEqual( 1))).TupleAnd(new HTuple(hv_leftGreenArea.TupleGreater(400)))) != 0) { hv_outport_result[1] = 2; } else if ((int)((new HTuple((new HTuple(hv_leftBlueArea.TupleLength() )).TupleEqual(1))).TupleAnd(new HTuple(hv_leftBlueArea.TupleGreater(400)))) != 0) { hv_outport_result[1] = 0; } else if ((int)((new HTuple((new HTuple(hv_leftYellowArea.TupleLength() )).TupleEqual(1))).TupleAnd(new HTuple(hv_leftYellowArea.TupleGreater(400)))) != 0) { hv_outport_result[1] = 1; } else if ((int)((new HTuple((new HTuple(hv_leftRedArea.TupleLength() )).TupleEqual(1))).TupleAnd(new HTuple(hv_leftRedArea.TupleGreater(400)))) != 0) { hv_outport_result[1] = 3; } else { hv_outport_result[1] = 4; } //right if ((int)((new HTuple((new HTuple(hv_rightGreenArea.TupleLength())).TupleEqual( 1))).TupleAnd(new HTuple(hv_rightGreenArea.TupleGreater(400)))) != 0) { hv_outport_result[2] = 2; } else if ((int)((new HTuple((new HTuple(hv_rightBlueArea.TupleLength() )).TupleEqual(1))).TupleAnd(new HTuple(hv_rightBlueArea.TupleGreater(400)))) != 0) { hv_outport_result[2] = 0; } else if ((int)((new HTuple((new HTuple(hv_rightYellowArea.TupleLength() )).TupleEqual(1))).TupleAnd(new HTuple(hv_rightYellowArea.TupleGreater( 400)))) != 0) { hv_outport_result[2] = 1; } else if ((int)((new HTuple((new HTuple(hv_rightRedArea.TupleLength() )).TupleEqual(1))).TupleAnd(new HTuple(hv_rightRedArea.TupleGreater(400)))) != 0) { hv_outport_result[2] = 3; } else { hv_outport_result[2] = 4; } } else { hv_outport_result[0] = 3; } HOperatorSet.ClearNccModel(hv_TestModelID); ho_rightRectangle.Dispose(); ho_leftRectangle.Dispose(); ho_GrayImage.Dispose(); ho_rightImageReduced.Dispose(); ho_leftImageReduced.Dispose(); ho_leftBlueRegions.Dispose(); ho_rightBlueRegions.Dispose(); ho_leftRedRegions.Dispose(); ho_rightRedRegions.Dispose(); ho_leftYellowRegions.Dispose(); ho_rightYellowRegions.Dispose(); ho_leftGreenRegions.Dispose(); ho_rightGreenRegions.Dispose(); return; }
public void do_inspect1(HObject ho_Image, HTuple hv_RightModelPath, HTuple hv_TestModelPath, out HTuple hv_outport_result) { // Local iconic variables HObject ho_UpRectangle = null, ho_UpImageReduced = null; HObject ho_DownRectangle = null, ho_DownImageReduced = null; HObject ho_UpSuccessRegions = null, ho_UpSuccessConnectedRegions = null; HObject ho_UpSuccessSelectedRegions = null, ho_UpSuccessSelectedRegions1 = null; HObject ho_UpFailRegions = null, ho_UpFailConnectedRegions = null; HObject ho_UpFailSelectedRegions = null, ho_UpFailSelectedRegions1 = null; HObject ho_DownSuccessRegions = null, ho_DownSuccessConnectedRegions = null; HObject ho_DownSuccessSelectedRegions = null, ho_DownSuccessSelectedRegions1 = null; HObject ho_DownFailRegions = null, ho_DownFailConnectedRegions = null; HObject ho_DownFailSelectedRegions = null, ho_DownFailSelectedRegions1 = null; // Local control variables HTuple hv_Width, hv_Height, hv_RightModelID; HTuple hv_RightModelRow, hv_RightModelColumn, hv_RightModelAngle; HTuple hv_RightModelScore, hv_TestModelID = new HTuple(); HTuple hv_UpTestRow = new HTuple(), hv_UpTestColumn = new HTuple(); HTuple hv_UpTestAngle = new HTuple(), hv_UpTestScore = new HTuple(); HTuple hv_DownTestRow = new HTuple(), hv_DownTestColumn = new HTuple(); HTuple hv_DownTestAngle = new HTuple(), hv_DownTestScore = new HTuple(); HTuple hv_upStartStateArea = new HTuple(), hv_upStartStateRow = new HTuple(); HTuple hv_upStartStateColumn = new HTuple(), hv_UpSuccessArea = new HTuple(); HTuple hv_UpSuccessRow = new HTuple(), hv_UpSuccessColumn = new HTuple(); HTuple hv_UpFailArea = new HTuple(), hv_UpFailRow = new HTuple(); HTuple hv_UpFailColumn = new HTuple(), hv_downStartStateArea = new HTuple(); HTuple hv_downStartStateRow = new HTuple(), hv_downStartStateColumn = new HTuple(); HTuple hv_DownSuccessArea = new HTuple(), hv_DownSuccessRow = new HTuple(); HTuple hv_DownSuccessColumn = new HTuple(), hv_DownFailArea = new HTuple(); HTuple hv_DownFailRow = new HTuple(), hv_DownFailColumn = new HTuple(); HTuple hv_outport_upresult = new HTuple(), hv_outport_downresult = new HTuple(); // Initialize local and output iconic variables HOperatorSet.GenEmptyObj(out ho_UpRectangle); HOperatorSet.GenEmptyObj(out ho_UpImageReduced); HOperatorSet.GenEmptyObj(out ho_DownRectangle); HOperatorSet.GenEmptyObj(out ho_DownImageReduced); HOperatorSet.GenEmptyObj(out ho_UpSuccessRegions); HOperatorSet.GenEmptyObj(out ho_UpSuccessConnectedRegions); HOperatorSet.GenEmptyObj(out ho_UpSuccessSelectedRegions); HOperatorSet.GenEmptyObj(out ho_UpSuccessSelectedRegions1); HOperatorSet.GenEmptyObj(out ho_UpFailRegions); HOperatorSet.GenEmptyObj(out ho_UpFailConnectedRegions); HOperatorSet.GenEmptyObj(out ho_UpFailSelectedRegions); HOperatorSet.GenEmptyObj(out ho_UpFailSelectedRegions1); HOperatorSet.GenEmptyObj(out ho_DownSuccessRegions); HOperatorSet.GenEmptyObj(out ho_DownSuccessConnectedRegions); HOperatorSet.GenEmptyObj(out ho_DownSuccessSelectedRegions); HOperatorSet.GenEmptyObj(out ho_DownSuccessSelectedRegions1); HOperatorSet.GenEmptyObj(out ho_DownFailRegions); HOperatorSet.GenEmptyObj(out ho_DownFailConnectedRegions); HOperatorSet.GenEmptyObj(out ho_DownFailSelectedRegions); HOperatorSet.GenEmptyObj(out ho_DownFailSelectedRegions1); hv_outport_result = new HTuple(); //read_image (Image, fileName) HOperatorSet.GetImageSize(ho_Image, out hv_Width, out hv_Height); HOperatorSet.ReadNccModel(hv_RightModelPath, out hv_RightModelID); HOperatorSet.FindNccModel(ho_Image, hv_RightModelID, 0, 0, 0.5, 1, 0.5, "true", 0, out hv_RightModelRow, out hv_RightModelColumn, out hv_RightModelAngle, out hv_RightModelScore); if ((int)((new HTuple((new HTuple(hv_RightModelScore.TupleLength())).TupleEqual( 0))).TupleOr(new HTuple(((hv_RightModelScore.TupleSelect(0))).TupleLess(0.75)))) != 0) { //û�ҵ���λ�����Ҳ����ť�� hv_outport_result = new HTuple(); hv_outport_result[0] = 4; hv_outport_result[1] = 4; } else { ho_UpRectangle.Dispose(); HOperatorSet.GenRectangle1(out ho_UpRectangle, (hv_RightModelRow.TupleSelect( 0)) - 305, (hv_RightModelColumn.TupleSelect(0)) - 815, (hv_RightModelRow.TupleSelect( 0)) - 50, (hv_RightModelColumn.TupleSelect(0)) - 70); ho_UpImageReduced.Dispose(); HOperatorSet.ReduceDomain(ho_Image, ho_UpRectangle, out ho_UpImageReduced); ho_DownRectangle.Dispose(); HOperatorSet.GenRectangle1(out ho_DownRectangle, (hv_RightModelRow.TupleSelect( 0)) - 30, (hv_RightModelColumn.TupleSelect(0)) - 815, (hv_RightModelRow.TupleSelect( 0)) + 230, (hv_RightModelColumn.TupleSelect(0)) - 70); ho_DownImageReduced.Dispose(); HOperatorSet.ReduceDomain(ho_Image, ho_DownRectangle, out ho_DownImageReduced ); HOperatorSet.ReadNccModel(hv_TestModelPath, out hv_TestModelID); HOperatorSet.FindNccModel(ho_UpImageReduced, hv_TestModelID, 0, 0, 0.5, 1, 0.5, "true", 0, out hv_UpTestRow, out hv_UpTestColumn, out hv_UpTestAngle, out hv_UpTestScore); HOperatorSet.FindNccModel(ho_DownImageReduced, hv_TestModelID, 0, 0, 0.5, 1, 0.5, "true", 0, out hv_DownTestRow, out hv_DownTestColumn, out hv_DownTestAngle, out hv_DownTestScore); ho_UpSuccessRegions.Dispose(); HOperatorSet.Threshold(ho_UpImageReduced, out ho_UpSuccessRegions, 0, 2); HOperatorSet.AreaCenter(ho_UpSuccessRegions, out hv_upStartStateArea, out hv_upStartStateRow, out hv_upStartStateColumn); ho_UpSuccessConnectedRegions.Dispose(); HOperatorSet.Connection(ho_UpSuccessRegions, out ho_UpSuccessConnectedRegions ); ho_UpSuccessSelectedRegions.Dispose(); HOperatorSet.SelectShape(ho_UpSuccessConnectedRegions, out ho_UpSuccessSelectedRegions, "rectangularity", "and", 0.8, 1); ho_UpSuccessSelectedRegions1.Dispose(); HOperatorSet.SelectShape(ho_UpSuccessSelectedRegions, out ho_UpSuccessSelectedRegions1, "area", "and", 10000, 158720); HOperatorSet.AreaCenter(ho_UpSuccessSelectedRegions1, out hv_UpSuccessArea, out hv_UpSuccessRow, out hv_UpSuccessColumn); ho_UpFailRegions.Dispose(); HOperatorSet.Threshold(ho_UpImageReduced, out ho_UpFailRegions, 138, 140); ho_UpFailConnectedRegions.Dispose(); HOperatorSet.Connection(ho_UpFailRegions, out ho_UpFailConnectedRegions); ho_UpFailSelectedRegions.Dispose(); HOperatorSet.SelectShape(ho_UpFailConnectedRegions, out ho_UpFailSelectedRegions, "rectangularity", "and", 0.8, 1); ho_UpFailSelectedRegions1.Dispose(); HOperatorSet.SelectShape(ho_UpFailSelectedRegions, out ho_UpFailSelectedRegions1, "area", "and", 10000, 158720); HOperatorSet.AreaCenter(ho_UpFailSelectedRegions1, out hv_UpFailArea, out hv_UpFailRow, out hv_UpFailColumn); ho_DownSuccessRegions.Dispose(); HOperatorSet.Threshold(ho_DownImageReduced, out ho_DownSuccessRegions, 0, 2); HOperatorSet.AreaCenter(ho_DownSuccessRegions, out hv_downStartStateArea, out hv_downStartStateRow, out hv_downStartStateColumn); ho_DownSuccessConnectedRegions.Dispose(); HOperatorSet.Connection(ho_DownSuccessRegions, out ho_DownSuccessConnectedRegions ); ho_DownSuccessSelectedRegions.Dispose(); HOperatorSet.SelectShape(ho_DownSuccessConnectedRegions, out ho_DownSuccessSelectedRegions, "rectangularity", "and", 0.8, 1); ho_DownSuccessSelectedRegions1.Dispose(); HOperatorSet.SelectShape(ho_DownSuccessSelectedRegions, out ho_DownSuccessSelectedRegions1, "area", "and", 10000, 158720); HOperatorSet.AreaCenter(ho_DownSuccessSelectedRegions1, out hv_DownSuccessArea, out hv_DownSuccessRow, out hv_DownSuccessColumn); ho_DownFailRegions.Dispose(); HOperatorSet.Threshold(ho_DownImageReduced, out ho_DownFailRegions, 138, 140); ho_DownFailConnectedRegions.Dispose(); HOperatorSet.Connection(ho_DownFailRegions, out ho_DownFailConnectedRegions ); ho_DownFailSelectedRegions.Dispose(); HOperatorSet.SelectShape(ho_DownFailConnectedRegions, out ho_DownFailSelectedRegions, "rectangularity", "and", 0.8, 1); ho_DownFailSelectedRegions1.Dispose(); HOperatorSet.SelectShape(ho_DownFailSelectedRegions, out ho_DownFailSelectedRegions1, "area", "and", 10000, 158720); HOperatorSet.AreaCenter(ho_DownFailSelectedRegions1, out hv_DownFailArea, out hv_DownFailRow, out hv_DownFailColumn); if ((int)((new HTuple((new HTuple(hv_UpTestScore.TupleLength())).TupleEqual( 0))).TupleOr(new HTuple(((hv_UpTestScore.TupleSelect(0))).TupleLess(0.75)))) != 0) { if ((int)((new HTuple((new HTuple(hv_upStartStateArea.TupleLength())).TupleEqual( 0))).TupleOr(new HTuple(hv_upStartStateArea.TupleEqual(0)))) != 0) { //��ʼ״̬ hv_outport_upresult = 0; } else { //������ hv_outport_upresult = 1; } } else { if ((int)(new HTuple((new HTuple(hv_UpSuccessArea.TupleLength())).TupleGreater( 0))) != 0) { //�Ͽ���Գɹ� hv_outport_upresult = 2; } else if ((int)(new HTuple((new HTuple(hv_UpFailArea.TupleLength() )).TupleGreater(0))) != 0) { //�Ͽ����ʧ�� hv_outport_upresult = 3; } else { //�ҵ����Խ�����ʶ����֪���Dz��Գɹ����Dz���ʧ�� hv_outport_upresult = 4; } } if ((int)((new HTuple((new HTuple(hv_DownTestScore.TupleLength())).TupleEqual( 0))).TupleOr(new HTuple(((hv_DownTestScore.TupleSelect(0))).TupleLess(0.75)))) != 0) { //������ if ((int)((new HTuple((new HTuple(hv_downStartStateArea.TupleLength())).TupleEqual( 0))).TupleOr(new HTuple(hv_downStartStateArea.TupleEqual(0)))) != 0) { //��ʼ״̬ hv_outport_downresult = 0; } else { //������ hv_outport_downresult = 1; } } else { if ((int)(new HTuple((new HTuple(hv_DownSuccessArea.TupleLength())).TupleGreater( 0))) != 0) { //�¿���Գɹ� hv_outport_downresult = 2; } else if ((int)(new HTuple((new HTuple(hv_DownFailArea.TupleLength() )).TupleGreater(0))) != 0) { //�¿����ʧ�� hv_outport_downresult = 3; } else { //�ҵ����Խ�����ʶ����֪���Dz��Գɹ����Dz���ʧ�� hv_outport_downresult = 4; } } hv_outport_result[0] = hv_outport_upresult.TupleSelect(0); hv_outport_result[1] = hv_outport_downresult.TupleSelect(0); HOperatorSet.ClearNccModel(hv_TestModelID); } HOperatorSet.ClearNccModel(hv_RightModelID); ho_UpRectangle.Dispose(); ho_UpImageReduced.Dispose(); ho_DownRectangle.Dispose(); ho_DownImageReduced.Dispose(); ho_UpSuccessRegions.Dispose(); ho_UpSuccessConnectedRegions.Dispose(); ho_UpSuccessSelectedRegions.Dispose(); ho_UpSuccessSelectedRegions1.Dispose(); ho_UpFailRegions.Dispose(); ho_UpFailConnectedRegions.Dispose(); ho_UpFailSelectedRegions.Dispose(); ho_UpFailSelectedRegions1.Dispose(); ho_DownSuccessRegions.Dispose(); ho_DownSuccessConnectedRegions.Dispose(); ho_DownSuccessSelectedRegions.Dispose(); ho_DownSuccessSelectedRegions1.Dispose(); ho_DownFailRegions.Dispose(); ho_DownFailConnectedRegions.Dispose(); ho_DownFailSelectedRegions.Dispose(); ho_DownFailSelectedRegions1.Dispose(); return; }