# How to multiply point3f with matx type

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.

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

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