Ask Your Question
0

multiply vec with vec

asked 2017-07-31 23:33:30 -0500

Nbb gravatar image

How can I perform an element-wise multiplication of 2 vectors and return the result to a vec ? Do I need to typecast them into a Mat ?

cv::Vec3f A, B, C;
//fill up A and B

C = A*B;
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-08-01 00:06:01 -0500

berak gravatar image

A*B is matrix multiplication in opencv, per element would be:

cv::Vec3f A(1,2,3), B(4,5,6), C;
multiply(A,B,C);
cerr << C << endl;

[4, 10, 18]
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-07-31 23:33:30 -0500

Seen: 391 times

Last updated: Aug 01 '17