Created
January 6, 2016 13:22
-
-
Save lydonchandra/44ceb80c84204d684df6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 42, | |
| "metadata": { | |
| "collapsed": false | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "from PIL import Image, ImageDraw\n", | |
| "from pprint import pprint\n", | |
| "import pickle\n", | |
| "\n", | |
| "# http://www.cl.cam.ac.uk/~eww23/data/syntheseyes_data.zip\n", | |
| "parent_path = '/Users/lydonchandra/Documents/menpo-pic/SynthEyes_data/f01/'\n", | |
| "eye = Image.open(parent_path + 'f01_36_0.1963_-0.7854.png')\n", | |
| "draw = ImageDraw.Draw(eye)\n", | |
| "eye_landmarks = pickle.load( open( parent_path+'f01_36_0.1963_-0.7854.pkl', 'rb'))\n", | |
| "# pprint(eye_landmarks['ldmks'])\n", | |
| "\n", | |
| "draw.polygon(eye_landmarks['ldmks']['ldmks_lids_2d'])\n", | |
| "draw.polygon(eye_landmarks['ldmks']['ldmks_iris_2d'])\n", | |
| "draw.polygon(eye_landmarks['ldmks']['ldmks_pupil_2d'])\n", | |
| "# draw.point([29.067360162734985, 49.65967416763306])\n", | |
| "eye.show()\n", | |
| "\n", | |
| "# {u'ldmks_iris_2d': [(61.65026664733887, 22.73038387298584),\n", | |
| "# (64.54386234283447, 11.405439376831055),\n", | |
| "# (72.31542348861694, 7.578072547912598),\n", | |
| "# (80.4124116897583, 13.490300178527832),\n", | |
| "# (84.09177303314209, 25.678772926330566),\n", | |
| "# (81.19817733764648, 37.00367450714111),\n", | |
| "# (73.42663764953613, 40.83102226257324),\n", | |
| "# (64.13939952850342, 35.82379341125488)],\n", | |
| "# pprint(eye_landmarks)\n", | |
| "# image.show()\n", | |
| "# SynthesEyes_dataset\n", | |
| "# ├── f01 # data for f01 eye region model\n", | |
| "# │ ├── f01_36_0.1963_-0.7854.png # 120x80px image\n", | |
| "# │ ├── f01_36_0.1963_-0.7854.pkl # associated data for that image\n", | |
| "# │ └── …\n", | |
| "# ├── f02\n", | |
| "# … # data for f03, f04 … m03, m04\n", | |
| "# └── m05\n", | |
| "\n", | |
| "# The associated data for each image is a dict with keys:\n", | |
| "\n", | |
| "# look_vec – the 3D gaze direction in camera space.\n", | |
| "# head_pose – a 3x3 matrix rotation from world space to camera space.\n", | |
| "# ldmks – a dict containing the following 2D and 3D landmarks:\n", | |
| "# ldmks_lids_2d, ldmks_iris_2d, ldmks_pupil_2d in screen space.\n", | |
| "# ldmks_lids_3d, ldmks_iris_3d, ldmks_pupil_3d in camera space" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": { | |
| "collapsed": true | |
| }, | |
| "outputs": [], | |
| "source": [] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Python 2", | |
| "language": "python", | |
| "name": "python2" | |
| }, | |
| "language_info": { | |
| "codemirror_mode": { | |
| "name": "ipython", | |
| "version": 2 | |
| }, | |
| "file_extension": ".py", | |
| "mimetype": "text/x-python", | |
| "name": "python", | |
| "nbconvert_exporter": "python", | |
| "pygments_lexer": "ipython2", | |
| "version": "2.7.11" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 0 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment