本文整理汇总了C#中HTuple.TupleConcat方法的典型用法代码示例。如果您正苦于以下问题:C# HTuple.TupleConcat方法的具体用法?C# HTuple.TupleConcat怎么用?C# HTuple.TupleConcat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTuple
的用法示例。
在下文中一共展示了HTuple.TupleConcat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getCalibrationData
/// <summary>
/// Gets the mark centers and the poses extracted from
/// the set of calibration images
/// </summary>
/// <param name="rows">
/// Tuple of row coordinates of all marks from
/// the entire set of calibration images
/// </param>
/// <param name="cols">
/// Tuple of column coordinates of all marks from
/// the entire set of calibration images
/// </param>
/// <returns>
/// Tuple of estimated poses for the entire set
/// of calibration images
/// </returns>
public HTuple getCalibrationData(out HTuple rows, out HTuple cols)
{
int count = CalibData.Count;
HTuple pose = new HTuple();
rows = new HTuple();
cols = new HTuple();
CalibImage image;
for (int i = 0; i < count; i++)
{
image = (CalibImage)CalibData[i];
pose = pose.TupleConcat(image.GetEstimatedPose());
rows = rows.TupleConcat(image.GetMarkCenterRows());
cols = cols.TupleConcat(image.GetMarkCenterColumns());
}
return pose;
}
示例3: gen_arrow_cont
/// <summary>
/// Generate a contour in form of an arrow.
/// </summary>
private void gen_arrow_cont(out HObject ho_Arrow,
HTuple hv_Row1,
HTuple hv_Column1,
HTuple hv_Row2,
HTuple hv_Column2)
{
// Local iconic variables
HObject ho_Cross1, ho_Cross2, ho_CrossP1, ho_CrossP2;
// Local control variables
HTuple hv_Length, hv_Angle, hv_MinArrowLength;
HTuple hv_DRow, hv_DCol, hv_ArrowLength, hv_Phi, hv_P1R;
HTuple hv_P1C, hv_P2R, hv_P2C;
// Initialize local and output iconic variables
HOperatorSet.GenEmptyObj(out ho_Arrow);
HOperatorSet.GenEmptyObj(out ho_Cross1);
HOperatorSet.GenEmptyObj(out ho_Cross2);
HOperatorSet.GenEmptyObj(out ho_CrossP1);
HOperatorSet.GenEmptyObj(out ho_CrossP2);
//Generate a contour in form of a arrow
hv_Length = 7;
hv_Angle = 40;
hv_MinArrowLength = 2;
hv_DRow = hv_Row2 - hv_Row1;
hv_DCol = hv_Column2 - hv_Column1;
hv_ArrowLength = (((hv_DRow * hv_DRow) + (hv_DCol * hv_DCol))).TupleSqrt();
if ((int)(new HTuple(hv_ArrowLength.TupleLess(hv_MinArrowLength))) != 0)
{
hv_Length = 0;
}
HOperatorSet.TupleAtan2(hv_DRow, -hv_DCol, out hv_Phi);
hv_P1R = hv_Row2 - (hv_Length * (((hv_Phi - (hv_Angle.TupleRad()))).TupleSin()));
hv_P1C = hv_Column2 + (hv_Length * (((hv_Phi - (hv_Angle.TupleRad()))).TupleCos()));
hv_P2R = hv_Row2 - (hv_Length * (((hv_Phi + (hv_Angle.TupleRad()))).TupleSin()));
hv_P2C = hv_Column2 + (hv_Length * (((hv_Phi + (hv_Angle.TupleRad()))).TupleCos()));
ho_Cross1.Dispose();
HOperatorSet.GenCrossContourXld(out ho_Cross1, hv_Row1, hv_Column1, 6, 0.785398);
ho_Cross2.Dispose();
HOperatorSet.GenCrossContourXld(out ho_Cross2, hv_Row2, hv_Column2, 6, 0.785398);
ho_CrossP1.Dispose();
HOperatorSet.GenCrossContourXld(out ho_CrossP1, hv_P1R, hv_P1C, 6, 0.785398);
ho_CrossP2.Dispose();
HOperatorSet.GenCrossContourXld(out ho_CrossP2, hv_P2R, hv_P2C, 6, 0.785398);
ho_Arrow.Dispose();
HOperatorSet.GenContourPolygonXld(out ho_Arrow, ((((((hv_Row1.TupleConcat(hv_Row2))).TupleConcat(
hv_P1R))).TupleConcat(hv_Row2))).TupleConcat(hv_P2R), ((((((hv_Column1.TupleConcat(
hv_Column2))).TupleConcat(hv_P1C))).TupleConcat(hv_Column2))).TupleConcat(
hv_P2C));
ho_Cross1.Dispose();
ho_Cross2.Dispose();
ho_CrossP1.Dispose();
ho_CrossP2.Dispose();
return;
}
示例4: eval_marks_distribution
/// <summary>
/// Evaluates the distribution of the marks and hence the plates
/// used for the calibration images. Precise measurements can only be
/// achieved if the field view of the camera is covered well by the
/// calibration plate in the images.
/// </summary>
public void eval_marks_distribution(HTuple hv_NRCoord,
HTuple hv_NCCoord,
HTuple hv_Width,
HTuple hv_Height,
out HTuple hv_MarksDistributionScore)
{
// Local iconic variables
HObject ho_Region, ho_DistanceImage, ho_Mask;
// Local control variables
HTuple hv_Border, hv_Min, hv_Max, hv_Range;
HTuple hv_ImageDiagonal, hv_MinThresh, hv_MaxThresh, hv_Ratio;
HTuple hv_Tmp1, hv_Tmp2;
// Initialize local and output iconic variables
HOperatorSet.GenEmptyObj(out ho_Region);
HOperatorSet.GenEmptyObj(out ho_DistanceImage);
HOperatorSet.GenEmptyObj(out ho_Mask);
//Determine the distances between the marks centers
ho_Region.Dispose();
HOperatorSet.GenRegionPoints(out ho_Region, hv_NRCoord, hv_NCCoord);
ho_DistanceImage.Dispose();
HOperatorSet.DistanceTransform(ho_Region, out ho_DistanceImage, "octagonal",
"false", hv_Width, hv_Height);
//A clipping is needed because the marks cannot come close to the border
hv_Border = (((hv_Width.TupleConcat(hv_Height))).TupleMax()) / 15;
ho_Mask.Dispose();
HOperatorSet.GenRectangle1(out ho_Mask, hv_Border, hv_Border, (hv_Height - 1) - hv_Border,
(hv_Width - 1) - hv_Border);
HOperatorSet.MinMaxGray(ho_Mask, ho_DistanceImage, 0, out hv_Min, out hv_Max,
out hv_Range);
HOperatorSet.DistancePp(0, 0, hv_Height - 1, hv_Width - 1, out hv_ImageDiagonal);
hv_MinThresh = 0.3;
hv_MaxThresh = 0.85;
hv_Ratio = (hv_Max / hv_ImageDiagonal) * 2.5;
hv_Tmp1 = 1 - hv_Ratio;
hv_Tmp2 = (hv_Tmp1 - hv_MinThresh) / (hv_MaxThresh - hv_MinThresh);
hv_MarksDistributionScore = ((((((hv_Tmp2.TupleConcat(1.0))).TupleMin())).TupleConcat(
0.0))).TupleMax();
ho_Region.Dispose();
ho_DistanceImage.Dispose();
ho_Mask.Dispose();
return;
}