C#联合halcon开发

1.winfrom项目传Tuple值到halcon

将传的二维数组转为Tuple类型传值

string[] StandardInfo=new strin[]{"aaaa","bbb","1"}
HTuple htupleArray = new HTuple(StandardInfo);                    
call.SetInputCtrlParamTuple("InputTupleStandard", htupleArray);

2.HTuple 数据转为double

CalculateResolution(Image ,out HObjectVector outImage, putegion, htupleArray, out HTuple outregion);
string[] ResultValue =ConvertTupleToArray(outregion);
  double[] OffsetValue = new double[2];
  for (int i = 0; i < 2; i++)
     {
       OffsetValue[i] = ResultValue[i].ToDouble();
     }                    
   double result= OffsetValue[0] / OffsetValue[1];
   region = Math.Round(result, 4);      


  public  string[] ConvertTupleToArray(HTuple tuple)
        {
            return tuple.ToOArr().Select(x => x.ToString()).ToArray();
        }        

猜你喜欢

转载自blog.csdn.net/qq_42711010/article/details/140954261