0

I am developing an application for Hololens where I place four image targets and identify the coordinates of the fifth image target relative to those markers. How to transform the image targets' position into a new coordinate system where the 4 image targets are (-5,-5),(-5,5),(5,5), and (5,-5) and calculate the position of the 5th image target accordingly.

Are there any sdks or tools for doing that in Hololens? What is the best method to achieve this?

  • You only need one image target since the Lens will also detect its scale and orientation .... Otherwise 3 would be enough to triangulate a coordinate system as well ... maybe I am misunderstanding your approach what what exactly do you need 4-5 targets for? – derHugo May 17 '23 at 07:37
  • So basically, I want to develop a remote application where I can direct my friend where I will move the image target "main" around the table, and he does the same on his own table remotely. Because it's a plain table, spatial mapping won't work in this case. So how can I pass the position of the main on the table? My way: The way I thought of is finding the co-ordinates of main with respect to four image targets on the table and pass that coordinates to other person because the actual co-ordinates of Hololens depends on head position. – Samir Kumar Patro May 18 '23 at 03:25

1 Answers1

0

As mentioned before, you actually only need one single image target as a shared reference to define/sync the coordinate space you both are moving in.

E.g. place it on the corner of your table(s) -> initially both reference this image target once.

=> You are all set up with a synchronized coordinate system anchor your can now use in order to share relative positions and rotations

HoloLens already will rotate and place your reference anchor object according to the tracked reference image.


Simplest setup I'd use for this is simply making sure all shared content is placed s a child of your main WorldAnchor object. This WorldAnchor you position and rotate to match with the first tracked image target you use as reference.

Now you can simply synchronize with remote users by transferring and reapplying your objects localPosition, localRotation, localScale. Since on both your and the receiver side the objects are placed as child under the WorldAnchor they are automatically placed correctly relative to that anchor. So ensuring that this one anchor GameObject is placed and oriented correctly on both sides is already enough to build up a shared coordinate space.


Without using parenting you can also go through the Transform component of the WorldAcnhor and use e.g.

var positionToSend = worldAcnhor.InverseTransformPoint(otherTargetWorldPosition); 

and on the receiver accordingly

trackedObject.position = worldAcnhor.TransformPoint(receivedRelativePosition);

Same you can do also with the rotation (see What is the rotation equivalent of InverseTransformPoint?

derHugo
  • 83,094
  • 9
  • 75
  • 115