it gets up to x2[0] = (x1[0] * invcov.at<double>(1,1).....
and it crashes with an unhandled exception.
Its really driving me crazy to do this simple thing. But i am soo stuck with matrix operations it just crashes.
i tried to loop through the matrix elements the long instead and store in a multidimensional array i.e. double matrx[3][3]; but the value inside the double array was -1.#QNAN.
My guess is that you go out of bounds on the indices for some container. The likely culprit is invcov, but I would need the definitions for Scalar, Vec3b, and Mat, in order to be sure. Try to go from 0 to 2 instead of from 1 to 3