[vtkusers] projections and transformations

David Doria daviddoria+vtk at gmail.com
Tue Feb 16 08:02:52 EST 2010


On Tue, Feb 16, 2010 at 4:55 AM, Giancarlo Amati <ilferraresebono at hotmail.it
> wrote:

>  Good morning Guys,
>
> this is my question:
>
> I have a dataset, and a projection matrix resulting from a calibration
> process. now:
>
> the projection matrix P = 3x4 matrix. While transformation in VTK are 4x4
> matrices.
> So, I transformed my P in a 4x4 by inserting a NULL row inbetween the 2nd
> and the 3rd row. this makes  the Z null.
>
> Now If I put this final P into a vtkTransform object and apply to my
> polydata, are the coordinates in the politdata divided automatically by that
> famous homogeneous coordinate factor W?
>
> let's say that PD is my PolyData and I want to visualized the 2D by
> multiply P * PD where of course I get coordinate like (Xi,Yi, 0, Wi). But
> now I would like Xi/Wi which is a homogeneous normalization.... is it that
> automatic or I have to make it expiciltly?
>
> Very kind regards.
> Giancarlo
>
>
Why would you insert a blank row as the 3rd row instead of the 4th? When you
project the 3d points to 2d, you are expecting a 2-vector. The standard 3x4
projection matrix multiplied by a 3d point (in homogeneous coordinates, a
4-vector) will produce a 3-vector which you then have to divide by the 3rd
coordinate to get your "pixel" (2-vector) coordinate. If you NULL the 4th
row of the 4x4 matrix and multiply it by your 3d points (4-vectors after
adding the homogeneous 1), you will get a 4-vector. You should just
disregard the 4th coordinate - the first 3 coordinates will be the same as
if you had just multiplied the first 3 rows (the 3x4 matrix you actually
wanted) by your points.

I'd recommend that we add a vtkMatrix3x4 class so this doesn't have to be
done manually every time. The homogeneous division at the end would still be
up to you, unless we added a vtkMatrix3x4::MultiplyHomogeneous function.

Hope that helps,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100216/1cac98b9/attachment.htm>


More information about the vtkusers mailing list