Answers.Body: <p>The short answer is: yes, it could. In what you are describing, there's nothing very new or specific conceptually; it sounds like a standard regression task. Now the problem that you're actually facing is: <strong>do you have the data?</strong></p>
  
  <p>Algorithms won't be able to learn the distance between eyes if you don't have the data that it takes. It could be supervised labels (1 distance per image which would be your regression target), reconstruction from depth maps, multi-view estimation etc. There's a number of ways you could do that <em>given the appropriate data</em>. </p>
  
  <p>People focus on algorithms a lot, and that's good. But taking a good look at your data is often as important (if not more). </p>
  
  <p>Now a good example would be in the self-driving car literature. You could start with this blog-post and go through the papers they reference: <a href="https://towardsdatascience.com/vehicle-detection-and-distance-estimation-7acde48256e1" rel="nofollow noreferrer">https://towardsdatascience.com/vehicle-detection-and-distance-estimation-7acde48256e1</a></p>
  
  <p>There also seems to be some litterature about your eyes examples (<a href="https://arxiv.org/pdf/1806.10890.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/1806.10890.pdf</a>, <a href="https://www.sciencedirect.com/science/article/pii/S0165027019301578" rel="nofollow noreferrer">https://www.sciencedirect.com/science/article/pii/S0165027019301578</a>) so skimming through these papers &amp; the datasets they use could guide to towards answering my question: is there data for this task?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-14T14:22:14.833Z
Answers.Text: Hi there thank you for the reply back, could you give any examples what type of data would be needed ? I will have a read of the links you posted.
Answers.UserDisplayName: Cavallino 
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-14T15:57:43.063Z
Answers.Text: I did! The ideal data you'd have is a dataset of labeled images like `(image, distance-between-eyes-in-cm)`. If you don't have access to labels directly maybe you can reconstruct it using multiple views of  the same face with known translation from one POV to the other or using depth information. For instance in the self-driving car situation you probably need LIDAR data to tell you how far objects are.
Answers.UserDisplayName: ted
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-14T13:19:13.827Z
Answers.LastActivityDate: 2020-04-14T13:25:55.960Z
Answers.LastEditDate: 2020-04-14T13:25:55.960Z
Answers.UserDisplayName: ted
Answers.Body: <p>Yes. There's a library called OpenCV that can be used to measure distance between objects.</p>
  
  <p>To find out the distance of two objects, we must know the dimensions of the reference object. There are two important properties for the reference object:</p>
  
  <ol>
  <li>We know the dimensions of the object in certain units(inches,
  millimeters, etc.) </li>
  <li>The reference object needs to be easily found in the photo.</li>
  </ol>
  
  <p>Dimensions of the reference object will be used to measure distance beetween other objects. Also, we firstly need to compute the “pixels-per-metric” ratio, used to determine how many pixels “fit” into a given unit of measurement.</p>
  
  <p>Go to this post for detailed explanation:
  <a href="https://www.pyimagesearch.com/2016/03/28/measuring-size-of-objects-in-an-image-with-opencv/" rel="nofollow noreferrer">https://www.pyimagesearch.com/2016/03/28/measuring-size-of-objects-in-an-image-with-opencv/</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-21T11:09:32.627Z
Answers.LastActivityDate: 2020-04-22T14:54:24.717Z
Answers.LastEditDate: 2020-04-22T14:54:24.717Z
Answers.UserDisplayName: Yoga Ajitama
Body: <p>Could machine learning be used to measure the distance between two objects from a picture or live camera? </p>
  
  <p>An example of this is the measurement between the centre of each eye pupil.</p>
  
  <p>This area is all new to me, so any advice and suggestions would be greatly appreciated. </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-14T22:17:04.557Z
Comments.Text: Welcome to SE:AI!
Comments.UserDisplayName: DukeZhou
Tags: <machine-learning><computer-vision><applications>
Title: Could machine learning be used to measure the distance between two objects from a picture or live camera?
UserDisplayName: Cavallino 
ThreadText: # Could machine learning be used to measure the distance between two objects from a picture or live camera?
  
  (Asked by: username_0 on 2020-04-14)
  
  Could machine learning be used to measure the distance between two objects from a picture or live camera?
  
  An example of this is the measurement between the centre of each eye pupil.
  
  This area is all new to me, so any advice and suggestions would be greatly appreciated.
  
  **Tags:** machine-learning, computer-vision, applications
  > **Comments:**
  > **username_1**: Welcome to SE:AI!  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2020-04-14. Score: 3
  
  The short answer is: yes, it could. In what you are describing, there's nothing very new or specific conceptually; it sounds like a standard regression task. Now the problem that you're actually facing is: **do you have the data?**
  
  Algorithms won't be able to learn the distance between eyes if you don't have the data that it takes. It could be supervised labels (1 distance per image which would be your regression target), reconstruction from depth maps, multi-view estimation etc. There's a number of ways you could do that *given the appropriate data*.
  
  People focus on algorithms a lot, and that's good. But taking a good look at your data is often as important (if not more).
  
  Now a good example would be in the self-driving car literature. You could start with this blog-post and go through the papers they reference: <https://towardsdatascience.com/vehicle-detection-and-distance-estimation-7acde48256e1>
  
  There also seems to be some litterature about your eyes examples (<https://arxiv.org/pdf/1806.10890.pdf>, <https://www.sciencedirect.com/science/article/pii/S0165027019301578>) so skimming through these papers & the datasets they use could guide to towards answering my question: is there data for this task?
  
  > **Comments:**
  > **username_0**: Hi there thank you for the reply back, could you give any examples what type of data would be needed ? I will have a read of the links you posted.  
  > **username_2**: I did! The ideal data you'd have is a dataset of labeled images like `(image, distance-between-eyes-in-cm)`. If you don't have access to labels directly maybe you can reconstruct it using multiple views of  the same face with known translation from one POV to the other or using depth information. For instance in the self-driving car situation you probably need LIDAR data to tell you how far objects are.  
  
  ---
  
  ### Answer by username_3 on 2020-04-21. Score: 1
  
  Yes. There's a library called OpenCV that can be used to measure distance between objects.
  
  To find out the distance of two objects, we must know the dimensions of the reference object. There are two important properties for the reference object:
  
  1. We know the dimensions of the object in certain units(inches,
     millimeters, etc.)
  2. The reference object needs to be easily found in the photo.
  
  Dimensions of the reference object will be used to measure distance beetween other objects. Also, we firstly need to compute the “pixels-per-metric” ratio, used to determine how many pixels “fit” into a given unit of measurement.
  
  Go to this post for detailed explanation:
  <https://www.pyimagesearch.com/2016/03/28/measuring-size-of-objects-in-an-image-with-opencv/>
  
  
  ---
  
  