本文整理汇总了C#中HTuple.TupleLength方法的典型用法代码示例。如果您正苦于以下问题:C# HTuple.TupleLength方法的具体用法?C# HTuple.TupleLength怎么用?C# HTuple.TupleLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTuple
的用法示例。
在下文中一共展示了HTuple.TupleLength方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetIADynamicParamTuple
/// <summary>
///
/// </summary>
public void SetIADynamicParamTuple(HTuple paramName,
HTuple paramValue)
{
string parameterName;
int indexOfdo_;
// Check if the input parameters are valid
if ((paramName.TupleLength() > 0) &&
(paramName.TupleLength() == paramValue.TupleLength()))
{
// get string value of parameter name
parameterName = paramName[0].S;
// get the index of the string "do_"
indexOfdo_ = parameterName.IndexOf("do_");
try
{
frameGrabber.SetFramegrabberParam(paramName,
paramValue);
// check if the parameter ist a "do_"-parameter
// these parameter cannot be read with the method
// get_framegrabber_param()
if (indexOfdo_ == -1)
{
// Acquire the changed value from IA Interface
paramValue =
frameGrabber.GetFramegrabberParam(paramName);
}
// fire event, to notify the main program,
// that the IA parameter has changed
if (OnParameterChange != null)
OnParameterChange(this, parameterName,
paramValue);
}
catch (HOperatorException exc)
{
throw exc;
}
// add the entry to the list to
// record the order of parameter settings
AddAdjustedParamToHistoryList(parameterName,paramValue);
}
else
{
throw new ArgumentException("Invalid name of IA" +
" parameter!");
}
}
示例2: tuple_equal_greater
private void tuple_equal_greater(HTuple hv_Tuple,
HTuple hv_Threshold,
out HTuple hv_Selected,
out HTuple hv_Indices)
{
// Local control variables
HTuple hv_Sgn;
// Initialize local and output iconic variables
hv_Selected = new HTuple();
HOperatorSet.TupleSgn(hv_Tuple - hv_Threshold, out hv_Sgn);
HOperatorSet.TupleFind(hv_Sgn, 1, out hv_Indices);
if ((int)((new HTuple((new HTuple(hv_Indices.TupleLength())).TupleGreater(1))).TupleOr(
new HTuple(((hv_Indices.TupleSelect(0))).TupleNotEqual(-1)))) != 0)
{
HOperatorSet.TupleSelect(hv_Tuple, hv_Indices, out hv_Selected);
}
return;
}
示例3: disp_3d_coord_system
/// <summary>
/// Display the axes of a 3d coordinate system.
/// </summary>
private void disp_3d_coord_system(HTuple hv_WindowHandle,
HTuple hv_CamParam,
HTuple hv_Pose,
HTuple hv_CoordAxesLength)
{
// Local iconic variables
HObject ho_ContX, ho_ContY, ho_ContZ;
// Local control variables
HTuple hv_TransWorld2Cam, hv_OrigCamX, hv_OrigCamY;
HTuple hv_OrigCamZ, hv_Row0, hv_Column0, hv_X, hv_Y, hv_Z;
HTuple hv_RowAxX, hv_ColumnAxX, hv_RowAxY, hv_ColumnAxY;
HTuple hv_RowAxZ, hv_ColumnAxZ;
// Initialize local and output iconic variables
HOperatorSet.GenEmptyObj(out ho_ContX);
HOperatorSet.GenEmptyObj(out ho_ContY);
HOperatorSet.GenEmptyObj(out ho_ContZ);
if ((int)(new HTuple((new HTuple(hv_Pose.TupleLength())).TupleNotEqual(7))) != 0)
{
ho_ContX.Dispose();
ho_ContY.Dispose();
ho_ContZ.Dispose();
return;
}
if ((int)(new HTuple(((hv_Pose.TupleSelect(5))).TupleEqual(0.0))) != 0)
{
ho_ContX.Dispose();
ho_ContY.Dispose();
ho_ContZ.Dispose();
return;
}
HOperatorSet.PoseToHomMat3d(hv_Pose, out hv_TransWorld2Cam);
//Project the world origin into the image
HOperatorSet.AffineTransPoint3d(hv_TransWorld2Cam, 0, 0, 0, out hv_OrigCamX,
out hv_OrigCamY, out hv_OrigCamZ);
HOperatorSet.Project3dPoint(hv_OrigCamX, hv_OrigCamY, hv_OrigCamZ, hv_CamParam,
out hv_Row0, out hv_Column0);
//Project the coordinate axes into the image
HOperatorSet.AffineTransPoint3d(hv_TransWorld2Cam, hv_CoordAxesLength, 0, 0,
out hv_X, out hv_Y, out hv_Z);
HOperatorSet.Project3dPoint(hv_X, hv_Y, hv_Z, hv_CamParam, out hv_RowAxX, out hv_ColumnAxX);
HOperatorSet.AffineTransPoint3d(hv_TransWorld2Cam, 0, hv_CoordAxesLength, 0,
out hv_X, out hv_Y, out hv_Z);
HOperatorSet.Project3dPoint(hv_X, hv_Y, hv_Z, hv_CamParam, out hv_RowAxY, out hv_ColumnAxY);
HOperatorSet.AffineTransPoint3d(hv_TransWorld2Cam, 0, 0, hv_CoordAxesLength,
out hv_X, out hv_Y, out hv_Z);
HOperatorSet.Project3dPoint(hv_X, hv_Y, hv_Z, hv_CamParam, out hv_RowAxZ, out hv_ColumnAxZ);
ho_ContX.Dispose();
gen_arrow_cont(out ho_ContX, hv_Row0, hv_Column0, hv_RowAxX, hv_ColumnAxX);
ho_ContY.Dispose();
gen_arrow_cont(out ho_ContY, hv_Row0, hv_Column0, hv_RowAxY, hv_ColumnAxY);
ho_ContZ.Dispose();
gen_arrow_cont(out ho_ContZ, hv_Row0, hv_Column0, hv_RowAxZ, hv_ColumnAxZ);
if (HDevWindowStack.IsOpen())
{
//dev_display (ContX)
}
if (HDevWindowStack.IsOpen())
{
//dev_display (ContY)
}
if (HDevWindowStack.IsOpen())
{
//dev_display (ContZ)
}
HOperatorSet.DispObj(ho_ContX, hv_WindowHandle);
HOperatorSet.DispObj(ho_ContY, hv_WindowHandle);
HOperatorSet.DispObj(ho_ContZ, hv_WindowHandle);
HOperatorSet.SetTposition(hv_WindowHandle, hv_RowAxX + 3, hv_ColumnAxX + 3);
HOperatorSet.WriteString(hv_WindowHandle, "X");
HOperatorSet.SetTposition(hv_WindowHandle, hv_RowAxY + 3, hv_ColumnAxY + 3);
HOperatorSet.WriteString(hv_WindowHandle, "Y");
HOperatorSet.SetTposition(hv_WindowHandle, hv_RowAxZ + 3, hv_ColumnAxZ + 3);
HOperatorSet.WriteString(hv_WindowHandle, "Z");
ho_ContX.Dispose();
ho_ContY.Dispose();
ho_ContZ.Dispose();
return;
}
示例4: find_caltab_edges
//.........这里部分代码省略.........
ho_RegionDilation2.Dispose();
HOperatorSet.DilationCircle(ho_RegionBorder1, out ho_RegionDilation2, 3.5);
ho_RegionDifference1.Dispose();
HOperatorSet.Difference(ho_RegionDynThresh, ho_RegionDilation2, out ho_RegionDifference1
);
ho_RegionOpening.Dispose();
HOperatorSet.OpeningCircle(ho_RegionDifference1, out ho_RegionOpening, (hv_Width / 640) * 1.5);
ho_ConnectedRegions.Dispose();
HOperatorSet.Connection(ho_RegionOpening, out ho_ConnectedRegions);
ho_SelectedRegions2.Dispose();
HOperatorSet.SelectShape(ho_ConnectedRegions, out ho_SelectedRegions2, "area",
"and", (hv_EstimatedCaltabSize.TuplePow(2)) / 10, (hv_EstimatedCaltabSize.TuplePow(
2)) * 5);
ho_SelectedRegions.Dispose();
HOperatorSet.SelectShape(ho_SelectedRegions2, out ho_SelectedRegions, "compactness",
"and", 1.4, 10);
ho_RegionFillUp.Dispose();
HOperatorSet.FillUp(ho_SelectedRegions, out ho_RegionFillUp);
ho_SelectedRegions1.Dispose();
HOperatorSet.SelectShape(ho_RegionFillUp, out ho_SelectedRegions1, "rectangularity",
"and", 0.6, 1);
ho_RegionIntersection.Dispose();
HOperatorSet.Intersection(ho_SelectedRegions1, ho_RegionDynThresh, out ho_RegionIntersection
);
ho_RegionFillUp1.Dispose();
HOperatorSet.FillUp(ho_RegionIntersection, out ho_RegionFillUp1);
ho_RegionDifference.Dispose();
HOperatorSet.Difference(ho_RegionFillUp1, ho_RegionIntersection, out ho_RegionDifference
);
HOperatorSet.CountObj(ho_RegionDifference, out hv_Number);
ho_CaltabCandidates.Dispose();
HOperatorSet.GenEmptyObj(out ho_CaltabCandidates);
HOperatorSet.CaltabPoints(hv_DescriptionFileName, out hv_X, out hv_Y, out hv_Z);
hv_NumDescrMarks = new HTuple(hv_X.TupleLength());
for (hv_Index = 1; hv_Index.Continue(hv_Number, 1); hv_Index = hv_Index.TupleAdd(1))
{
ho_ObjectSelected.Dispose();
HOperatorSet.SelectObj(ho_RegionDifference, out ho_ObjectSelected, hv_Index);
ho_ConnectedMarks.Dispose();
HOperatorSet.Connection(ho_ObjectSelected, out ho_ConnectedMarks);
HOperatorSet.CountObj(ho_ConnectedMarks, out hv_NumberMarks);
HOperatorSet.Eccentricity(ho_ConnectedMarks, out hv_Anisometry, out hv_Bulkiness,
out hv_StructureFactor);
HOperatorSet.AreaCenter(ho_ConnectedMarks, out hv_AreaMarks, out hv_Row, out hv_Column);
ho_ObjectSelectedCaltab.Dispose();
HOperatorSet.SelectObj(ho_RegionIntersection, out ho_ObjectSelectedCaltab,
hv_Index);
if ((int)((new HTuple((new HTuple((new HTuple(hv_NumberMarks.TupleGreaterEqual(
10))).TupleAnd(new HTuple(hv_NumberMarks.TupleLess(hv_NumDescrMarks + 20))))).TupleAnd(
new HTuple(((((hv_Anisometry.TupleSort())).TupleSelect((new HTuple(hv_Anisometry.TupleLength()
)) / 2))).TupleLess(2))))).TupleAnd(new HTuple((new HTuple(hv_AreaMarks.TupleMean()
)).TupleGreater(20)))) != 0)
{
HOperatorSet.ConcatObj(ho_CaltabCandidates, ho_ObjectSelectedCaltab, out OTemp[0]
);
ho_CaltabCandidates.Dispose();
ho_CaltabCandidates = OTemp[0];
}
}
ho_RegionFillUpCand.Dispose();
HOperatorSet.FillUp(ho_CaltabCandidates, out ho_RegionFillUpCand);
HOperatorSet.Rectangularity(ho_RegionFillUpCand, out hv_Rectangularity);
if ((int)(new HTuple((new HTuple(hv_Rectangularity.TupleLength())).TupleEqual(
0))) != 0)
{
ho_ImageMean.Dispose();
示例5: eval_caltab_tilt
/// <summary>
/// Measures the tilt that is used for the plates in the set
/// of calibration images. The more tilted plates are used
/// in the image set, the better you can correct the radial
/// distortion of the lense by performing the calibration.
/// </summary>
public void eval_caltab_tilt(HTuple hv_FinalPoses,
out HTuple hv_TiltScore)
{
// Local control variables
HTuple hv_NImages, hv_Ones, hv_Index, hv_Slant;
HTuple hv_Pan, hv_FuzzyFunct, hv_SlantWeight, hv_PanWeight;
HTuple hv_TmpPan, hv_TmpSlant;
// Initialize local and output iconic variables
hv_NImages = (new HTuple(hv_FinalPoses.TupleLength())) / 7;
HOperatorSet.TupleGenConst(hv_NImages, 1, out hv_Ones);
hv_Index = (hv_Ones.TupleCumul()) - 1;
HOperatorSet.TupleSelect(hv_FinalPoses, (7 * hv_Index) + 3, out hv_Slant);
HOperatorSet.TupleSelect(hv_FinalPoses, (7 * hv_Index) + 4, out hv_Pan);
for (hv_Index = 0; (int)hv_Index <= (int)((new HTuple(hv_Slant.TupleLength())) - 1); hv_Index = (int)hv_Index + 1)
{
if ((int)(new HTuple(((hv_Slant.TupleSelect(hv_Index))).TupleGreater(180))) != 0)
{
if (hv_Slant == null)
hv_Slant = new HTuple();
hv_Slant[hv_Index] = 360 - (hv_Slant.TupleSelect(hv_Index));
}
}
for (hv_Index = 0; (int)hv_Index <= (int)((new HTuple(hv_Pan.TupleLength())) - 1); hv_Index = (int)hv_Index + 1)
{
if ((int)(new HTuple(((hv_Pan.TupleSelect(hv_Index))).TupleGreater(180))) != 0)
{
if (hv_Pan == null)
hv_Pan = new HTuple();
hv_Pan[hv_Index] = 360 - (hv_Pan.TupleSelect(hv_Index));
}
}
hv_Pan = hv_Pan.TupleRad();
hv_Slant = hv_Slant.TupleRad();
//function acting as a fuzzy weighting
gen_fuzzy_weight_funct(256, (new HTuple(0.0)).TupleRad(), (new HTuple(90.0)).TupleRad()
, (new HTuple(15.0)).TupleRad(), (new HTuple(40.0)).TupleRad(), out hv_FuzzyFunct);
HOperatorSet.GetYValueFunct1d(hv_FuzzyFunct, hv_Slant, "constant", out hv_SlantWeight);
HOperatorSet.GetYValueFunct1d(hv_FuzzyFunct, hv_Pan, "constant", out hv_PanWeight);
//Calculate score value
hv_TmpPan = (hv_PanWeight.TupleSum()) / 6;
hv_TmpPan = ((hv_TmpPan.TupleConcat(0.5))).TupleMin();
hv_TmpSlant = (hv_SlantWeight.TupleSum()) / 6;
hv_TmpSlant = ((hv_TmpSlant.TupleConcat(0.5))).TupleMin();
hv_TiltScore = hv_TmpSlant + hv_TmpPan;
return;
}
示例6: Action
//.........这里部分代码省略.........
//A3_X, A3_Y 分量
hv_A3_X = (hv_STD_A3_V_Col * (hv_Img_Rotate_Angle.TupleCos())) + (hv_STD_A3_V_Row * (hv_Img_Rotate_Angle.TupleSin()
));
hv_A3_Y = (hv_STD_A3_V_Row * (hv_Img_Rotate_Angle.TupleCos())) - (hv_STD_A3_V_Col * (hv_Img_Rotate_Angle.TupleSin()
));
//目前圖形 A3_ 位置
hv_A3_Pos_Row = (hv_STD_Row + hv_A3_Y) + hv_OffsetRow;
hv_A3_Pos_Col = (hv_STD_Col + hv_A3_X) + hv_OffsetCol;
//A3_ROI
hv_A3_ROI_W = 40;
hv_A3_ROI_H = 140;
ho_A3_Region.Dispose();
HOperatorSet.GenRectangle2(out ho_A3_Region, hv_A3_Pos_Row, hv_A3_Pos_Col,
hv_Img_Rotate_Angle, hv_A3_ROI_W, hv_A3_ROI_H);
//stop ()
ho_A3_Reduced.Dispose();
HOperatorSet.ReduceDomain(ho_Image, ho_A3_Region, out ho_A3_Reduced);
//fit_Rectangle, 找金手指
ho_A3Region.Dispose();
HOperatorSet.FastThreshold(ho_A3_Reduced, out ho_A3Region, 100, 250, 20);
ho_A3_RegionBorder.Dispose();
HOperatorSet.Boundary(ho_A3Region, out ho_A3_RegionBorder, "inner");
if (HDevWindowStack.IsOpen())
{
//dev_display (A3_RegionBorder)
}
hv_Rec_W = 11;
hv_Rec_H = 11;
ho_A3_RegionDilation.Dispose();
HOperatorSet.DilationRectangle1(ho_A3_RegionBorder, out ho_A3_RegionDilation,
hv_Rec_W, hv_Rec_H);
//alpha 大容錯大
hv_A3_Alpha = 4;
hv_low = 10;
hv_high = 100;
ho_A3_Edges.Dispose();
HOperatorSet.EdgesSubPix(ho_A3_Reduced, out ho_A3_Edges, "canny", hv_A3_Alpha,
hv_low, hv_high);
//stop ()
hv_a3Limit = 200;
ho_A3_Rectangles.Dispose();
HOperatorSet.SelectShapeXld(ho_A3_Edges, out ho_A3_Rectangles, "contlength",
"and", hv_a3Limit, 99999);
HOperatorSet.CountObj(ho_A3_Rectangles, out hv_A3RecNumber);
while ((int)(new HTuple(hv_A3RecNumber.TupleGreater(1))) != 0)
{
hv_a3Limit = hv_a3Limit + 10;
ho_A3_Rectangles.Dispose();
HOperatorSet.SelectShapeXld(ho_A3_Edges, out ho_A3_Rectangles, "contlength",
"and", hv_a3Limit, 99999);
HOperatorSet.CountObj(ho_A3_Rectangles, out hv_A3RecNumber);
}
HOperatorSet.FitRectangle2ContourXld(ho_A3_Rectangles, "regression", -1, 0,
0, 3, 2, out hv_A3Row, out hv_A3Column, out hv_A3Phi, out hv_A3Length1,
out hv_A3Length2, out hv_A3PointOrder);
//取A3 中心點
HOperatorSet.CountObj(ho_A3_Rectangles, out hv_A3Number);
if ((int)(new HTuple(hv_A3Number.TupleGreater(0))) != 0)
{
ho_A3Object.Dispose();
HOperatorSet.SelectObj(ho_A3_Rectangles, out ho_A3Object, 1);
//stop ()
//取 A2Object 資訊
hv_A3_Center_X = hv_A3Column[0];
hv_A3_Center_Y = hv_A3Row[0];
ho_A3Cross.Dispose();
HOperatorSet.GenCrossContourXld(out ho_A3Cross, hv_A3Row, hv_A3Column, 10, 0);
if (hv_A3Row.TupleLength() > 0 && hv_A2Row.TupleLength() > 0)
{
mResult.Row2 = new HTuple(hv_A3Row);
mResult.Col2 = new HTuple(hv_A3Column);
HOperatorSet.DistancePp(hv_A2Row, hv_A2Column, hv_A3Row, hv_A3Column, out mResult.Distance);
}
}
//*****A3 End
ho_A2_Region.Dispose();
ho_A2_Reduced.Dispose();
ho_A2Region.Dispose();
ho_A2_RegionBorder.Dispose();
ho_A2_RegionDilation.Dispose();
ho_A2_Edges.Dispose();
ho_A2_Rectangles.Dispose();
ho_A2Cross.Dispose();
ho_A3_Region.Dispose();
ho_A3_Reduced.Dispose();
ho_A3Region.Dispose();
ho_A3_RegionBorder.Dispose();
ho_A3_RegionDilation.Dispose();
ho_A3_Edges.Dispose();
ho_A3_Rectangles.Dispose();
ho_A3Object.Dispose();
ho_A3Cross.Dispose();
return mResult;
}