/ipd-flask

Simple Flask API for inter pupillary distance measurement

Primary LanguagePython

ipd-flask

Simple flask app that provides api endpoint for ipd distance measurement.

Requirements

  • Flask
  • NumPy
  • OpenCV-Python
  • Dlib
  • Shape predictor file (shape_predictor_68_face_landmarks.dat)

Installation

  1. Clone the repository:

    git clone https://github.com/sammigul/ipd-flask.git
    
  2. Installing packages

    pip install flask numpy opencv-python
  3. Installing dlib (depends on the python version for ver 3.11 this file that I provided in the repo is required)

    pip install dlib-19.24.1-cp311-cp311-win_amd64.whl

Downloading shape_predictor_68_face_landmarks.dat

Running the App

  1. Setting the Environment Variables
  set FLASK_APP=app.py
  set FLASK_ENV=development
  1. Running the App

    flask run -p PORTNO  # Replace PORTNO with the desired port number (default is 5000)

    OR use this command if flask is not set in path variable

    python -m flask run -p PORTNO  # Replace PORTNO with the desired port number (default is 5000)

API Endpoint to measure ipd

Send an HTTP POST request to http://127.0.0.1:5000/measure_ipd, server will return the ipd distance in millimetres

Image Input Instructions

  • Aruco Marker File(75mm.pdf) is to be downloaded and printed.
  • Some sample images have been uploaded (5.jpg and 6.jpg), you can use them for testing purpose