Skip to content

this project is to calculate the distance between your eyes and laptop screen using the webcam

Notifications You must be signed in to change notification settings

Ahmed-0357/eye_to_screen_distance_measurement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eye to Screen Distance Measurement With Computer Vision 👀💻

  • This project is to calculate the distance between your eyes and laptop screen using the webcam.

  • The concept is that an object will appear smaller once it is further away from the camera and vice versa.

  • The distance between your eyes (pixel) will be used as the reference object and will get converted into the distance (cm) to the laptop screen.

  • Ergonomics tip: laptop screen should be positioned at least 20 inches (51 cm) away from your eyes.

GIF


How to run this app

📝Note: For quick testing jump straight to Step-2

Step-1:

  • In distance_calculator.py, create an instance of DistanceCalculator class and call run_config() instance method
if __name__ == '__main__':
    eye_screen_distance = DistanceCalculator()
    eye_screen_distance.run_config()
  • The webcam will start working and the distance between the user's eyes (pixel) will show up.

  • Using a measuring tape, take a few measurements (cm) between your eye and laptop screen, then jot them down along with the corresponding distance between eyes (pixel).

  • Take a minimum of five measurements and different locations and save them to distance_xy.csv.

  • click letter K on the keyboard to stop the webcam.

  • This is a one-time step and no need to do it again after updating distance_xy.csv.

Step-2:

  • In distance_calculator.py, read distance_xy.csv file, create an instance of DistanceCalculator class and call calculate_distance() instance method
if __name__ == '__main__':
    distance_df = pd.read_csv('distance_xy.csv')
    eye_screen_distance = DistanceCalculator()
    eye_screen_distance.calculate_distance(distance_df['distance_pixel'], distance_df['distance_cm'])
  • click letter K on the keyboard to stop the webcam.

Author

About

this project is to calculate the distance between your eyes and laptop screen using the webcam

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages