Suppose I have the Pose of an object (translation and rotational information) but with respect to the camera frame (it’s a perspective camera). I believe this is the world coordinates but someone might correct me
What I would like to know is the rotation of the object but in it’s local pose coordinate system, (not relative to the camera, but a local rotation to the object itself - I don’t really care about translation)
I know the camera intrinsic data. How would I go about getting the local rotation?
The structure of your scene depends here. Lets say you have a scene with a camera and a object. Then the objects local transform would be equal to its world transform because its not nested.
If you have a scene with a group of spheres nested inside a container obj. Then the spheres transform are local to its parent container, and world to the scene.
scene.position.set(0, 0, 0) // this is default
container.position.set(5, 0, 0) // offset container x = 5 from scene center
sphere.position.set(3, 0, 0) // sphere is offseted x = 3 from the center of container, means x = 8 away from scene center
If you want to get the local transform of your obj just use: obj.position, obj.rotation, obj.scale, which is always the local transform
If you want to get the world transform of your obj, use obj.getWorldQuaternion(targetQ), obj.getWorldPosition(targetV3), obj.getWorldScale(targetV3)
So what I am trying to do is mimic a real world setup. I have a camera that is capable of getting pose of an object in the image. What I would like to do is prove that the returned pose is correct by placing the object in a known local pose and compare against what theoretical functions return back in threejs in a virtual environment
At the moment the returned pose is relative to the camera frame and not in local coordinates and so I need a way of converting between the two
So can I do the following in threejs to mimic the setup virtually
Set up a perspective camera with my intrinsic camera parameters in threejs ( can it take all the intrinsic information like focal length, sensor center cx, cy etc
Set the 3D pose of an object in threejs with respect to the camera - not the local object system (not sure how I set this part up)
Read back the local rotation of object looks like I can just use obj.rotation()
Im not fully understanding what youre going for, but to be clear, the camera has no impact on the objs itself or the scene in any way. The camera is just another obj floating through space observing the scene in its current state from its (camera) current transformation (position, rotation).
Can you relate what you are trying to achieve? I guess you have a certain transformation that you wanna check for? Maybe youd wanna look into matrices. Position, Rotation and Scale are stored in a transformation matrix. These matrices can be added or multiplied etc to achieve rotation and translation and can probably be compared as well.