Skip to content

Latest commit

 

History

History
27 lines (25 loc) · 1.18 KB

File metadata and controls

27 lines (25 loc) · 1.18 KB

Distance Calculator

This project is used to compute the distance of a known object from our camera.

Dependent Packages

Project Workflow

To accomplish this task we use the following principle:

  • Area enclosed by the contours of an object decreases as the object moves farther from the camera.

Step-1

Find the area enclosed by the countour.

cv2.contourArea(contour)

Step-2

  1. Calibrate the readings of area with those of manually measured distance.
  2. Use these readings to plot a graph.

  1. Find the equation of the trendline in excel which fits best with the data.
  2. Now finally, use the equation of trendline to calculate the distance.
Distance = 1134.6*((cv2.contourArea(contour))**(-0.497))

Output