How to multiply point3f with matx type

asked 2014-02-19 09:33:55 -0600

jcrose gravatar image

updated 2014-02-21 03:18:17 -0600

I'm not sure if this is trivial in OpenCV and c++, but after looking vastly around on websites, I still didn't find an elegant way to solve this.

So I have 3x3 camera matrix K of type Matx33f and #N-homogenous image points stored in a vector<point3f> named X. What I'd like to achieve is the calculation of the projective rays via:

Xn = K.inv() * X_vec,

whereby X_vec = [x1 x2 ... xN; y1 y2 ... yN; 1 1 ... 1]; (3xN)

Edit: The problem is that X is of type vector<point3f> but I need it in a vector form in the way of X_vec. I know how to to the muliplication with a loop, but I wonder if there isn't a simpler and more elegant way to transform vector<point3f> X into X_vec. Can't imagine it to be that costly.

Many thanks in advance.

edit retag flag offensive close merge delete

Comments

Why don't you convert K to a Mat (type) matrix and do as you typed: Xn = K.inv() * X_vec;?

tuannhtn gravatar imagetuannhtn ( 2014-02-19 09:50:15 -0600 )edit

Sorry, the problem formulation lacked some clarity. Please take a look at the edited version.

jcrose gravatar imagejcrose ( 2014-02-20 01:49:05 -0600 )edit