Ask Your Question
1

Multiply cv::Mat and std::vector<cv::Point2f>

asked 2012-11-19 13:24:35 -0600

David_Lavy gravatar image

Hi,

So I have a matrix cv::Mat M (NxN) and a vector of Points std::vector< cv::Point2f > Vec (Nx2).

How can I perform a multiplication between these two elements: M x Vec = P, and have a final vector std::vector< cv::Point2f > P (Nx2)??

Thank you!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2012-11-19 17:22:37 -0600

SR gravatar image

Without testing, but this should do it:

std::vector< cv::Point2f > Vec = ... ;
std::vector< cv::Point2f > P;
cv::Mat V = M * cv::Mat(Vec, false) /* Vec is just wrapped, no copying is performed */;
V.copyTo( cv::Mat(P, false) );
// P now contains the result
edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-11-19 13:24:35 -0600

Seen: 8,412 times

Last updated: Nov 19 '12