Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

vector results inconsistent what am I doing?

Hi, I am getting 2 different vector-cross product results, one from OpenCV and different from OpenCV but same with each other from Symbolab Vector-Cross Calculator & the following video 6.17 tutorial on calculating plane equation.

Here are the 2 vectors PQ & PR. Try them initially with OpenCV and Symbolab:

Mat PQ = (Mat_<float>(3, 1) << 1.0, -1.0, 0.0);
Mat PR = (Mat_<float>(3, 1) << 1.0, 0.0, -1.0);

Mat vec_cross_result = (Mat_<float>(3, 1) << 0.0, 0.0, 0.0);
cv::multiply(PR, PQ, vec_cross_result);
std::cerr << PQ << " " << PR << "  " << std::endl << "Result: " << std::endl << vec_cross_result << std::endl;
[1,-0,-0]  //OpenCV result

Using dedicated vectors Vec3f below instead of a 3 x 1 matrix above, and got the same OpenCV as with Mats, to no surprise...

cv::Vec3f A(1.0, -1.0, 0.0), B(1.0, 0.0, -1.0), vector_cross;
std::cerr << A << std::endl;
std::cerr << B << std::endl;
multiply(A, B, vector_cross);
std::cerr << "Vector result:" << vector_cross << std::endl;

Symbolab result is [1,1,1]. Video tutorial the same 6:17.. What am I overlooking?

vector results inconsistent what am I doing?

Hi, I am getting 2 different vector-cross product results, one from OpenCV and different from OpenCV but same with each other from Symbolab Vector-Cross Calculator & the following video 6.17 tutorial on calculating plane equation.

Here are the 2 vectors PQ & PR. Try them initially with OpenCV and Symbolab:

Mat PQ = (Mat_<float>(3, 1) << 1.0, -1.0, 0.0);
Mat PR = (Mat_<float>(3, 1) << 1.0, 0.0, -1.0);

Mat vec_cross_result = (Mat_<float>(3, 1) << 0.0, 0.0, 0.0);
cv::multiply(PR, PQ, vec_cross_result);
std::cerr << PQ << " " << PR << "  " << std::endl << "Result: " << std::endl << vec_cross_result << std::endl;
[1,-0,-0]  //OpenCV result

Using dedicated vectors Vec3f below instead of a 3 x 1 matrix above, and got the same OpenCV as with Mats, to no surprise...

cv::Vec3f A(1.0, -1.0, 0.0), B(1.0, 0.0, -1.0), vector_cross;
std::cerr << A << std::endl;
std::cerr << B << std::endl;
multiply(A, B, vector_cross);
std::cerr << "Vector result:" << vector_cross << std::endl;

Symbolab result is [1,1,1]. Video tutorial the same 6:17.. What am I overlooking?