Here is a 4x4 transformMatrix Mat.
1.000, 0.000, -0.004, 0.784,
-0.000, 1.000, 0.001, -0.205,
0.004, -0.001, 1.000, -1.435,
0.000, 0.000, 0.000, 1.000
Here is a 3-dimension vector
507.347,359.172,229.584
I performed the OpenCV Mat multiplication operation as follows
double data[] = { 507.347, 359.172, 229.584, 1 };
cv::Mat s(4, 1, CV_64F, data);
cv::Mat d = transformMatrix * s;
The output result is as follows, but it differs from the value calculated using a calculator.
OpenCV Mat Multiply result = matrix * (507.347,359.172,229.584) = (507.394,359.158,229.605)
Calculation result = 507.213, 359.197, 230.538
Why is the result different? Is there something wrong with the code?
I tried this code (C++):
cv::Matx<double,4,4> M =
{
1.000, 0.000, -0.004, 0.784,
-0.000, 1.000, 0.001, -0.205,
0.004, -0.001, 1.000, -1.435,
0.000, 0.000, 0.000, 1.000
};
double data[] = { 507.347, 359.172, 229.584, 1 };
cv::Mat s(4, 1, CV_64F, data);
auto Result = M * s;
std::cout << Result;
But, output becomes:
[507.212664;
359.196584;
229.819216;
1]
not reproduce your result.
Perhaps, value of matrix you see is too low accuracy ?