-2

Basically, I have a camera that gives me the (x , y) coordinates of an object. I need to figure out the distance from the camera to the object based on these coordinates. Is there a way to do so? (the camera is fixed on a moving robot. so the camera's coordinates are always varying.)

Sunny
  • 1
  • 1
    Depends. If you know the coordinates of the camera, it's fairly simple. In other words: some information about the camera must be known. What do we know? – PrincessEev Jul 18 '19 at 08:15
  • the camera is fixed on a moving robot. so its coordinates are going to vary whenever the robot moves. – Sunny Jul 18 '19 at 08:23
  • It'd be impossible to know the distance, then. However, perhaps if the robot in question is moving in a "nice enough" way (from a mathematical standpoint) -- say if there was a function determining the robot's position at a given time $t$ -- we could figure out the distance at a given time, for instance. – PrincessEev Jul 18 '19 at 08:26
  • the robot will only be moving forward at a slow rate. – Sunny Jul 18 '19 at 08:34
  • Are these $(x,y)$ coordinates in a 2-D image of a 3-D scene, or is everything happening in 2-D? That makes a big difference. – amd Jul 18 '19 at 08:40
  • it's in a 2-D image – Sunny Jul 18 '19 at 09:28

1 Answers1

0

Yes. Assuming your camera is located in the origin of a Cartesian coordinate system, the distance is given by $\sqrt{x^2+y^2}$. If your camera is located at a point $(a,b)$, then the distance is $\sqrt{(x-a)^2+(y-b)^2}$.