Ask Your Question
0

dot product Mat matrices

asked 2013-02-14 11:02:20 -0600

ovaal gravatar image

I want to get the dot product from two Mat matrices using cvDotProduct. But this gives the error error: cannot convert ‘cv::Mat’ to ‘const CvArr* {aka const void*}’ for argument ‘1’ to ‘double

edit retag flag offensive close merge delete

Comments

Please give some code

krishna gravatar imagekrishna ( 2013-02-14 12:11:36 -0600 )edit

1 answer

Sort by » oldest newest most voted
3

answered 2013-02-15 00:37:45 -0600

cvDotProduct is function from old C API. It does not work with Mat objects. Use Mat::dot method instead.

edit flag offensive delete link more

Comments

For me, dot for matrices is matrix multiplication (I may wrong). Mat::dot is for vector in a Mat. Is the OP asking for a matrix multiplication or a dot between 2 vectors ?

Seltymar gravatar imageSeltymar ( 2013-02-15 02:29:04 -0600 )edit

From the docs: The method computes a dot-product of two matrices. If the matrices are not single-column or single-row vectors, the top-to-bottom left-to-right scan ordering is used to treat them as 1D vectors. The vectors must have the same size and type. If the matrices have more than one channel, the dot products from all the channels are summed together.

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2013-02-15 04:47:57 -0600 )edit

Yes, you're right. Just I was confused that a dot product of matrices is a matrix multiplication which gives a matrix as output. And the dot product from openCV gives a scalar (as it treats matrices as vectors). But as OP is asking for cvDotProduct, there is no ambiguity.

Seltymar gravatar imageSeltymar ( 2013-02-18 03:06:28 -0600 )edit

Question Tools

Stats

Asked: 2013-02-14 11:02:20 -0600

Seen: 5,344 times

Last updated: Feb 15 '13