-
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.
- 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.
- 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.
- Name: Ahmed Abdulrahman
- Researcher/Data Scientist/Engineer
- Email: [email protected]