Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why I can't add matrix

I have an empty matrix that name q_bar, then I will add q_bar with matrix (b_bar.mul(evec)). Evec matrix has 5 row and 5 column.
Then the system said that "no operator "+" matches these operands.

Mat rata, Qnew, yminq,q_bar, evec,etrans,b_bar, q_new,qbaru, input, y_bar;
FileStorage smp0("mall.txt", cv::FileStorage::READ);
FileStorage smp1("evecall.txt", cv::FileStorage::READ);
FileStorage smp2("a0.txt", cv::FileStorage::READ);
    ab[0] = smp0["Point"];
    ab[1] = smp1["Point"];
    ab[2] = smp2["Point"];
read(ab[0],pointz);
read(ab[1],evec);
read(ab[2],jnt[0]);

t2=t;
    t.clear();
    etrans = evec.t();
    Qnew = Mat (t2).reshape(0,5);
    yminq = Qnew - q_bar;
    b_bar = etrans.mul(yminq);
    q_new = q_bar + (b_bar.mul(evec));

I dont know why, this source code suddenly error when I move to other project.

Then I try to use add function, the system get error. this is the error

OpenCV Error: Sizes of input arguments do not match (The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array') in cv::arithm_op, file ........\opencv\modules\core\src\arithm.cpp, line 1287