/cv_find_pupil_centroid

Technical OpenCV Interview Question

Primary LanguageShellMIT LicenseMIT

OpenCV Technical Interview Question

test_name: FindPupilCentroid

Authored by Seth Loh (c) 2020
Telemedc Pte Ltd

Objective


The human eye is one of the most common regions of interest on the human body, and is subject to a large body of literature and application use cases in eye-tracking and gaze estimation - How does it work?.

Your goal here is develop a pupil detection algorithm to detect the centroid of the pupil - usually the first step to any gaze-estimation algorithm. An embedded real-time solution would call for an image processing strategy that is lightweight and reliable. To illustrate, a camera running at 24 fps would require an execution of <41ms.

Key Objectives

  1. Measure within 10 fps between frame computations.
  2. Detect the centroid without jitter (defined as rapid changes in the centroid point between frames)
  3. Reject false centroids
  4. Maintain a detection rate of 80%

Must include

  1. Step-by-step intructions on how to install/run/deploy the program (README/markdown/.txt/). Choice of python3-venv or docker.
  2. A written explanation of your image processing strategy.
  3. Controls to pause/play the frame to facilitate review.
  4. Clear annotation of centroid and pupil on frames.
  5. A frame counting overlay.
  6. Type-checked, clean and refactored code. Any improper formatting will be heavily penalised.

Bonus

  1. A double-frame view to help visualise the image processing layers.
  2. Useful image annotations.
  3. Argparse for other video filenames
  4. Docstring explanations of code-blocks/functions.
  5. Controls to yield next frame.
  6. Dockerising the solution.

A sample frame capture could look something like:
sample_frame

Note: This is for illustrative purposes and is not the model output.

Whitelisted libraries

  1. python standard libraries
  2. python-opencv
  3. numpy
  4. imutils

Contact your interviewer or file an issue if you wish to use any other libraries that are out of scope.

Instructions


  1. clone this library (Note:: do not fork!)
  2. Download the dataset by running:
    chmod +x get_videos.sh
    and
    get_videos.sh (MacOSX, Linux only
    or download from
    https://tinyurl.com/tmc-cv2-challenge
  3. Create the test_videos directory if not created already, make sure that a sample video sample.mkv is located in here.
  4. Provison your python virtual environment.
  5. Create your entrypoint function at root and call it pupil_detect.py.
  6. Develop, document and package your solution and contact your recruiter when ready.
  7. You will be expectated to present your solution to a panel of interviewers.

Asssesment Critera


  1. Completion of key objectives [60%]
  2. Code quality [20%]
  3. Packaging [20%]