4
$\begingroup$

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.

$\endgroup$
1
  • 1
    $\begingroup$ Welcome to SE:AI! $\endgroup$
    – DukeZhou
    Apr 14, 2020 at 22:17

2 Answers 2

3
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$ Apr 14, 2020 at 14:22
  • $\begingroup$ 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. $\endgroup$
    – ted
    Apr 14, 2020 at 15:57
1
$\begingroup$

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/

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .