HALCON的HTuple类型(元组)功能很强大,可以表示INT、double、string等多种类型数据。当元组中只有一个成员时,HTuple也可表示原子类型
1. haclon -> C++
//HTuple转int
HTuple hTuple = 1;
int data1 = hTuple[0].I(); // data1 = 1//HTuple转double 常用
HTuple hTuple = 1.1;
double data2 = hTuple[0].D(); // data2 = 1.1//HTuple转CString
HTuple hTuple = "cstring";
CString str3 = hTuple[0].S(); // str3 = "cstring"
2. C++ -> halcon
int data1= 1;
double data2 = 1.1;
CString str3 = "CString";
QString str4 = "QString";HTuple hTuple2;
hTuple2[0] = data1; // hTuple2[0].I() = 1
hTuple2[1] = data2; // hTuple2[1].D() = 1.1
hTuple2[2] = str3.GetBuffer(); // hTuple2[2].S() = "CString"
hTuple2[3] = str4.toStdString().c_str(); // hTuple2[3].S() = "QString"int i = hTuple2[0].I(); // i=1
double d = hTuple2[1].D(); // d=1.1
CString cstring = hTuple2[2].S(); // cstring = "CString"
QString qstring = hTuple2[3].S(); // qstring = "QString"