If you have two vectors representing your lines, and call them a
and b
(of type cv::Mat
) then the dot product is calculated as
double p = a.dot(b);
Edit Example code, by comments from author.
float a[2] = {1.0, 2.0};
float b[2] = {3.0, 4.0};
cv::Mat AA(1,2,CV_32FC1,a);
cv::Mat BB(1,2,CV_32FC1,b);
cout << AA << endl;
cout << BB << endl;
cout << AA.dot(BB) << " should be equal to 11" << endl;