halcon學習之tuple比較運算

2021-07-05 05:56:09 字數 1995 閱讀 2495

//執行兩個tuple陣列之間的相互比較

void testcomparison()

{ htuple tuple1;

tuple1[0] = 1;

tuple1[1] = 1;

tuple1[2] = 2;

htuple tuple2;

tuple2[0] = 1;

tuple2[1] = 2;

tuple2[2] = 1;

htuple result = tuple1.tupleequal(tuple2);//陣列大小相同,同一位置對應資料相同,就是相等。陣列相等返回1,不相等返回0.

cout << (hlong)result

cout << (hlong)result << endl;

result = tuple1.tuplegreater(tuple2);//如果陣列中,tuple1的長度大於tuple2,返回1,否則返回0;如果長度相等,陣列中元素進行逐個比較,如果首先出現對應位置的元素tuple1大於tuple2,則返回1,否則返回0;

cout << (hlong)result << endl;

result = tuple1.tuplegreaterelem(tuple2);//如果陣列中,tuple1的長度大於tuple2,返回1,否則返回0;如果長度相等,陣列中元素進行逐個比較,如果存在所有對應位置的元素tuple1大於tuple2,則返回1,否則返回0;

cout << (hlong)result << endl;

result = tuple1.tuplegreaterequal(tuple2);//如果陣列中,滿足tupleequal和tuplegreater其中之一,就返回1.否則返回0

cout << (hlong)result << endl;

result = tuple1.tuplegreaterequalelem(tuple2);//如果陣列中,滿足tupleequalelem和tuplegreaterelem其中之一,就返回1.否則返回0

cout << (hlong)result << endl;

result = tuple1.tupleless(tuple2);//如果陣列中,tuple1的長度小於tuple2,返回1,否則返回0;如果長度相等,陣列中元素進行逐個比較,如果首先出現對應位置的元素tuple1小於tuple2,則返回1,否則返回0;

cout << (hlong)result << endl;

result = tuple1.tuplelesselem(tuple2);//如果陣列中,tuple1的長度小於tuple2,返回1,否則返回0;如果長度相等,陣列中元素進行逐個比較,如果存在所有對應位置的元素tuple1小於tuple2,則返回1,否則返回0;

cout << (hlong)result << endl;

result = tuple1.tuplelessequal(tuple2);//如果陣列中,滿足tupleequal和tupleless其中之一,就返回1.否則返回0

cout << (hlong)result << endl;

result = tuple1.tuplelessequalelem(tuple2);//如果陣列中,滿足tupleequal和tuplelesselem其中之一,就返回1.否則返回0

cout << (hlong)result << endl;

result = tuple1.tuplenotequal(tuple2);//與tuplenotequal條件相反.

cout << (hlong)result << endl;

result = tuple1.tuplenotequalelem(tuple2);//與tuplenotequalelem條件相反

cout << (hlong)result << endl;

halcon學習之tuple轉化操作

對tuple陣列執行相關的轉化操作 通過截斷乙個浮點型的資料,轉化為整形資料,tuple內容不允許是string型別 htuple tuple1 12.124431432 htuple result tuple1.tupleint cout hlong result result tuple2.tu...

halcon學習 tuple之算術運算1

對指定tuple陣列內的值求絕對值 void testtupleabs for int i 0 i 10 i htuple result tuple.tupleabs cout endl for int i 0 i 10 i 計算反余弦 void testtupleacos for int i 0 ...

halcon學習 tuple之算術運算2

計算陣列的積累值,tuple陣列中每個元素必須都是數字,輸入 1,2,3,4 則輸出 1,3,6,10 如果輸入的有浮點數,則輸出結果也會出現浮點數 void testtuplecumul for int i 0 i 10 i cout endl htuple result tuple.tuplec...