Genesis icon indicating copy to clipboard operation
Genesis copied to clipboard

[Feature]: the transformer of camera 2 world

Open gxy-1111 opened this issue 11 months ago • 5 comments

What feature or enhancement are you proposing?

When I set up one camera with code like this cam_0 = scene.add_camera( res=(1280, 960), pos=(3.5, 0.0, 2.5), lookat=(0, 0, 0.5), fov=30, GUI=True, ) Can I get the transformer between camera pixel and world ? Does there are any api I can use? Thanks for any response!

Motivation

As a [e.g. civil engineering researcher working on flood simulation] I want to [e.g. be able to simulate city-scale fluid / terrain simulations] Because [e.g. this enables the efficient design and validation of flood protection structures].

Potential Benefit

a Convenient features

What is the expected outcome of the implementation work?

  • [ ]

Additional information

No response

gxy-1111 avatar Feb 13 '25 03:02 gxy-1111

Can you elaborate your question again? Do you mean you want to access to transformation between camera and world frames?

bxtbold avatar Feb 14 '25 05:02 bxtbold

Can you elaborate your question again? Do you mean you want to access to transformation between camera and world frames?

Yes, when I set up a camera, I want to get the transformer between camera pixel and world coordinate。

gxy-1111 avatar Feb 15 '25 07:02 gxy-1111

Perhaps, what you are looking for is Camera.transform which gives a 4x4 transformation matrix.

You can access from your camera instance like this:

cam_0 = scene.add_camera( res=(1280, 960), pos=(3.5, 0.0, 2.5), lookat=(0, 0, 0.5), fov=30, GUI=True, )
cam_0.transform

bxtbold avatar Feb 17 '25 01:02 bxtbold

You can refer to these code: link1 and link2.

Also, I will soon update these functions to APIs of Genesis.

wangyian-me avatar Mar 20 '25 17:03 wangyian-me

Maybe refer to pull request #897

wangyian-me avatar Mar 20 '25 22:03 wangyian-me