Start a new topic

Target distance using getDistanceToTarget()


I'm currently trying the examples to display the target distance from the phone, using getDistanceToTarget() api. The distance I need to measure are very close, about 10-20 cm.

I'm using the javascript SDK, using a plugin, based on the example. I also entered the target height in the studio (in mm)

In the update callback I call getDistanceToTarget(), wich is supposed to return the distance from target in millimeters.

- first problem: the return value when my target is at 10 cm is 1120, what is the unit of this value ?

- second problem: if I suppose this value unit is 10 * mm (so I get 112 mm), the returned distance is wrong.

- third problem: The previous measures have been done with a samsung S5. If I do the same measures on a Huawei P7, The returned distance is 1340.. which is even more wrong.

Is there something I can do to improve this ?

Hello Laurent,

Please note that you need to specify the physical height of the target when creating the tracker using the physicalTargetImageHeights option. Also make sure to print out the target at exact that size.



Adding this to the tracker works better on the Samsung S5, but to get good values I have to use the width of my image target, I can see also that the getTargetPositionInCameraFrame() return inverted values for width and height.. is this normal ?
The distance is still wrong when using the Huawei P7... ( measure is done at 14,5 cm, with a S5 I get 146mm (OK), but with the Huawei I get 171 mm..)


Login or Signup to post a comment