Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you could use Matx<float,2,2> for your 'tensor'

    typedef Matx<float,2,2> tensor;
    Mat_<tensor> mt = Mat_<tensor>::zeros(4,4);
    mt(2,2) = tensor(1,2,3,4);
    cerr << mt << endl;

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0;
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

you could use Matx<float,2,2> for your 'tensor'

    typedef Matx<float,2,2> tensor;
    Mat_<tensor> mt = Mat_<tensor>::zeros(4,4);
    mt(2,2) = tensor(1,2,3,4);
    cerr << mt << endl;

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0;
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

but again, all with a grain of salt. you'll find a lot of unhandled operators, there's no constructor for your initialization above, etc.

you could use Matx<float,2,2> for your 'tensor'

    typedef Matx<float,2,2> tensor;
    Mat_<tensor> mt = Mat_<tensor>::zeros(4,4);
    mt(2,2) = tensor(1,2,3,4);
    cerr << mt << endl;

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0;
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

but again, all with a grain of salt. you'll probably find a lot of unhandled operators, there's no constructor for your initialization above, etc.operators.