本文整理汇总了C#中HTuple.TupleGreater方法的典型用法代码示例。如果您正苦于以下问题:C# HTuple.TupleGreater方法的具体用法?C# HTuple.TupleGreater怎么用?C# HTuple.TupleGreater使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTuple
的用法示例。
在下文中一共展示了HTuple.TupleGreater方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: eval_caltab_contrast_homogeneity
/// <summary>
/// Evaluates the gray value contrast between the marks and the calibration
/// plate and the homogeneity of the used illumination.
/// </summary>
public void eval_caltab_contrast_homogeneity(HObject ho_Image,
HObject ho_Marks,
out HTuple hv_Contrast,
out HTuple hv_ContrastScore,
out HTuple hv_HomogeneityScore)
{
// Local iconic variables
HObject ho_Region, ho_RegionDilation;
// Local control variables
HTuple hv_Number, hv_Min, hv_Max, hv_Range;
HTuple hv_MinContrast, hv_MaxContrast, hv_DeviationMax;
// Initialize local and output iconic variables
HOperatorSet.GenEmptyObj(out ho_Region);
HOperatorSet.GenEmptyObj(out ho_RegionDilation);
hv_ContrastScore = 0.0;
hv_Contrast = 0.0;
hv_HomogeneityScore = 0.0;
HOperatorSet.CountObj(ho_Marks, out hv_Number);
if ((int)(new HTuple(hv_Number.TupleLess(4))) != 0)
{
ho_Region.Dispose();
ho_RegionDilation.Dispose();
return;
}
ho_Region.Dispose();
HOperatorSet.GenRegionContourXld(ho_Marks, out ho_Region, "margin");
ho_RegionDilation.Dispose();
HOperatorSet.DilationCircle(ho_Region, out ho_RegionDilation, 5.5);
HOperatorSet.MinMaxGray(ho_RegionDilation, ho_Image, 3, out hv_Min, out hv_Max,
out hv_Range);
//Calculate contrast score
hv_Contrast = hv_Range.TupleMean();
hv_MinContrast = 70;
hv_MaxContrast = 160;
if ((int)(new HTuple(hv_Contrast.TupleGreater(hv_MinContrast))) != 0)
{
hv_ContrastScore = (hv_Contrast - hv_MinContrast) / (hv_MaxContrast - hv_MinContrast);
hv_ContrastScore = ((hv_ContrastScore.TupleConcat(1.0))).TupleMin();
}
//Now for the homogeneity score
HOperatorSet.TupleDeviation(hv_Max, out hv_DeviationMax);
hv_HomogeneityScore = 1.1 - (hv_DeviationMax / 40.0);
hv_HomogeneityScore = ((((((hv_HomogeneityScore.TupleConcat(1.0))).TupleMin()
)).TupleConcat(0.0))).TupleMax();
ho_Region.Dispose();
ho_RegionDilation.Dispose();
return;
}
示例2: Action
//.........这里部分代码省略.........
));
hv_A_1_1_Y = (hv_STD_A_1_1_V_Row * (hv_Img_Rotate_Angle.TupleCos())) - (hv_STD_A_1_1_V_Col * (hv_Img_Rotate_Angle.TupleSin()
));
//目前圖形 A_1_1_ 位置
hv_A_1_1_Pos_Row = (hv_STD_Row + hv_A_1_1_Y) + hv_OffsetRow;
hv_A_1_1_Pos_Col = (hv_STD_Col + hv_A_1_1_X) + hv_OffsetCol;
hv_Corner_W = 30;
hv_Corner_H = 120;
ho_A_1_1_Rectangle.Dispose();
HOperatorSet.GenRectangle2(out ho_A_1_1_Rectangle, hv_A_1_1_Pos_Row, hv_A_1_1_Pos_Col,
hv_Img_Rotate_Angle, hv_Corner_W, hv_Corner_H);
ho_A_1_1_Image.Dispose();
HOperatorSet.ReduceDomain(ho_Image, ho_A_1_1_Rectangle, out ho_A_1_1_Image);
//corner detect
hv_low = 60;
hv_high = 90;
ho_A_1_1_Edges.Dispose();
HOperatorSet.EdgesSubPix(ho_A_1_1_Image, out ho_A_1_1_Edges, "lanser2", 0.3,
hv_low, hv_high);
hv_algo = "lines";
ho_A_1_1_Contours.Dispose();
HOperatorSet.SegmentContoursXld(ho_A_1_1_Edges, out ho_A_1_1_Contours, hv_algo,
9, 4, 2);
//取長線段
ho_A_1_1_SelectedLines.Dispose();
HOperatorSet.SelectShapeXld(ho_A_1_1_Contours, out ho_A_1_1_SelectedLines,
"contlength", "and", 50, 99999);
HOperatorSet.CountObj(ho_A_1_1_SelectedLines, out hv_A_1_1Number);
if ((int)(new HTuple(hv_A_1_1Number.TupleGreater(0))) != 0)
{
ho_A_1_1_Line.Dispose();
HOperatorSet.SelectObj(ho_A_1_1_SelectedLines, out ho_A_1_1_Line, 1);
HOperatorSet.FitLineContourXld(ho_A_1_1_Line, "tukey", -1, 0, 5, 2, out hv_A_1_1_LineRowBegin,
out hv_A_1_1_LineColBegin, out hv_A_1_1_LineRowEnd, out hv_A_1_1_LineColEnd,
out hv_A_1_1_LineNr, out hv_A_1_1_LineNc, out hv_A_1_1_LineDist);
mResult = new DistanceResult()
{
FirstRowBegin = new HTuple(hv_A_1_1_LineRowBegin),
FirstColBegin = new HTuple(hv_A_1_1_LineColBegin),
FirstRowEnd = new HTuple(hv_A_1_1_LineRowEnd),
FirstColEnd = new HTuple(hv_A_1_1_LineColEnd),
Angle = this.hv_AllModelAngle,
};
}
//*********
//****A_1_2
//STD A_1_2_ 位置
hv_STD_A_1_2_Row = 997;
hv_STD_A_1_2_Col = 1376;
//STD 向量 STD_A_1_2_
hv_STD_A_1_2_V_Row = hv_STD_A_1_2_Row - hv_STD_Row;
hv_STD_A_1_2_V_Col = hv_STD_A_1_2_Col - hv_STD_Col;
//A_1_2_X, A_1_2_Y 分量
hv_A_1_2_X = (hv_STD_A_1_2_V_Col * (hv_Img_Rotate_Angle.TupleCos())) + (hv_STD_A_1_2_V_Row * (hv_Img_Rotate_Angle.TupleSin()
));
hv_A_1_2_Y = (hv_STD_A_1_2_V_Row * (hv_Img_Rotate_Angle.TupleCos())) - (hv_STD_A_1_2_V_Col * (hv_Img_Rotate_Angle.TupleSin()
示例3: Action
//.........这里部分代码省略.........
hv_STD_R17_V_Row = hv_STD_R17_Row - hv_STD_Row;
hv_STD_R17_V_Col = hv_STD_R17_Col - hv_STD_Col;
//R17_X, R17_Y 分量
hv_R17_X = (hv_STD_R17_V_Col * (hv_Img_Rotate_Angle.TupleCos())) + (hv_STD_R17_V_Row * (hv_Img_Rotate_Angle.TupleSin()
));
hv_R17_Y = (hv_STD_R17_V_Row * (hv_Img_Rotate_Angle.TupleCos())) - (hv_STD_R17_V_Col * (hv_Img_Rotate_Angle.TupleSin()
));
//目前圖形 R17_ 位置
hv_R17_Pos_Row = (hv_STD_Row + hv_R17_Y) + hv_OffsetRow;
hv_R17_Pos_Col = (hv_STD_Col + hv_R17_X) + hv_OffsetCol;
hv_R17_R = 17;
ho_R17_Circle.Dispose();
HOperatorSet.GenCircle(out ho_R17_Circle, hv_R17_Pos_Row, hv_R17_Pos_Col, hv_R17_R);
if (HDevWindowStack.IsOpen())
{
//dev_display (R17_Circle)
}
//stop ()
ho_R17_ROI_Image.Dispose();
HOperatorSet.ReduceDomain(ho_Image, ho_R17_Circle, out ho_R17_ROI_Image);
ho_R17_Region.Dispose();
HOperatorSet.FastThreshold(ho_R17_ROI_Image, out ho_R17_Region, 100, 255, 15);
ho_R17_ImageReduced.Dispose();
HOperatorSet.ReduceDomain(ho_R17_ROI_Image, ho_R17_Region, out ho_R17_ImageReduced
);
//stop ()
//sobel_fast 具有較寬的選擇範圍,搭配 alpha 參數 (alpha 越大, 容錯範圍大)
hv_alpha = 0.9;
hv_R17_low = 10;
hv_R17_high = 60;
ho_R17_Edges.Dispose();
HOperatorSet.EdgesSubPix(ho_R17_ImageReduced, out ho_R17_Edges, "sobel_fast",
hv_alpha, hv_R17_low, hv_R17_high);
//stop ()
//*所有的數值越小,表示容錯範圍大,反之亦然
ho_R17_ContoursSplit.Dispose();
HOperatorSet.SegmentContoursXld(ho_R17_Edges, out ho_R17_ContoursSplit, "lines_circles",
17, 1, 1);
//Display the results
//===========================================================
HOperatorSet.CountObj(ho_R17_ContoursSplit, out hv_R17_NumSegments);
hv_NumCircles = 0;
hv_Num_Circle_Point = 0;
hv_R17 = 999;
for (hv_i = 1; hv_i.Continue(hv_R17_NumSegments, 1); hv_i = hv_i.TupleAdd(1))
{
ho_R17_SingleSegment.Dispose();
HOperatorSet.SelectObj(ho_R17_ContoursSplit, out ho_R17_SingleSegment, hv_i);
HOperatorSet.GetContourGlobalAttribXld(ho_R17_SingleSegment, "cont_approx",
out hv_Attrib);
if ((int)(new HTuple(hv_Attrib.TupleEqual(1))) != 0)
{
HOperatorSet.FitCircleContourXld(ho_R17_SingleSegment, "atukey", -1, 2,
hv_Num_Circle_Point, 5, 2, out hv_R17_Row, out hv_R17_Column, out hv_R17_Radius,
out hv_R17_StartPhi, out hv_R17_EndPhi, out hv_R17_PointOrder);
ho_R17_ContEllipse.Dispose();
HOperatorSet.GenEllipseContourXld(out ho_R17_ContEllipse, hv_R17_Row, hv_R17_Column,
0, hv_R17_Radius, hv_R17_Radius, 0, (new HTuple(360)).TupleRad(), "positive",
1.0);
if (HDevWindowStack.IsOpen())
{
HOperatorSet.DispObj(ho_R17_ContEllipse, HDevWindowStack.GetActive());
}
HOperatorSet.DistEllipseContourXld(ho_R17_SingleSegment, "algebraic", -1,
0, hv_R17_Row, hv_R17_Column, 0, hv_R17_Radius, hv_R17_Radius, out hv_R17_MinDist,
out hv_R17_MaxDist, out hv_R17_AvgDist, out hv_R17_SigmaDist);
hv_NumCircles = hv_NumCircles + 1;
if ((int)(new HTuple(hv_R17.TupleGreater(hv_R17_Radius))) != 0)
{
hv_R17 = hv_R17_Radius.Clone();
mResult = new CircleResult()
{
Row = new HTuple(hv_R17_Row),
Col = new HTuple(hv_R17_Column),
Radius = new HTuple(hv_R17_Radius),
StartPhi = new HTuple(hv_R17_StartPhi),
EndPhi = new HTuple(hv_R17_EndPhi),
PointOrder = new HTuple(hv_R17_PointOrder),
};
}
//stop ()
}
}
ho_R17_Circle.Dispose();
ho_R17_ROI_Image.Dispose();
ho_R17_Region.Dispose();
ho_R17_ImageReduced.Dispose();
ho_R17_Edges.Dispose();
ho_R17_ContoursSplit.Dispose();
ho_R17_SingleSegment.Dispose();
ho_R17_ContEllipse.Dispose();
return mResult;
}
示例4: Action
//.........这里部分代码省略.........
hv_STD_R1_V_Row = hv_STD_R1_Row - hv_STD_Row;
hv_STD_R1_V_Col = hv_STD_R1_Col - hv_STD_Col;
//R1_X, R1_Y 分量
hv_R1_X = (hv_STD_R1_V_Col * (hv_Img_Rotate_Angle.TupleCos())) + (hv_STD_R1_V_Row * (hv_Img_Rotate_Angle.TupleSin()
));
hv_R1_Y = (hv_STD_R1_V_Row * (hv_Img_Rotate_Angle.TupleCos())) - (hv_STD_R1_V_Col * (hv_Img_Rotate_Angle.TupleSin()
));
//目前圖形 R1_ 位置
hv_R1_Pos_Row = (hv_STD_Row + hv_R1_Y) + hv_OffsetRow;
hv_R1_Pos_Col = (hv_STD_Col + hv_R1_X) + hv_OffsetCol;
hv_R1_R = 20;
//*ROI
ho_R1_Circle.Dispose();
HOperatorSet.GenCircle(out ho_R1_Circle, hv_R1_Pos_Row, hv_R1_Pos_Col, hv_R1_R);
ho_R1_ROI_Image.Dispose();
HOperatorSet.ReduceDomain(ho_Image, ho_R1_Circle, out ho_R1_ROI_Image);
ho_R1_Region.Dispose();
HOperatorSet.FastThreshold(ho_R1_ROI_Image, out ho_R1_Region, 100, 255, 20);
ho_R1_ImageReduced.Dispose();
HOperatorSet.ReduceDomain(ho_R1_ROI_Image, ho_R1_Region, out ho_R1_ImageReduced
);
//sobel_fast 具有較寬的選擇範圍,搭配 alpha 參數 (alpha 越大, 容錯範圍大)
hv_alpha = 0.9;
hv_R1_low = 20;
hv_R1_high = 40;
ho_R1_Edges.Dispose();
HOperatorSet.EdgesSubPix(ho_R1_ImageReduced, out ho_R1_Edges, "sobel_fast",
hv_alpha, hv_R1_low, hv_R1_high);
//stop ()
//*所有的數值越小,表示容錯範圍大,反之亦然
ho_R1_ContoursSplit.Dispose();
HOperatorSet.SegmentContoursXld(ho_R1_Edges, out ho_R1_ContoursSplit, "lines_circles",
17, 1, 1);
//Display the results
//===========================================================
HOperatorSet.CountObj(ho_R1_ContoursSplit, out hv_R1_NumSegments);
hv_NumCircles = 0;
hv_Num_Circle_Point = 5;
hv_R1 = 999;
hv_R1_limit = 10;
for (hv_i = 1; hv_i.Continue(hv_R1_NumSegments, 1); hv_i = hv_i.TupleAdd(1))
{
ho_R1_SingleSegment.Dispose();
HOperatorSet.SelectObj(ho_R1_ContoursSplit, out ho_R1_SingleSegment, hv_i);
HOperatorSet.GetContourGlobalAttribXld(ho_R1_SingleSegment, "cont_approx", out hv_Attrib);
if ((int)(new HTuple(hv_Attrib.TupleEqual(1))) != 0)
{
HOperatorSet.FitCircleContourXld(ho_R1_SingleSegment, "atukey", -1, 2,
hv_Num_Circle_Point, 5, 2, out hv_R1_Row, out hv_R1_Column, out hv_R1_Radius,
out hv_R1_StartPhi, out hv_R1_EndPhi, out hv_R1_PointOrder);
//ho_R1_ContEllipse.Dispose();
//HOperatorSet.GenEllipseContourXld(out ho_R1_ContEllipse, hv_R1_Row, hv_R1_Column,
// 0, hv_R1_Radius, hv_R1_Radius, 0, (new HTuple(360)).TupleRad(), "positive",
// 1.0);
//HOperatorSet.DistEllipseContourXld(ho_R1_SingleSegment, "algebraic", -1,
// 0, hv_R1_Row, hv_R1_Column, 0, hv_R1_Radius, hv_R1_Radius, out hv_R1_MinDist,
// out hv_R1_MaxDist, out hv_R1_AvgDist, out hv_R1_SigmaDist);
hv_NumCircles = hv_NumCircles + 1;
if ((int)(new HTuple(hv_R1.TupleGreater(hv_R1_Radius))) != 0)
{
hv_R1 = hv_R1_Radius.Clone();
//hv_ResultText = (((("C" + hv_NumCircles) + ": Radius = ") + (hv_R1_Radius.TupleString(
// ".3"))) + " / MaxDeviation: ") + (hv_R1_MaxDist.TupleString(".3"));
//HOperatorSet.SetTposition(hv_WindowHandle, hv_R1_Pos_Row - hv_msgOffsetY,
// hv_R1_Pos_Col - hv_msgOffsetX);
//HOperatorSet.WriteString(hv_WindowHandle, "R1");
#region 組合結果
mResult = new CircleResult(new HTuple(hv_R1_Row)
, new HTuple(hv_R1_Column)
, new HTuple(hv_R1_Radius)
, new HTuple(hv_R1_StartPhi)
, new HTuple(hv_R1_EndPhi)
, new HTuple(hv_R1_PointOrder)) { };
#endregion
}
}
}
hv_MeasureReasult = hv_R1.Clone();
//****R1 End
//ho_Image.Dispose();
ho_R1_Circle.Dispose();
ho_R1_ROI_Image.Dispose();
ho_R1_Region.Dispose();
ho_R1_ImageReduced.Dispose();
ho_R1_Edges.Dispose();
ho_R1_ContoursSplit.Dispose();
ho_R1_SingleSegment.Dispose();
//ho_R1_ContEllipse.Dispose();
return mResult;
}
示例5: Action
//.........这里部分代码省略.........
}
if (HDevWindowStack.IsOpen())
{
HOperatorSet.DispObj(ho_Image, HDevWindowStack.GetActive());
}
//*****R3
hv_R3_R = 29;
//STD R3_ 位置
hv_STD_R3_Row = 252;
hv_STD_R3_Col = 1381;
//STD 向量 STD_R3_
hv_STD_R3_V_Row = hv_STD_R3_Row - hv_STD_Row;
hv_STD_R3_V_Col = hv_STD_R3_Col - hv_STD_Col;
//R3_X, R3_Y 分量
hv_R3_X = (hv_STD_R3_V_Col * (hv_Img_Rotate_Angle.TupleCos())) + (hv_STD_R3_V_Row * (hv_Img_Rotate_Angle.TupleSin()
));
hv_R3_Y = (hv_STD_R3_V_Row * (hv_Img_Rotate_Angle.TupleCos())) - (hv_STD_R3_V_Col * (hv_Img_Rotate_Angle.TupleSin()
));
//目前圖形 R3_ 位置
hv_R3_Pos_Row = (hv_STD_Row + hv_R3_Y) + hv_OffsetRow;
hv_R3_Pos_Col = (hv_STD_Col + hv_R3_X) + hv_OffsetCol;
//** 開始計算
ho_R3_Circle.Dispose();
HOperatorSet.GenCircle(out ho_R3_Circle, hv_R3_Pos_Row, hv_R3_Pos_Col, hv_R3_R);
ho_R3_ROI_Image.Dispose();
HOperatorSet.ReduceDomain(ho_Image, ho_R3_Circle, out ho_R3_ROI_Image);
ho_R3_Region.Dispose();
HOperatorSet.FastThreshold(ho_R3_ROI_Image, out ho_R3_Region, 100, 255, 15);
ho_R3_ImageReduced.Dispose();
HOperatorSet.ReduceDomain(ho_R3_ROI_Image, ho_R3_Region, out ho_R3_ImageReduced
);
//stop ()
//sobel_fast 具有較寬的選擇範圍,搭配 alpha 參數 (alpha 越大, 容錯範圍大)
hv_alpha = 0.9;
hv_R3_low = 20;
hv_R3_high = 60;
ho_R3_Edges.Dispose();
HOperatorSet.EdgesSubPix(ho_R3_ImageReduced, out ho_R3_Edges, "sobel_fast",
hv_alpha, hv_R3_low, hv_R3_high);
//stop ()
//*所有的數值越小,表示容錯範圍大,反之亦然
ho_R3_ContoursSplit.Dispose();
HOperatorSet.SegmentContoursXld(ho_R3_Edges, out ho_R3_ContoursSplit, "lines_circles",
17, 4, 2);
//Display the results
//===========================================================
HOperatorSet.CountObj(ho_R3_ContoursSplit, out hv_R3_NumSegments);
hv_NumCircles = 0;
hv_Num_Circle_Point = 0;
hv_R3 = 999;
for (hv_i = 1; hv_i.Continue(hv_R3_NumSegments, 1); hv_i = hv_i.TupleAdd(1))
{
ho_R3_SingleSegment.Dispose();
HOperatorSet.SelectObj(ho_R3_ContoursSplit, out ho_R3_SingleSegment, hv_i);
HOperatorSet.GetContourGlobalAttribXld(ho_R3_SingleSegment, "cont_approx",
out hv_Attrib);
if ((int)(new HTuple(hv_Attrib.TupleEqual(1))) != 0)
{
HOperatorSet.FitCircleContourXld(ho_R3_SingleSegment, "atukey", -1, 2,
hv_Num_Circle_Point, 5, 2, out hv_R3_Row, out hv_R3_Column, out hv_R3_Radius,
out hv_R3_StartPhi, out hv_R3_EndPhi, out hv_R3_PointOrder);
hv_NumCircles = hv_NumCircles + 1;
if ((int)(new HTuple(hv_R3.TupleGreater(hv_R3_Radius))) != 0)
{
hv_R3 = hv_R3_Radius.Clone();
mResult = new CircleResult()
{
Row = new HTuple(hv_R3_Row),
Col = new HTuple(hv_R3_Column),
Radius = new HTuple(hv_R3_Radius),
StartPhi = new HTuple(hv_R3_StartPhi),
EndPhi = new HTuple(hv_R3_EndPhi),
PointOrder = new HTuple(hv_R3_PointOrder),
};
//HOperatorSet.SetTposition(hv_WindowHandle, (hv_R3_Pos_Row - hv_msgOffsetY) + 60,
// (hv_R3_Pos_Col + hv_msgOffsetX) - 60);
//HOperatorSet.WriteString(hv_WindowHandle, "R3");
//stop ()
}
}
}
//*****R3 End
ho_R3_Circle.Dispose();
ho_R3_ROI_Image.Dispose();
ho_R3_Region.Dispose();
ho_R3_ImageReduced.Dispose();
ho_R3_Edges.Dispose();
ho_R3_ContoursSplit.Dispose();
ho_R3_SingleSegment.Dispose();
ho_R3_ContEllipse.Dispose();
return mResult;
}
示例6: Action
//.........这里部分代码省略.........
ho_A2_Region.Dispose();
HOperatorSet.GenRectangle2(out ho_A2_Region, hv_A2_1_1_Pos_Row, hv_A2_1_1_Pos_Col,
hv_Img_Rotate_Angle, hv_A2_ROI_W, hv_A2_ROI_H);
//stop ()
ho_A2_Reduced.Dispose();
HOperatorSet.ReduceDomain(ho_Image, ho_A2_Region, out ho_A2_Reduced);
//fit_Rectangle
//stop ()
//
ho_A2Region.Dispose();
HOperatorSet.FastThreshold(ho_A2_Reduced, out ho_A2Region, 50, 150, 20);
ho_A2_RegionBorder.Dispose();
HOperatorSet.Boundary(ho_A2Region, out ho_A2_RegionBorder, "inner");
hv_Rec_W = 11;
hv_Rec_H = 11;
ho_A2_RegionDilation.Dispose();
HOperatorSet.DilationRectangle1(ho_A2_RegionBorder, out ho_A2_RegionDilation,
hv_Rec_W, hv_Rec_H);
hv_A2_Alpha = 0.9;
hv_a2low = 20;
hv_a2high = 110;
ho_A2_Edges.Dispose();
HOperatorSet.EdgesSubPix(ho_A2_Reduced, out ho_A2_Edges, "canny", hv_A2_Alpha,
hv_a2low, hv_a2high);
//stop ()
hv_a2Limit = 200;
ho_A2_Rectangles.Dispose();
HOperatorSet.SelectShapeXld(ho_A2_Edges, out ho_A2_Rectangles, "contlength",
"and", hv_a2Limit, 99999);
HOperatorSet.CountObj(ho_A2_Rectangles, out hv_A2_RecNumber);
while ((int)(new HTuple(hv_A2_RecNumber.TupleGreater(1))) != 0)
{
hv_a2Limit = hv_a2Limit + 10;
ho_A2_Rectangles.Dispose();
HOperatorSet.SelectShapeXld(ho_A2_Edges, out ho_A2_Rectangles, "contlength",
"and", hv_a2Limit, 99999);
HOperatorSet.CountObj(ho_A2_Rectangles, out hv_A2_RecNumber);
}
//stop ()
HOperatorSet.FitRectangle2ContourXld(ho_A2_Rectangles, "regression", -1, 0,
0, 3, 2, out hv_A2Row, out hv_A2Column, out hv_A2Phi, out hv_A2Length1,
out hv_A2Length2, out hv_A2PointOrder);
HOperatorSet.CountObj(ho_A2_Rectangles, out hv_A2Number);
//取A2
if ((int)(new HTuple(hv_A2Number.TupleGreater(0))) != 0)
{
hv_A2_Center_X = hv_A2Column[0];
hv_A2_Center_Y = hv_A2Row[0];
ho_A2Cross.Dispose();
HOperatorSet.GenCrossContourXld(out ho_A2Cross, hv_A2Row, hv_A2Column, 10, 0);
mResult = new LineResult()
{
Row1 = new HTuple(hv_A2Row),
Col1 = new HTuple(hv_A2Column),
};
}
#endregion
//step 2 取點 A3,金手指由右數來第一個的中心點
hv_A3_Center_X = 0;
hv_A3_Center_Y = 0;
//****A3
示例7: Action
//.........这里部分代码省略.........
// //dev_display (Image)
//}
//if (HDevWindowStack.IsOpen())
//{
// //dev_display (A2_Region)
//}
//stop ()
//
ho_A2Region.Dispose();
HOperatorSet.FastThreshold(ho_A2_Reduced, out ho_A2Region, 50, 150, 20);
ho_A2_RegionBorder.Dispose();
HOperatorSet.Boundary(ho_A2Region, out ho_A2_RegionBorder, "inner");
if (HDevWindowStack.IsOpen())
{
//dev_display (A2_RegionBorder)
}
hv_Rec_W = 11;
hv_Rec_H = 11;
ho_A2_RegionDilation.Dispose();
HOperatorSet.DilationRectangle1(ho_A2_RegionBorder, out ho_A2_RegionDilation,
hv_Rec_W, hv_Rec_H);
hv_A2_Alpha = 0.9;
hv_a2low = 20;
hv_a2high = 110;
ho_A2_Edges.Dispose();
HOperatorSet.EdgesSubPix(ho_A2_Reduced, out ho_A2_Edges, "canny", hv_A2_Alpha,
hv_a2low, hv_a2high);
//stop ()
hv_a2Limit = 200;
ho_A2_Rectangles.Dispose();
HOperatorSet.SelectShapeXld(ho_A2_Edges, out ho_A2_Rectangles, "contlength",
"and", hv_a2Limit, 99999);
HOperatorSet.CountObj(ho_A2_Rectangles, out hv_A2_RecNumber);
while ((int)(new HTuple(hv_A2_RecNumber.TupleGreater(1))) != 0)
{
hv_a2Limit = hv_a2Limit + 10;
ho_A2_Rectangles.Dispose();
HOperatorSet.SelectShapeXld(ho_A2_Edges, out ho_A2_Rectangles, "contlength",
"and", hv_a2Limit, 99999);
HOperatorSet.CountObj(ho_A2_Rectangles, out hv_A2_RecNumber);
}
//stop ()
HOperatorSet.FitRectangle2ContourXld(ho_A2_Rectangles, "regression", -1, 0,
0, 3, 2, out hv_A2Row, out hv_A2Column, out hv_A2Phi, out hv_A2Length1,
out hv_A2Length2, out hv_A2PointOrder);
HOperatorSet.CountObj(ho_A2_Rectangles, out hv_A2Number);
//取A2
if ((int)(new HTuple(hv_A2Number.TupleGreater(0))) != 0)
{
hv_A2_Center_X = hv_A2Column[0];
hv_A2_Center_Y = hv_A2Row[0];
ho_A2Cross.Dispose();
HOperatorSet.GenCrossContourXld(out ho_A2Cross, hv_A2Row, hv_A2Column, 10,
0);
//if (HDevWindowStack.IsOpen())
//{
// HOperatorSet.DispObj(ho_A2Cross, HDevWindowStack.GetActive());
//}
//stop ()
}
//}
HOperatorSet.DistancePp(hv_A2_Center_Y, hv_A2_Center_X, hv_CL_Y, hv_CL_X, out hv_A2_Dist);
mResult = new LineResult(hv_A2_Center_Y, hv_A2_Center_X, hv_CL_Y, hv_CL_X, hv_A2_Dist);
//step 3