This project is used to compute the distance of a known object from our camera.
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.
Find the area enclosed by the countour.
cv2.contourArea(contour)- Calibrate the readings of area with those of manually measured distance.
- Use these readings to plot a graph.
- Find the equation of the trendline in excel which fits best with the data.
- Now finally, use the equation of trendline to calculate the distance.
Distance = 1134.6*((cv2.contourArea(contour))**(-0.497))
