Author Topic: load 3d model from the camera Extrinsic Matrix  (Read 3035 times)

Offline better

  • byte
  • *
  • Posts: 5
    • View Profile
load 3d model from the camera Extrinsic Matrix
« on: November 20, 2014, 02:37:35 am »
Hi,
   I have got a camera Extrinsic Matrix(transformation from world coordinate to camera coordinate) from PTAM which is 4X4 matrix:
   R|t
   0|1  R is a rotation matrix and t is a translation vector.
   what i want to do is : I load a 3d model ,and want to show it. When I put the camera in different position and different ditection ,I can see different side of the model,but the model is still in the origin position.
   I have tried camera.setBack() and camera.setPosition  this method ,and camera.setOrientation(),camera.setPosition() as another method ,but it does not reach what i expect.
   have you have some idea??
   many thanks!! :)
   yours better

Offline better

  • byte
  • *
  • Posts: 5
    • View Profile
Re: load 3d model from the camera Extrinsic Matrix
« Reply #1 on: November 20, 2014, 08:17:40 am »
if the model coordinate is x left ,y down,z out of the window which jpct's z is opposite.
should I has a tranformation between model coordinate and camera world coordinate using above method??
thanks!!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: load 3d model from the camera Extrinsic Matrix
« Reply #2 on: November 20, 2014, 08:37:33 am »
I'm not sure about the actual question, but if you have some matrix that uses another ccordinate system, you have to transform it. You've already identified the setBack() and setPosition() methods so i think you should have all you need to do that. Just keep in mind that all matrices in jPCT are row major and http://www.jpct.net/wiki/index.php/Coordinate_system.

Apart from that: Why don't you just move and rotate the camera? What's so special about these matrices that you have to use them?

Offline better

  • byte
  • *
  • Posts: 5
    • View Profile
Re: load 3d model from the camera Extrinsic Matrix
« Reply #3 on: November 20, 2014, 11:20:46 am »
what I do is AR based on no marker,a little like vofuria which you have said you nerver used in other topics integrated with jpct .
so with the transformation matrix ,I can different sides of a 3d model when phone camera in different pos and direction.
Is it more  complex to get angles which used in rotating camera.

and,what does the setBack() meaning .Is it the same purpose like setOrientation??
thanks!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: load 3d model from the camera Extrinsic Matrix
« Reply #4 on: November 20, 2014, 11:26:31 am »
No, setBack() just sets the rotation(!) matrix (not the combined transformation matrix) for the camera. The method's naming is historical, so please don't wonder about it. Think of it as setRotationMatrix() instead...

Offline better

  • byte
  • *
  • Posts: 5
    • View Profile
Re: load 3d model from the camera Extrinsic Matrix
« Reply #5 on: November 20, 2014, 11:31:36 am »
setRotationMatrix() ?? It is the Object3D's method ,not Camera's?
what i want is to keep the 3D model in the origin of  world coord .And let the camera move.
Although it is almost same with keep camera still and let model change.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: load 3d model from the camera Extrinsic Matrix
« Reply #6 on: November 20, 2014, 12:17:39 pm »
I just wanted to point out that setBack() WORKS LIKE setRotationMatrix(). I wasn't saying that you should use it instead. I'm sorry for any confusion that this might have caused.

Offline better

  • byte
  • *
  • Posts: 5
    • View Profile
Re: load 3d model from the camera Extrinsic Matrix
« Reply #7 on: November 20, 2014, 12:30:40 pm »
at last,
if you  have a transformation matrix(transformation from world coordinate to camera coordinate),composed of a rotation matrix and translation vector.
and what you do is to set the camera so that you can see the model in the origin world coord change.
Do you have some suggestions about the transformation with your Camera methods.? How to use Camera method so transformation changes,it is just like the camera changes and then we can see different sides of model.?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: load 3d model from the camera Extrinsic Matrix
« Reply #8 on: November 20, 2014, 02:55:33 pm »
I'm not sure what the actual problem is (apart from coordinate system transformations, which can be tricky). I've mentioned it already: With setPosition() and setBack(), you have everything you need. You "just" have to split your 4x4 matrix in a rotational and a translational part, convert between the coordinate systems and apply both.