本文整理汇总了C#中HTuple.TupleAdd方法的典型用法代码示例。如果您正苦于以下问题:C# HTuple.TupleAdd方法的具体用法?C# HTuple.TupleAdd怎么用?C# HTuple.TupleAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTuple
的用法示例。
在下文中一共展示了HTuple.TupleAdd方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: Action
//.........这里部分代码省略.........
//R6_Region 由半徑 29 開始搜尋, 最大搜尋至 41, Inc =2
hv_R6_R = 29;
hv_R6_R_Max = 41;
hv_R6_R_Inc = 2;
while ((int)((new HTuple(hv_R6.TupleEqual(999))).TupleAnd(new HTuple(hv_R6_R.TupleLess(
hv_R6_R_Max)))) != 0)
{
//*******************************
ho_R6_Circle.Dispose();
HOperatorSet.GenCircle(out ho_R6_Circle, hv_R6_Pos_Row, hv_R6_Pos_Col, hv_R6_R);
ho_R6_ROI_Image.Dispose();
HOperatorSet.ReduceDomain(ho_Image, ho_R6_Circle, out ho_R6_ROI_Image);
ho_R6_Region.Dispose();
HOperatorSet.Threshold(ho_R6_ROI_Image, out ho_R6_Region, 100, 255);
ho_R6_RegionBorder.Dispose();
HOperatorSet.Boundary(ho_R6_Region, out ho_R6_RegionBorder, "inner");
ho_R6_RegionDilation.Dispose();
HOperatorSet.DilationCircle(ho_R6_RegionBorder, out ho_R6_RegionDilation,
1.5);
ho_R6_ImageReduced.Dispose();
HOperatorSet.ReduceDomain(ho_R6_ROI_Image, ho_R6_RegionDilation, out ho_R6_ImageReduced
);
ho_R6_Edges.Dispose();
HOperatorSet.EdgesSubPix(ho_R6_ImageReduced, out ho_R6_Edges, "lanser2",
0.3, 40, 90);
//fast_threshold (R6_ROI_Image, R6_Region, 80, 255, 15)
//reduce_domain (R6_ROI_Image, R6_Region, R6_ImageReduced)
//sobel_fast 具有較寬的選擇範圍,搭配 alpha 參數 (alpha 越大, 容錯範圍大)
//alpha := 10
//R6_low := 10
//R6_high := 60
//edges_sub_pix (R6_ImageReduced, R6_Edges, 'sobel_fast', alpha, R6_low, R6_high)
//stop ()
//*所有的數值越小,表示容錯範圍大,反之亦然
ho_R6_ContoursSplit.Dispose();
HOperatorSet.SegmentContoursXld(ho_R6_Edges, out ho_R6_ContoursSplit, "lines_circles",
6, 4, 4);
//Display the results
//===========================================================
HOperatorSet.CountObj(ho_R6_ContoursSplit, out hv_R6_NumSegments);
hv_NumCircles = 0;
hv_Num_Circle_Point = 0;
for (hv_i = 1; hv_i.Continue(hv_R6_NumSegments, 1); hv_i = hv_i.TupleAdd(1))
{
ho_R6_SingleSegment.Dispose();
HOperatorSet.SelectObj(ho_R6_ContoursSplit, out ho_R6_SingleSegment, hv_i);
HOperatorSet.GetContourGlobalAttribXld(ho_R6_SingleSegment, "cont_approx",
out hv_Attrib);
if ((int)(new HTuple(hv_Attrib.TupleEqual(1))) != 0)
{
HOperatorSet.FitCircleContourXld(ho_R6_SingleSegment, "atukey", -1, 2,
hv_Num_Circle_Point, 5, 2, out hv_R6_Row, out hv_R6_Column, out hv_R6_Radius,
out hv_R6_StartPhi, out hv_R6_EndPhi, out hv_R6_PointOrder);
ho_R6_ContEllipse.Dispose();
HOperatorSet.GenEllipseContourXld(out ho_R6_ContEllipse, hv_R6_Row, hv_R6_Column,
0, hv_R6_Radius, hv_R6_Radius, 0, (new HTuple(360)).TupleRad(), "positive",
1.0);
if (HDevWindowStack.IsOpen())
{
HOperatorSet.DispObj(ho_R6_ContEllipse, HDevWindowStack.GetActive()
);
}
HOperatorSet.DistEllipseContourXld(ho_R6_SingleSegment, "algebraic",
-1, 0, hv_R6_Row, hv_R6_Column, 0, hv_R6_Radius, hv_R6_Radius, out hv_R6_MinDist,
out hv_R6_MaxDist, out hv_R6_AvgDist, out hv_R6_SigmaDist);
hv_NumCircles = hv_NumCircles + 1;
if ((int)(new HTuple(hv_R6.TupleGreater(hv_R6_Radius))) != 0)
{
hv_R6 = hv_R6_Radius.Clone();
mResult = new CircleResult()
{
Row = new HTuple(hv_R6_Row),
Col = new HTuple(hv_R6_Column),
Radius = new HTuple(hv_R6_Radius),
StartPhi = new HTuple(hv_R6_StartPhi),
EndPhi = new HTuple(hv_R6_EndPhi),
PointOrder = new HTuple(hv_R6_PointOrder),
};
}
}
}
hv_R6_R = hv_R6_R + hv_R6_R_Inc;
}
ho_R6_Circle.Dispose();
ho_R6_ROI_Image.Dispose();
ho_R6_Region.Dispose();
ho_R6_RegionBorder.Dispose();
ho_R6_RegionDilation.Dispose();
ho_R6_ImageReduced.Dispose();
ho_R6_Edges.Dispose();
ho_R6_ContoursSplit.Dispose();
ho_R6_SingleSegment.Dispose();
ho_R6_ContEllipse.Dispose();
return mResult;
}