Ask Your Question

operations on cv::Point

asked 2012-10-04 13:38:16 -0500

mgb gravatar image

updated 2017-08-24 15:11:08 -0500

There aren't many operations defined on the cv::Point2/3 data type

IS this deliberate? Am I supposed to convert everything to a cv::Mat? Or is there some technical reason?

I'm starting to build a library of; dot & cross product, length, isEmpty() etc but this seems like a duplication of effort

edit retag flag offensive close merge delete


Sorry missed dot/cross. IIRC =/ and =* didn't work with a scaler. Normalize() and Length() would be useful as would an easy way of converting between cv Point3 and a row/column of a 3x3 Mat. I do a lot of 3D positioning !

mgb gravatar imagemgb ( 2012-10-14 14:23:31 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2012-10-04 14:29:08 -0500

updated 2012-10-04 14:40:31 -0500

Actually you have these functions for Points:

Point a, b;


double dotProduct =;

double crossProduct = a.cross(b);

double length = norm(a);

What do you mean by isEmpty()? cv::Point always contain some data (e.g. zeros by default) so it cannot be empty.

Could you please provide more specific examples of missing functions?

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2012-10-04 13:38:16 -0500

Seen: 2,507 times

Last updated: Oct 04 '12