Different behaviour when using cv::Mat and cv::Matx types
There seem to be very different results when using cv::Mat and cv::Matx types for doing some operations. For example:
double a[] = {
0.8147, 0.6324, 0.9575, 0.9572,
0.9058, 0.0975, 0.9649, 0.4854,
0.1270, 0.2785, 0.1576, 0.8003,
0.9134, 0.5469, 0.9706, 0.1419
};
cv::Mat A(4, 4, CV_64F, a);
std::cout << "Using Mat: " << cv::determinant(A) << std::endl;
cv::Matx44d A2(0.8147, 0.6324, 0.9575, 0.9572,
0.9058, 0.0975, 0.9649, 0.4854,
0.1270, 0.2785, 0.1576, 0.8003,
0.9134, 0.5469, 0.9706, 0.1419);
std::cout << "Using Matx: " << cv::determinant(A2) << std::endl;
Produces:
Using Mat: -0.0261654
Using Matx: 0
Does anyone know what might be causing this kind of differences? The values passed to the function should be exactly the same and seem to work with smaller matrices even with cv::Matx. The result is only correct when using cv::Mat type.