├── LICENSE ├── Landmarks21_BFM.anl ├── Landmarks68_BFM.anl ├── README.md ├── demo.m ├── img ├── 21.jpg └── 68.jpg ├── readLandmarks.m ├── showLandmarks.m └── testLandmarks.m /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Anil Bas 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Landmarks21_BFM.anl: -------------------------------------------------------------------------------- 1 | %21 Landmark points for Basel Face Model (AFLW annotation) 2 | %1-6: left to right eyebrows 3 | %7-12: left to right eyes 4 | %13-17: left ear - nose - right ear 5 | %18-20: mouth 6 | %21: chin 7 | % 8 | 38792 9 | 4646 10 | 40514 11 | 41091 12 | 11870 13 | 42825 14 | 2088 15 | 4410 16 | 5959 17 | 10603 18 | 12150 19 | 14472 20 | 20204 21 | 6389 22 | 8320 23 | 10259 24 | 34982 25 | 5392 26 | 8354 27 | 11326 28 | 48187 29 | 30 | -------------------------------------------------------------------------------- /Landmarks68_BFM.anl: -------------------------------------------------------------------------------- 1 | %68 Landmark points for Basel Face Model (300W annotation) 2 | 22143 3 | 22813 4 | 22840 5 | 23250 6 | 44124 7 | 45884 8 | 47085 9 | 47668 10 | 48188 11 | 48708 12 | 49299 13 | 50498 14 | 52457 15 | 32022 16 | 32386 17 | 32359 18 | 32979 19 | 38886 20 | 39636 21 | 40030 22 | 40238 23 | 40433 24 | 41172 25 | 41368 26 | 41578 27 | 42011 28 | 42646 29 | 8291 30 | 8305 31 | 8314 32 | 8320 33 | 6783 34 | 7687 35 | 8331 36 | 8977 37 | 9879 38 | 1832 39 | 3760 40 | 5050 41 | 6087 42 | 4546 43 | 3516 44 | 10731 45 | 11758 46 | 12919 47 | 14859 48 | 13191 49 | 12157 50 | 5523 51 | 6155 52 | 7442 53 | 8345 54 | 9506 55 | 10799 56 | 11199 57 | 10179 58 | 9277 59 | 8374 60 | 7471 61 | 6566 62 | 5909 63 | 7322 64 | 8354 65 | 9386 66 | 10941 67 | 9141 68 | 8367 69 | 7194 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Landmarks for Basel Face Model (3DMM) 2 | This page provides 2 types of landmark indices/anchor points for Basel Face Model. 3 | 4 | 68 Landmarks21 Landmarks 5 | 6 | - **Landmarks68_BFM.anl**: 68 Landmarks (Fig:Left) for [300W](https://ibug.doc.ic.ac.uk/resources/300-W/) Annotation. 7 | - **Landmarks21_BFM.anl**: 21 Landmarks (Fig:Right) for [AFLW](https://www.tugraz.at/institute/icg/research/team-bischof/lrs/downloads/aflw) Annotation. 8 | 9 | To load the landmarks, simply call the readLandmarks function: 10 | 11 | ```matlab 12 | idx = readLandmarks('Landmarks21_BFM.anl'); 13 | ``` 14 | 15 | ## Running the demo code 16 | 17 | The demo scripts loads the morphable model and plots the landmarks on top of the mean face. Please set the path for the model file, `01_MorphableModel.mat`, in the first line of the script or you could copy the repository in the same folder. It is possible to obtain the model upon signing a license agreement via the [website](http://faces.cs.unibas.ch/bfm) of [Graphics and Vision Research Group, University of Basel](http://gravis.dmi.unibas.ch). 18 | 19 | Fell free to use, copy, modify and share. 20 | -------------------------------------------------------------------------------- /demo.m: -------------------------------------------------------------------------------- 1 | BFMpath = '01_MorphableModel.mat'; 2 | BFM = load(BFMpath); 3 | 4 | landmarkpath = 'Landmarks68_BFM.anl'; 5 | %landmarkpath = 'Landmarks21_BFM.anl'; 6 | idx = readLandmarks(landmarkpath); 7 | 8 | vertices = double(reshape(BFM.shapeMU,3,length(BFM.shapeMU)/3)'); 9 | faces = BFM.tl; 10 | 11 | showLandmarks(vertices,faces,idx); -------------------------------------------------------------------------------- /img/21.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilbas/BFMLandmarks/97a929189533f95f3dead9f91c2763bc7563f84c/img/21.jpg -------------------------------------------------------------------------------- /img/68.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilbas/BFMLandmarks/97a929189533f95f3dead9f91c2763bc7563f84c/img/68.jpg -------------------------------------------------------------------------------- /readLandmarks.m: -------------------------------------------------------------------------------- 1 | function landmarks = readLandmarks(filename) 2 | fileID = fopen( filename ); 3 | C = textscan(fileID,'%f','CommentStyle','%'); 4 | fclose(fileID); 5 | landmarks = cell2mat(C); 6 | end -------------------------------------------------------------------------------- /showLandmarks.m: -------------------------------------------------------------------------------- 1 | function showLandmarks(vertices,faces,idx) 2 | figure; 3 | subplot(1,3,1); hold on; plotLandmarks(vertices*roty(-30),faces,idx); 4 | subplot(1,3,2); hold on; plotLandmarks(vertices,faces,idx) 5 | subplot(1,3,3); hold on; plotLandmarks(vertices*roty(30),faces,idx); 6 | function plotLandmarks(vertices,faces,idx) 7 | %patch('Vertices',vertices,'Faces',faces,'FaceColor', [1 1 1], 'EdgeColor', 'none', 'FaceLighting', 'phong'); axis equal; axis off; light; 8 | patch('Faces',faces,'Vertices',vertices,'FaceColor', [0.9 0.9 0.9], 'EdgeColor', 'none','FaceLighting', 'gouraud','AmbientStrength',0.2,'DiffuseStrength',0.8,'SpecularStrength',0,'BackFaceLighting','lit'); axis tight; axis equal; axis off; light('Position',[0 0 1],'Style','infinite'); 9 | plot3(vertices(idx,1),vertices(idx,2),vertices(idx,3),'.'); 10 | text(vertices(idx,1),vertices(idx,2),vertices(idx,3)*2,cellstr(num2str((1:length(idx))'))); -------------------------------------------------------------------------------- /testLandmarks.m: -------------------------------------------------------------------------------- 1 | function testLandmarks 2 | 3 | FV.vertices= double(reshape(BFM.shapeMU,3,length(BFM.shapeMU)/3)'); 4 | FV.faces = BFM.faces; 5 | 6 | figure; 7 | subplot(1,3,1); plotLandmarks(FV.vertices*roty(-30),faces,idx); 8 | subplot(1,3,2); plotLandmarks(FV.vertices,faces,idx) 9 | subplot(1,3,3); plotLandmarks(FV.vertices*roty(30),faces,idx) 10 | function plotLandmarks(vertices,faces,idx) 11 | patch('Vertices',vertices,'Faces',faces,'FaceColor', [1 1 1], 'EdgeColor', 'none', 'FaceLighting', 'phong'); axis equal; axis off; light; 12 | plot3(vertices(idx,1),vertices(idx,2),vertices(idx,3),'.'); 13 | text(vertices(idx,1),vertices(idx,2),vertices(idx,3)*2,cellstr(num2str((1:length(idx))'))); 14 | --------------------------------------------------------------------------------