[vtkusers] customizing the VTK projection matrix (i.e K[R T] to VTK projection)

Dan Lipsa dan.lipsa at kitware.com
Wed Sep 30 10:42:16 EDT 2015


Hi Achkan,
In the past I was able to translate the model view transforms from VTK to
OpenGL, so that I kept a VTK view and an OpenGL view in sync.
The information in that discussion might be of interest to your problem as
well.

http://vtk.markmail.org/search/?q=Dan+Lipsa+matrix#query:Dan%20Lipsa%20matrix+page:1+mid:vtybw3f2mup2zq3z+state:results

On Tue, Sep 29, 2015 at 4:07 AM, AchkanSalehi <ashsalehi4133 at gmail.com>
wrote:

> Hi,
>
> I need to replace the projection matrix that VTK uses, and haven't succeded
> thus far. I have the three matrices *K*,
>  *R*, *T*, which respectively represent the camera calibration matrix, the
> Rotation and translation (i.e. the columns of *R* are the camera axes and
> *T* is its position in world coodinates. I have tried:
>
>   //first, to obtain an identity projection matrix
>   camera->SetViewUp(0,1, 0);
>   camera->SetPosition(0, 0, 0);
>   camera->SetFocalPoint(0, 0, -1);
>   renderer->SetActiveCamera(camera);
>
> // add orientation and translation: [R T]
>  vtkSmartPointer<vtkMatrix4x4> KRT=vtkSmartPointer<vtkMatrix4x4>::New();
>
> //KRT->SetElement... So that the matrix looks like
>                R  T
>                O  1
> //with O=[0 0 0]
>
>  camera->SetModelTransformMatrix(KRT);
>
> But i have no idea how to add the *K* matrix. I also think the orientation
> i
> obtain with the lines above is wrong. From what i saw in the documentation
> and other forums, this can be done by setting the focal point, up, etc, but
> the documentation was as little bit unsufficient for me. So any help would
> be greatly appreciated.
>
> PS: I think it would also help if anyone could  briefly explain how the VTK
> projection matrix is related to the OpenGL projection matrix... Thanks
> again.
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/customizing-the-VTK-projection-matrix-i-e-K-R-T-to-VTK-projection-tp5734165.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150930/ec356ab7/attachment.html>


More information about the vtkusers mailing list