halcon学习之tuple创建操作

//连接两个tuple数组到第三个tuple中

    HTuple tuple1;
    tuple1[0] = 1;
    tuple1[1] = 2;
    HTuple tuple2;
    tuple2[0] = 3;
    HTuple result = tuple1.TupleConcat(tuple2);
    for (int i = 0; i < 3;i++)
    {
        cout << (Hlong)result[i] << " ";
    }
    cout << endl;

//返回一个随机数tuple数组,分布在[0,1)范围之间。

    HTuple tuple3;
    tuple3 = HTuple::TupleRand(5);
    for (int i = 0; i < 5;i++)
    {
        cout << (double)tuple3[i] << " ";
    }
    cout << endl;

//产生一个指定长度和初始化值的数组。

    HTuple tuple4;
    tuple4 = HTuple::TupleGenConst(5,0);
    for (int i = 0; i < 5; i++)
    {
        cout << (double)tuple4[i] << " ";
    }
    cout << endl;

//初始化数组,指定开始值,终止值,累加步长

    HTuple tuple5;
    tuple5 = HTuple::TupleGenSequence(1,10,2);
    for (int i = 0; i < tuple5.Length(); i++)
    {
        cout<<(double)tuple5[i] <<" ";
    }

你可能感兴趣的:(Tuple,halcon)