How to get the 3D coordinates of object being photographed in real world

I want to implement an app which can take photo of the object and get the 3D coordinates in real world of the object,then based on 3D coordinates I can add some virtual message to the object on the screen.But the problem is I do not know how to get the 3D coordinates of the object being photographed especially when the phone is a little far away from the object.Thanks for help.

You need two cameras to be able to see depth, and thus find any relative 3D coordinates. If you don’t have that, you’ll have to resort to weak guessing methods that are very error-prone, and that’s more related to “computer vision” I think.

(You can try it yourself. Go somewhere where you have no muscle memory, close one eye, and try to reach for some object. You’ll have a bit of trouble!)

Thanks for your suggestion,but I have to use the phone camera and get the 3D coordinates of the object.And I have considered those weak guessing methods but my app needs accurate precision.Maybe I can find some useful information in Photogrammetry.Thank you very much anyway.